diff options
| author | Peter Collingbourne <peter@pcc.me.uk> | 2017-02-13 18:31:12 +0000 |
|---|---|---|
| committer | Peter Collingbourne <peter@pcc.me.uk> | 2017-02-13 18:31:12 +0000 |
| commit | 904c5ed558b8e2eafde445730532bfcae18d613d (patch) | |
| tree | 85a6390e9b549383f0f295da32831dc402b04ce1 | |
| parent | 06a2128cfa56e0d4954d231b86f44fe04ae8db95 (diff) | |
| download | bcm5719-llvm-904c5ed558b8e2eafde445730532bfcae18d613d.tar.gz bcm5719-llvm-904c5ed558b8e2eafde445730532bfcae18d613d.zip | |
ELF: Read all dynamic lists specified on the command line.
We were previously only reading the last one.
Fixes PR31939 (which was likely the issue underlying
https://github.com/google/oss-fuzz/issues/295).
Differential Revision: https://reviews.llvm.org/D29861
llvm-svn: 294977
| -rw-r--r-- | lld/ELF/Driver.cpp | 2 | ||||
| -rw-r--r-- | lld/ELF/LinkerScript.cpp | 3 | ||||
| -rw-r--r-- | lld/test/ELF/dynamic-list.s | 4 |
3 files changed, 7 insertions, 2 deletions
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index c1e342c0fc0..176bbe63ccc 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -643,7 +643,7 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) { 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); diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 15acaf01984..a0b8530fe4c 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -1942,7 +1942,8 @@ void ScriptParser::readAnonymousDeclaration() { if (peek() != "local") { if (consume("global")) expect(":"); - Config->VersionScriptGlobals = readSymbols(); + for (SymbolVersion V : readSymbols()) + Config->VersionScriptGlobals.push_back(V); } readLocals(); expect("}"); diff --git a/lld/test/ELF/dynamic-list.s b/lld/test/ELF/dynamic-list.s index e2472e716b3..80e480b9e3d 100644 --- a/lld/test/ELF/dynamic-list.s +++ b/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 { |

