summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/ELF/Symbols.cpp9
-rw-r--r--lld/test/ELF/bsymbolic.s4
2 files changed, 10 insertions, 3 deletions
diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp
index 700c3bf803b..78786980db6 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 <class ELFT> InputFile *SymbolBody::getSourceFile() {
diff --git a/lld/test/ELF/bsymbolic.s b/lld/test/ELF/bsymbolic.s
index 3929d7bae3b..d713588d595 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
OpenPOWER on IntegriCloud