[PATCH] D43307: Fix an issue that lld drops symbol versions for -r.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 14 11:25:32 PST 2018
ruiu created this revision.
ruiu added reviewers: rafael, timshen.
Herald added subscribers: arichardson, emaste.
When we are emitting a relocatable output, we should keep the original
symbol name including "@" part. Previously, we drop that part unconditionally
which resulted in dropping versions from symbols.
https://reviews.llvm.org/D43307
Files:
lld/ELF/Driver.cpp
lld/test/ELF/relocatable-versioned.s
Index: lld/test/ELF/relocatable-versioned.s
===================================================================
--- /dev/null
+++ lld/test/ELF/relocatable-versioned.s
@@ -0,0 +1,10 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o
+# RUN: ld.lld -o %t2.o -r %t1.o
+# RUN: llvm-nm %t2.o | FileCheck %s
+# CHECK: foo at VERSION
+
+.global "foo at VERSION"
+.text
+"foo at VERSION":
+ ret
Index: lld/ELF/Driver.cpp
===================================================================
--- lld/ELF/Driver.cpp
+++ lld/ELF/Driver.cpp
@@ -1104,7 +1104,12 @@
Script->declareSymbols();
// Apply version scripts.
- Symtab->scanVersionScript();
+ //
+ // For a relocatable output, version scripts don't make sense, and
+ // parsing a symbol version string (e.g. dropping "@ver1" from a symbol
+ // name "foo at ver1") rather do harm, so we don't call this if -r is given.
+ if (!Config->Relocatable)
+ Symtab->scanVersionScript();
// Create wrapped symbols for -wrap option.
for (auto *Arg : Args.filtered(OPT_wrap))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43307.134274.patch
Type: text/x-patch
Size: 1059 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180214/dcd743c5/attachment.bin>
More information about the llvm-commits
mailing list