[lld] r368535 - [ELF] Remove redundant !isPreemptible in Symbol::computeBinding()

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 11 09:12:08 PDT 2019


Author: maskray
Date: Sun Aug 11 09:12:07 2019
New Revision: 368535

URL: http://llvm.org/viewvc/llvm-project?rev=368535&view=rev
Log:
[ELF] Remove redundant !isPreemptible in Symbol::computeBinding()

!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.

Modified:
    lld/trunk/ELF/Symbols.cpp

Modified: lld/trunk/ELF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=368535&r1=368534&r2=368535&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.cpp (original)
+++ lld/trunk/ELF/Symbols.cpp Sun Aug 11 09:12:07 2019
@@ -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;




More information about the llvm-commits mailing list