From bb468da2002055c10c2b27665ad31a3bbe109fe0 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 8 Sep 2017 18:21:14 +0000 Subject: [PATCH] Simplify as this runs before copy relocations are created. llvm-svn: 312807 --- lld/ELF/Writer.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 921d15fc4d36..7c53d2fe37ea 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -1226,12 +1226,6 @@ static void removeUnusedSyntheticSections() { // 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(&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 SymbolBody &B) { // 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.