[PATCH] D43266: Make --export-dynamic-symbol to add undefined symbols even if --export-dynamic is given.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 14 10:40:30 PST 2018
This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL325152: Make --export-dynamic-symbol to add undefined symbols even if --export-dynamic… (authored by ruiu, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D43266?vs=134138&id=134265#toc
Repository:
rL LLVM
https://reviews.llvm.org/D43266
Files:
lld/trunk/ELF/Driver.cpp
lld/trunk/test/ELF/export-dynamic-symbol.s
Index: lld/trunk/test/ELF/export-dynamic-symbol.s
===================================================================
--- lld/trunk/test/ELF/export-dynamic-symbol.s
+++ lld/trunk/test/ELF/export-dynamic-symbol.s
@@ -3,11 +3,14 @@
# RUN: rm -f %t.a
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/archive2.s -o %t1.o
# RUN: llvm-ar rcs %t.a %t1.o
-
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t2.o
+
# RUN: ld.lld -shared -o %t.so --export-dynamic-symbol foo %t.a %t2.o
+# RUN: llvm-readelf -dyn-symbols %t.so | FileCheck %s
+# RUN: ld.lld -shared -o %t.so --export-dynamic --export-dynamic-symbol foo %t.a %t2.o
# RUN: llvm-readelf -dyn-symbols %t.so | FileCheck %s
+
# CHECK: foo
.global _start
Index: lld/trunk/ELF/Driver.cpp
===================================================================
--- lld/trunk/ELF/Driver.cpp
+++ lld/trunk/ELF/Driver.cpp
@@ -803,13 +803,18 @@
if (Optional<MemoryBufferRef> Buffer = readFile(Arg->getValue()))
readDynamicList(*Buffer);
- for (auto *Arg : Args.filtered(OPT_export_dynamic_symbol)) {
+ for (auto *Arg : Args.filtered(OPT_export_dynamic_symbol))
Config->DynamicList.push_back(
{Arg->getValue(), /*IsExternCpp*/ false, /*HasWildcard*/ false});
- Config->Undefined.push_back(Arg->getValue());
- }
}
+ // If --export-dynamic-symbol=foo is given and symbol foo is defined in
+ // an object file in an archive file, that object file should be pulled
+ // out and linked. (It doesn't have to behave like that from technical
+ // point of view, but this is needed for compatibility with GNU.)
+ for (auto *Arg : Args.filtered(OPT_export_dynamic_symbol))
+ Config->Undefined.push_back(Arg->getValue());
+
for (auto *Arg : Args.filtered(OPT_version_script))
if (Optional<MemoryBufferRef> Buffer = readFile(Arg->getValue()))
readVersionScript(*Buffer);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43266.134265.patch
Type: text/x-patch
Size: 1915 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180214/0588bf46/attachment.bin>
More information about the llvm-commits
mailing list