[lld] r307820 - Bring back InVersionScript.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 12 10:49:17 PDT 2017
Author: rafael
Date: Wed Jul 12 10:49:17 2017
New Revision: 307820
URL: http://llvm.org/viewvc/llvm-project?rev=307820&view=rev
Log:
Bring back InVersionScript.
We were producing bogus warnings without it.
Added:
lld/trunk/test/ELF/Inputs/version-script-no-warn2.s
lld/trunk/test/ELF/version-script-no-warn2.s
Modified:
lld/trunk/ELF/SymbolTable.cpp
lld/trunk/ELF/Symbols.h
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=307820&r1=307819&r2=307820&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Wed Jul 12 10:49:17 2017
@@ -231,6 +231,7 @@ std::pair<Symbol *, bool> SymbolTable<EL
Symbol *Sym;
if (IsNew) {
Sym = make<Symbol>();
+ Sym->InVersionScript = false;
Sym->Binding = STB_WEAK;
Sym->Visibility = STV_DEFAULT;
Sym->IsUsedInRegularObj = false;
@@ -702,9 +703,10 @@ void SymbolTable<ELFT>::assignExactVersi
continue;
Symbol *Sym = B->symbol();
- if (Sym->VersionId != Config->DefaultSymbolVersion)
+ if (Sym->InVersionScript)
warn("duplicate symbol '" + Ver.Name + "' in version script");
Sym->VersionId = VersionId;
+ Sym->InVersionScript = true;
}
}
Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=307820&r1=307819&r2=307820&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Wed Jul 12 10:49:17 2017
@@ -365,6 +365,9 @@ struct Symbol {
// True if this symbol is specified by --trace-symbol option.
unsigned Traced : 1;
+ // This symbol version was found in a version script.
+ unsigned InVersionScript : 1;
+
bool includeInDynsym() const;
uint8_t computeBinding() const;
bool isWeak() const { return Binding == llvm::ELF::STB_WEAK; }
Added: lld/trunk/test/ELF/Inputs/version-script-no-warn2.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/version-script-no-warn2.s?rev=307820&view=auto
==============================================================================
--- lld/trunk/test/ELF/Inputs/version-script-no-warn2.s (added)
+++ lld/trunk/test/ELF/Inputs/version-script-no-warn2.s Wed Jul 12 10:49:17 2017
@@ -0,0 +1 @@
+call foo at plt
Added: lld/trunk/test/ELF/version-script-no-warn2.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/version-script-no-warn2.s?rev=307820&view=auto
==============================================================================
--- lld/trunk/test/ELF/version-script-no-warn2.s (added)
+++ lld/trunk/test/ELF/version-script-no-warn2.s Wed Jul 12 10:49:17 2017
@@ -0,0 +1,8 @@
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/version-script-no-warn2.s -o %t1.o
+# RUN: ld.lld %t1.o -o %t1.so -shared
+# RUN: echo "{ global: foo; local: *; };" > %t.script
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t2.o
+# RUN: ld.lld -shared --version-script %t.script %t2.o %t1.so -o %t2.so --fatal-warnings
+
+.global foo
+foo:
More information about the llvm-commits
mailing list