[PATCH] D44062: Don't warn if a symbol is assigned to the same version twice, but error if it is assigned to multiple
Rafael Avila de Espindola via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 2 18:19:52 PST 2018
espindola updated this revision to Diff 136891.
espindola added a comment.
Rebased.
https://reviews.llvm.org/D44062
Files:
ELF/SymbolTable.cpp
test/ELF/version-script.s
Index: test/ELF/version-script.s
===================================================================
--- test/ELF/version-script.s
+++ test/ELF/version-script.s
@@ -34,9 +34,9 @@
# RUN: echo "VERSION_1.0 { global: foo1; local: *; };" > %t6.script
# RUN: echo "VERSION_2.0 { global: foo1; local: *; };" >> %t6.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: not ld.lld --version-script %t6.script -shared %t.o %t2.so -o %t6.so 2>&1 | \
+# RUN: FileCheck -check-prefix=ERR3 %s
+# ERR3: duplicate symbol 'foo1' in version script
# RUN: echo "{ foo1; foo2; };" > %t.list
# RUN: ld.lld --version-script %t.script --dynamic-list %t.list %t.o %t2.so -o %t2
@@ -213,6 +213,9 @@
# ALL-NEXT: }
# ALL-NEXT: ]
+# RUN: echo "VERSION_1.0 { global: foo1; foo1; local: *; };" > %t8.script
+# RUN: ld.lld --version-script %t8.script -shared %t.o -o %t8.so --fatal-warnings
+
.globl foo1
foo1:
call bar at PLT
Index: ELF/SymbolTable.cpp
===================================================================
--- ELF/SymbolTable.cpp
+++ ELF/SymbolTable.cpp
@@ -697,8 +697,9 @@
if (Sym->getName().contains('@'))
continue;
- if (Sym->VersionId != Config->DefaultSymbolVersion)
- warn("duplicate symbol '" + Ver.Name + "' in version script");
+ if (Sym->VersionId != Config->DefaultSymbolVersion &&
+ Sym->VersionId != VersionId)
+ error("duplicate symbol '" + Ver.Name + "' in version script");
Sym->VersionId = VersionId;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44062.136891.patch
Type: text/x-patch
Size: 1610 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180303/16c2a022/attachment.bin>
More information about the llvm-commits
mailing list