[lld] r267184 - ELF: Implement --export-dynamic-symbol.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 22 11:44:06 PDT 2016


Author: pcc
Date: Fri Apr 22 13:44:06 2016
New Revision: 267184

URL: http://llvm.org/viewvc/llvm-project?rev=267184&view=rev
Log:
ELF: Implement --export-dynamic-symbol.

Modified:
    lld/trunk/ELF/Driver.cpp
    lld/trunk/ELF/Options.td
    lld/trunk/test/ELF/dynamic-list.s

Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=267184&r1=267183&r2=267184&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Fri Apr 22 13:44:06 2016
@@ -373,6 +373,9 @@ void LinkerDriver::readConfigs(opt::Inpu
 
   if (Args.hasArg(OPT_dynamic_list))
     readDynamicList(getString(Args, OPT_dynamic_list));
+
+  for (auto *Arg : Args.filtered(OPT_export_dynamic_symbol))
+    Config->DynamicList.push_back(Arg->getValue());
 }
 
 void LinkerDriver::createFiles(opt::InputArgList &Args) {

Modified: lld/trunk/ELF/Options.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Options.td?rev=267184&r1=267183&r2=267184&view=diff
==============================================================================
--- lld/trunk/ELF/Options.td (original)
+++ lld/trunk/ELF/Options.td Fri Apr 22 13:44:06 2016
@@ -62,6 +62,9 @@ def entry : Separate<["--", "-"], "entry
 def export_dynamic : Flag<["--", "-"], "export-dynamic">,
   HelpText<"Put symbols in the dynamic symbol table">;
 
+def export_dynamic_symbol : Separate<["--", "-"], "export-dynamic-symbol">,
+  HelpText<"Put a symbol in the dynamic symbol table">;
+
 def fini : Separate<["-"], "fini">, MetaVarName<"<symbol>">,
   HelpText<"Specify a finalizer function">;
 

Modified: lld/trunk/test/ELF/dynamic-list.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/dynamic-list.s?rev=267184&r1=267183&r2=267184&view=diff
==============================================================================
--- lld/trunk/test/ELF/dynamic-list.s (original)
+++ lld/trunk/test/ELF/dynamic-list.s Fri Apr 22 13:44:06 2016
@@ -21,6 +21,10 @@
 # RUN: ld.lld --dynamic-list %t.list %t %t2.so -o %t.exe
 # RUN: llvm-readobj -dyn-symbols %t.exe | FileCheck %s
 
+## And now using --export-dynamic-symbol.
+# RUN: ld.lld --export-dynamic-symbol foo1 %t %t2.so -o %t.exe
+# RUN: llvm-readobj -dyn-symbols %t.exe | FileCheck %s
+
 # CHECK:      DynamicSymbols [
 # CHECK-NEXT:   Symbol {
 # CHECK-NEXT:     Name: @ (0)




More information about the llvm-commits mailing list