Bring back InVersionScript.

We were producing bogus warnings without it.

llvm-svn: 307820
This commit is contained in:
Rafael Espindola 2017-07-12 17:49:17 +00:00
parent 6d6c06879c
commit d3fc0c91e3
4 changed files with 15 additions and 1 deletions

View File

@ -231,6 +231,7 @@ std::pair<Symbol *, bool> SymbolTable<ELFT>::insert(StringRef Name) {
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>::assignExactVersion(SymbolVersion Ver, uint16_t VersionId
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;
}
}

View File

@ -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; }

View File

@ -0,0 +1 @@
call foo@plt

View File

@ -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: