[ELF] Warn for duplicate symbols in version scripts instead of erroring out.

Emitting an error in this case breaks real-world application (e.g. libreoffice).
See http://reviews.llvm.org/D21555 for context.

Differential Revision:  http://reviews.llvm.org/D21781

llvm-svn: 273989
This commit is contained in:
Davide Italiano 2016-06-28 03:40:49 +00:00
parent 72e0fe9c12
commit 4fdc648592
2 changed files with 4 additions and 4 deletions

View File

@ -534,7 +534,7 @@ template <class ELFT> void SymbolTable<ELFT>::scanVersionScript() {
if (SymbolBody *B = find(Name)) {
if (B->symbol()->VersionId != VER_NDX_GLOBAL &&
B->symbol()->VersionId != VER_NDX_LOCAL)
error("duplicate symbol " + Name + " in version script");
warning("duplicate symbol " + Name + " in version script");
B->symbol()->VersionId = I;
}
++I;

View File

@ -53,9 +53,9 @@
# RUN: VERSION_2.0 { \
# RUN: global: foo1; \
# RUN: local: *; }; " > %t6.script
# RUN: not ld.lld --version-script %t6.script -shared %t.o %t2.so -o %t6.so 2>&1 | \
# RUN: FileCheck -check-prefix=ERR2 %s
# ERR2: duplicate symbol foo1 in version script
# RUN: ld.lld --version-script %t6.script -shared %t.o %t2.so -o %t6.so 2>&1 | \
# RUN: FileCheck -check-prefix=WARN2 %s
# WARN2: duplicate symbol foo1 in version script
# RUN: ld.lld --version-script %t.script --dynamic-list %t.list %t.o %t2.so -o %t2
# RUN: llvm-readobj %t2 > /dev/null