[PATCH] D29861: ELF: Read all dynamic lists specified on the command line.
Rafael Avila de Espindola via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 13 06:28:57 PST 2017
LGTM with the nit Rui noticed.
Thanks!
Peter Collingbourne via Phabricator <reviews at reviews.llvm.org> writes:
> 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);
>
>
>
> 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);
>
More information about the llvm-commits
mailing list