forked from OSchip/llvm-project
Fix a bogus warning.
We first decide that the symbol is global, than that it should have version foo. Since it was already not the default version, we were producing a bogus warning. llvm-svn: 289284
This commit is contained in:
parent
aec1876601
commit
dd9dd488fc
|
|
@ -192,6 +192,7 @@ std::pair<Symbol *, bool> SymbolTable<ELFT>::insert(StringRef Name) {
|
|||
Symbol *Sym;
|
||||
if (IsNew) {
|
||||
Sym = new (BAlloc) Symbol;
|
||||
Sym->InVersionScript = false;
|
||||
Sym->Binding = STB_WEAK;
|
||||
Sym->Visibility = STV_DEFAULT;
|
||||
Sym->IsUsedInRegularObj = false;
|
||||
|
|
@ -643,9 +644,11 @@ void SymbolTable<ELFT>::assignExactVersion(SymbolVersion Ver, uint16_t VersionId
|
|||
continue;
|
||||
}
|
||||
|
||||
if (B->symbol()->VersionId != Config->DefaultSymbolVersion)
|
||||
Symbol *Sym = B->symbol();
|
||||
if (Sym->InVersionScript)
|
||||
warn("duplicate symbol '" + Ver.Name + "' in version script");
|
||||
B->symbol()->VersionId = VersionId;
|
||||
Sym->VersionId = VersionId;
|
||||
Sym->InVersionScript = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -405,6 +405,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;
|
||||
bool isWeak() const { return Binding == llvm::ELF::STB_WEAK; }
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
# REQUIRES: x86
|
||||
|
||||
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
|
||||
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/shared.s -o %t2.o
|
||||
# RUN: ld.lld -shared %t2.o -soname shared -o %t2.so
|
||||
|
||||
# RUN: echo "foo { global: bar; local: *; };" > %t.script
|
||||
# RUN: ld.lld --fatal-warnings --shared --version-script %t.script %t.o %t2.so
|
||||
|
||||
.global bar
|
||||
bar:
|
||||
nop
|
||||
Loading…
Reference in New Issue