[lld] r312807 - Simplify as this runs before copy relocations are created.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 8 11:21:15 PDT 2017


Author: rafael
Date: Fri Sep  8 11:21:14 2017
New Revision: 312807

URL: http://llvm.org/viewvc/llvm-project?rev=312807&view=rev
Log:
Simplify as this runs before copy relocations are created.

Modified:
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=312807&r1=312806&r2=312807&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Fri Sep  8 11:21:14 2017
@@ -1226,12 +1226,6 @@ static void removeUnusedSyntheticSection
 // with the same name defined in other ELF executable or DSO.
 static bool computeIsPreemptible(const SymbolBody &B) {
   assert(!B.isLocal());
-  // Shared symbols resolve to the definition in the DSO. The exceptions are
-  // symbols with copy relocations (which resolve to .bss) or preempt plt
-  // entries (which resolve to that plt entry).
-  if (auto *SS = dyn_cast<SharedSymbol>(&B))
-    return !SS->CopyRelSec && !SS->NeedsPltAddr;
-
   // Only symbols that appear in dynsym can be preempted.
   if (!B.symbol()->includeInDynsym())
     return false;
@@ -1246,7 +1240,7 @@ static bool computeIsPreemptible(const S
   // executables are automatically exported so that the runtime linker
   // can try to resolve them. In that case, they are preemptible. So, we
   // return true for an undefined symbols in all cases.
-  if (B.isUndefined())
+  if (B.isUndefined() || B.isShared())
     return true;
 
   // If we have a dynamic list it specifies which local symbols are preemptible.




More information about the llvm-commits mailing list