[lld] r306996 - Revert r306813: "[ELF] - Resolve references properly when using .symver directive"

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 2 20:26:07 PDT 2017


Author: ruiu
Date: Sun Jul  2 20:26:07 2017
New Revision: 306996

URL: http://llvm.org/viewvc/llvm-project?rev=306996&view=rev
Log:
Revert r306813: "[ELF] - Resolve references properly when using .symver directive"

This reverts commit r306813 because it broke linking of the
FreeBSD base system.

Removed:
    lld/trunk/test/ELF/version-script-symver.s
Modified:
    lld/trunk/ELF/SymbolTable.cpp

Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=306996&r1=306995&r2=306996&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Sun Jul  2 20:26:07 2017
@@ -712,31 +712,15 @@ void SymbolTable<ELFT>::assignWildcardVe
       B->symbol()->VersionId = VersionId;
 }
 
-static bool isDefaultVersion(SymbolBody *B) {
-  return B->isInCurrentDSO() && B->getName().find("@@") != StringRef::npos;
-}
-
 // This function processes version scripts by updating VersionId
 // member of symbols.
 template <class ELFT> void SymbolTable<ELFT>::scanVersionScript() {
   // Symbol themselves might know their versions because symbols
   // can contain versions in the form of <name>@<version>.
-  // Let them parse and update their names to exclude version suffix.
-  for (Symbol *Sym : SymVector) {
-    SymbolBody *Body = Sym->body();
-    bool IsDefault = isDefaultVersion(Body);
-    Body->parseSymbolVersion();
-
-    if (!IsDefault)
-      continue;
-
-    // <name>@@<version> means the symbol is the default version. If that's the
-    // case, the symbol is not used only to resolve <name> of version <version>
-    // but also undefined unversioned symbols with name <name>.
-    SymbolBody *S = find(Body->getName());
-    if (S && S->isUndefined())
-      S->copy(Body);
-  }
+  // Let them parse their names.
+  if (!Config->VersionDefinitions.empty())
+    for (Symbol *Sym : SymVector)
+      Sym->body()->parseSymbolVersion();
 
   // Handle edge cases first.
   handleAnonymousVersion();

Removed: lld/trunk/test/ELF/version-script-symver.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/version-script-symver.s?rev=306995&view=auto
==============================================================================
--- lld/trunk/test/ELF/version-script-symver.s (original)
+++ lld/trunk/test/ELF/version-script-symver.s (removed)
@@ -1,11 +0,0 @@
-# REQUIRES: x86
-
-# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
-# RUN: echo "VERSION { global: *; };" > %t.map
-# RUN: ld.lld %t.o --version-script %t.map -o %t
-
-.global _start
-.global bar
-.symver _start, bar@@VERSION
-_start:
-  jmp bar




More information about the llvm-commits mailing list