[PATCH] D29861: ELF: Read all dynamic lists specified on the command line.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 10 19:42:57 PST 2017
pcc created this revision.
We were previously only reading the last one.
Fixes PR31939 (which was likely the issue underlying
https://github.com/google/oss-fuzz/issues/295).
https://reviews.llvm.org/D29861
Files:
lld/ELF/Driver.cpp
lld/ELF/LinkerScript.cpp
lld/test/ELF/dynamic-list.s
Index: lld/test/ELF/dynamic-list.s
===================================================================
--- lld/test/ELF/dynamic-list.s
+++ lld/test/ELF/dynamic-list.s
@@ -51,6 +51,10 @@
# RUN: echo "{ foo1; foo2; foo31; };" > %t.list
# RUN: ld.lld --dynamic-list %t.list %t %t2.so -o %t.exe
# RUN: llvm-readobj -dyn-symbols %t.exe | FileCheck -check-prefix=CHECK2 %s
+# RUN: echo "{ foo1; foo2; };" > %t1.list
+# RUN: echo "{ foo31; };" > %t2.list
+# RUN: ld.lld --dynamic-list %t1.list --dynamic-list %t2.list %t %t2.so -o %t.exe
+# RUN: llvm-readobj -dyn-symbols %t.exe | FileCheck -check-prefix=CHECK2 %s
# CHECK2: DynamicSymbols [
# CHECK2-NEXT: Symbol {
Index: lld/ELF/LinkerScript.cpp
===================================================================
--- lld/ELF/LinkerScript.cpp
+++ lld/ELF/LinkerScript.cpp
@@ -1942,7 +1942,9 @@
if (peek() != "local") {
if (consume("global"))
expect(":");
- Config->VersionScriptGlobals = readSymbols();
+ std::vector<SymbolVersion> Globals = readSymbols();
+ for (SymbolVersion V : Globals)
+ Config->VersionScriptGlobals.push_back(V);
}
readLocals();
expect("}");
Index: lld/ELF/Driver.cpp
===================================================================
--- lld/ELF/Driver.cpp
+++ lld/ELF/Driver.cpp
@@ -641,7 +641,7 @@
for (auto *Arg : Args.filtered(OPT_undefined))
Config->Undefined.push_back(Arg->getValue());
- if (auto *Arg = Args.getLastArg(OPT_dynamic_list))
+ for (auto *Arg : Args.filtered(OPT_dynamic_list))
if (Optional<MemoryBufferRef> Buffer = readFile(Arg->getValue()))
readDynamicList(*Buffer);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29861.88082.patch
Type: text/x-patch
Size: 1638 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170211/593ab1bf/attachment.bin>
More information about the llvm-commits
mailing list