Index: ELF/Options.td =================================================================== --- ELF/Options.td +++ ELF/Options.td @@ -187,6 +187,7 @@ def no_fatal_warnings : Flag<["--"], "no-fatal-warnings">; def no_warn_common : Flag<["--", "-"], "no-warn-common">; def no_warn_mismatch : Flag<["--"], "no-warn-mismatch">; +def rpath_link : Separate<["-"], "rpath-link">; def version_script : Separate<["--"], "version-script">; def warn_shared_textrel : Flag<["--"], "warn-shared-textrel">; def G : Separate<["-"], "G">; Index: test/ELF/Inputs/rpath-link.s =================================================================== --- test/ELF/Inputs/rpath-link.s +++ test/ELF/Inputs/rpath-link.s @@ -0,0 +1,5 @@ +.text +.globl _Z1Av +.type _Z1Av,@function +_Z1Av: + callq _Z1Bv@PLT Index: test/ELF/Inputs/rpath-link2.s =================================================================== --- test/ELF/Inputs/rpath-link2.s +++ test/ELF/Inputs/rpath-link2.s @@ -0,0 +1,5 @@ +.text +.globl _Z1Bv +.type _Z1Bv,@function +_Z1Bv: + retq Index: test/ELF/rpath-link.s =================================================================== --- test/ELF/rpath-link.s +++ test/ELF/rpath-link.s @@ -0,0 +1,18 @@ +# REQUIRES: x86 + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/rpath-link.s -o %tlink1.o +# RUN: ld.lld -shared %tlink1.o -o %tlink1.so + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/rpath-link2.s -o %tlink2.o +# RUN: ld.lld -shared %tlink2.o %tlink1.so -o %tlink2.so + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +# RUN: ld.lld %t %tlink1.so -o %t.out + +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t +# RUN: ld.lld %t %tlink1.so -o %t.out -rpath-link write_whatever_you_want_here + +.text +.globl _start +_start: + callq _Z1Av