[ELF2] Implement -T/--script.

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

Differential Revision:	http://reviews.llvm.org/D13626

llvm-svn: 249969
This commit is contained in:
Davide Italiano 2015-10-11 03:53:36 +00:00
parent 525914defd
commit 4e47d589e6
3 changed files with 14 additions and 0 deletions

View File

@ -178,6 +178,7 @@ void LinkerDriver::createFiles(opt::InputArgList &Args) {
addFile(searchLibrary(Arg->getValue()));
break;
case OPT_INPUT:
case OPT_script:
addFile(Arg->getValue());
break;
case OPT_Bstatic:

View File

@ -67,6 +67,8 @@ def o : Separate<["-"], "o">, MetaVarName<"<path>">,
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_o_output : Joined<["--"], "output=">, Alias<o>;
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_script_T : Separate<["-"], "T">, Alias<script>;
def alias_undefined_u : Separate<["-"], "u">, Alias<undefined>;
// Options listed below are silently ignored now.

View File

@ -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: