[ELF] Remove redundant !isPreemptible in Symbol::computeBinding()
authorFangrui Song <maskray@google.com>
Sun, 11 Aug 2019 16:12:07 +0000 (16:12 +0000)
committerFangrui Song <maskray@google.com>
Sun, 11 Aug 2019 16:12:07 +0000 (16:12 +0000)
!isPreemptible was added in r343668 to fix PR39104: symbols redefined by
replaceWithDefined() might be incorrectly considered STB_LOCAL if a
version script specified `local: *;`.

After r367869 (`config->defaultSymbolVersion` was removed), we will
assign VER_NDX_LOCAL to only regular Defined and CommonSymbol, not
Defined created by replaceWithDefined() (because scanVersionScript() is
called before scanRelocations()). The !isPreemptible is thus redundant
and can be deleted.

llvm-svn: 368535

lld/ELF/Symbols.cpp

index e8eaa0c..6652f48 100644 (file)
@@ -278,7 +278,7 @@ uint8_t Symbol::computeBinding() const {
     return binding;
   if (visibility != STV_DEFAULT && visibility != STV_PROTECTED)
     return STB_LOCAL;
-  if (versionId == VER_NDX_LOCAL && isDefined() && !isPreemptible)
+  if (versionId == VER_NDX_LOCAL && isDefined())
     return STB_LOCAL;
   if (!config->gnuUnique && binding == STB_GNU_UNIQUE)
     return STB_GLOBAL;