Avoid creating duplicated relocations.
llvm-svn: 265139
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 5f47499..d2b6335 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -295,9 +295,11 @@
}
if (!Body.isPreemptible())
return 1;
- Out<ELFT>::Got->addEntry(Body);
- Out<ELFT>::RelaDyn->addReloc(
- {Target->TlsGotRel, DynamicReloc<ELFT>::Off_Got, false, &Body});
+ if (!Body.isInGot()) {
+ Out<ELFT>::Got->addEntry(Body);
+ Out<ELFT>::RelaDyn->addReloc(
+ {Target->TlsGotRel, DynamicReloc<ELFT>::Off_Got, false, &Body});
+ }
return 2;
}
return 0;