[PATCH] D43103: Make --export-dynamic-symbol to pull out object files from archives.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 9 09:41:00 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD324752: Make --export-dynamic-symbol to pull out object files from archives. (authored by ruiu, committed by ).
Herald added a subscriber: arichardson.
Changed prior to commit:
https://reviews.llvm.org/D43103?vs=133543&id=133638#toc
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D43103
Files:
ELF/Driver.cpp
test/ELF/dynamic-list-archive.s
test/ELF/export-dynamic-symbol.s
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -790,9 +790,11 @@
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());
+ }
}
for (auto *Arg : Args.filtered(OPT_version_script))
Index: test/ELF/export-dynamic-symbol.s
===================================================================
--- test/ELF/export-dynamic-symbol.s
+++ test/ELF/export-dynamic-symbol.s
@@ -0,0 +1,15 @@
+# REQUIRES: x86
+
+# 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
+# CHECK: foo
+
+.global _start
+_start:
+ nop
Index: test/ELF/dynamic-list-archive.s
===================================================================
--- test/ELF/dynamic-list-archive.s
+++ test/ELF/dynamic-list-archive.s
@@ -0,0 +1,17 @@
+# REQUIRES: x86
+
+# 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: echo "{ foo; };" > %t.list
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t2.o
+# RUN: ld.lld -shared -o %t.so --dynamic-list %t.list %t.a %t2.o
+
+# RUN: llvm-readelf -dyn-symbols %t.so | FileCheck %s
+# CHECK-NOT: foo
+
+.global _start
+_start:
+ nop
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43103.133638.patch
Type: text/x-patch
Size: 1861 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180209/d3e53232/attachment.bin>
More information about the llvm-commits
mailing list