[PATCH] D40878: Handle multiple "--version-script" options.

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 6 19:26:20 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD320006: [ELF] Handle multiple "--version-script" options. (authored by ikudrin).

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D40878

Files:
  ELF/Driver.cpp
  test/ELF/version-script.s


Index: test/ELF/version-script.s
===================================================================
--- test/ELF/version-script.s
+++ test/ELF/version-script.s
@@ -42,6 +42,12 @@
 # RUN: ld.lld --version-script %t.script --dynamic-list %t.list %t.o %t2.so -o %t2
 # RUN: llvm-readobj %t2 > /dev/null
 
+## Check that we can handle multiple "--version-script" options.
+# RUN: echo "VERSION_1.0 { global : foo1; local : *; };" > %t7a.script
+# RUN: echo "VERSION_2.0 { global: foo3; local: *; };" > %t7b.script
+# RUN: ld.lld --version-script %t7a.script --version-script %t7b.script -shared %t.o %t2.so -o %t7.so
+# RUN: llvm-readobj -dyn-symbols %t7.so | FileCheck --check-prefix=VERDSO %s
+
 # DSO:      DynamicSymbols [
 # DSO-NEXT:   Symbol {
 # DSO-NEXT:     Name: @
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -774,7 +774,7 @@
           {Arg->getValue(), /*IsExternCpp*/ false, /*HasWildcard*/ false});
   }
 
-  if (auto *Arg = Args.getLastArg(OPT_version_script))
+  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: D40878.125877.patch
Type: text/x-patch
Size: 1225 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171207/d3d17279/attachment.bin>


More information about the llvm-commits mailing list