From 580d7a1b1ea827fc9b2f170855e0b830659aa456 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 7 Jul 2016 22:50:54 +0000 Subject: [PATCH] -Bsymbolic should not make symbols more preemptable. But it was doing that for protected undefined symbols. llvm-svn: 274803 --- lld/ELF/Symbols.cpp | 9 ++++++--- lld/test/ELF/bsymbolic.s | 4 ++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp index 700c3bf803b2..78786980db61 100644 --- a/lld/ELF/Symbols.cpp +++ b/lld/ELF/Symbols.cpp @@ -129,11 +129,14 @@ bool SymbolBody::isPreemptible() const { if (!symbol()->includeInDynsym()) return false; - // Normally only default visibility symbols can be preempted, but -Bsymbolic - // means that not even they can be preempted. + // Only default visibility symbols can be preempted. + if (symbol()->Visibility != STV_DEFAULT) + return false; + + // -Bsymbolic means that definitions are not preempted. if (Config->Bsymbolic || (Config->BsymbolicFunctions && isFunc())) return !isDefined(); - return symbol()->Visibility == STV_DEFAULT; + return true; } template InputFile *SymbolBody::getSourceFile() { diff --git a/lld/test/ELF/bsymbolic.s b/lld/test/ELF/bsymbolic.s index 3929d7bae3b6..d713588d5952 100644 --- a/lld/test/ELF/bsymbolic.s +++ b/lld/test/ELF/bsymbolic.s @@ -28,3 +28,7 @@ nop do: callq foo@PLT callq bar@PLT + +.weak zed +.protected zed +.quad zed