[PATCH] D13626: [ELF2] Implement -T/--script

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 10 20:09:52 PDT 2015


davide created this revision.
davide added reviewers: ruiu, rafael.
davide added a subscriber: llvm-commits.

This one tests more carefully SEARCH_DIR() as an added bonus.

http://reviews.llvm.org/D13626

Files:
  ELF/Driver.cpp
  ELF/Options.td
  test/elf2/linkerscript2.s

Index: test/elf2/linkerscript2.s
===================================================================
--- test/elf2/linkerscript2.s
+++ test/elf2/linkerscript2.s
@@ -0,0 +1,10 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-freebsd %s -o %t
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-freebsd \
+# RUN:   %p/Inputs/libsearch-dyn.s -o %tdyn.o
+# RUN: ld.lld2 -shared %tdyn.o -o %T/libls.so
+# RUN: echo "SEARCH_DIR(" %T ")" > %t.script
+# RUN: ld.lld2 -o %t2 --script %t.script -lls %t
+
+.globl _start,_bar
+_start:
Index: ELF/Options.td
===================================================================
--- ELF/Options.td
+++ ELF/Options.td
@@ -67,6 +67,8 @@
 def rpath : Separate<["-"], "rpath">,
   HelpText<"Add a DT_RUNPATH to the output">;
 
+def script : Separate<["--"], "script">, HelpText<"Read linker script">;
+
 def shared : Flag<["-"], "shared">,
   HelpText<"Build a shared object">;
 
@@ -104,6 +106,7 @@
 def alias_rpath_rpath : Joined<["-"], "rpath=">, Alias<rpath>;
 def alias_soname_h : Separate<["-"], "h">, Alias<soname>;
 def alias_soname_soname : Separate<["-"], "soname">, Alias<soname>;
+def alias_T : Separate<["-"], "T">, Alias<script>;
 def alias_undefined_u : Separate<["-"], "u">, Alias<undefined>;
 
 // Options listed below are silently ignored now.
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -232,6 +232,7 @@
       addFile(searchLibrary(Arg->getValue()));
       break;
     case OPT_INPUT:
+    case OPT_script:
       addFile(Arg->getValue());
       break;
     case OPT_Bstatic:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13626.37041.patch
Type: text/x-patch
Size: 1641 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151011/e5d8bead/attachment.bin>


More information about the llvm-commits mailing list