1# REQUIRES: x86 2 3# RUN: rm -rf %t; split-file %s %t 4# RUN: mkdir %t/subdir 5 6# RUN: llvm-mc -filetype obj -triple x86_64-apple-darwin %t/foo.s -o %t/foo.o 7# RUN: llvm-mc -filetype obj -triple x86_64-apple-darwin %t/bar.s -o %t/bar.o 8# RUN: llvm-mc -filetype obj -triple x86_64-apple-darwin %t/main.s -o %t/main.o 9 10# RUN: %lld -dylib -install_name @executable_path/libfoo.dylib %t/foo.o -o %t/subdir/libfoo.dylib 11 12# RUN: %lld -dylib -reexport_library %t/subdir/libfoo.dylib %t/bar.o -o %t/libbar.dylib 13 14## When linking executables, @executable_path/ in install_name should be replaced 15## by the path of the executable. 16# RUN: %lld -lSystem %t/main.o %t/libbar.dylib -o %t/subdir/test 17 18## This doesn't work for non-executables. 19# RUN: not %lld -dylib -lSystem %t/main.o %t/libbar.dylib -o %t/subdir/libtest.dylib 2>&1 | FileCheck --check-prefix=ERR %s 20 21## It also doesn't help if the needed reexport isn't next to the library. 22# RUN: not %lld -lSystem %t/main.o %t/libbar.dylib -o %t/test 2>&1 | FileCheck --check-prefix=ERR %s 23# ERR: error: {{.*}}libbar.dylib: unable to locate re-export with install name @executable_path/libfoo.dylib 24 25#--- foo.s 26.globl _foo 27_foo: 28 retq 29 30#--- bar.s 31.globl _bar 32_bar: 33 retq 34 35#--- main.s 36.section __TEXT,__text 37.global _main 38_main: 39 callq _foo 40 callq _bar 41 ret 42