42 lines · plain
1# REQUIRES: x862 3# RUN: rm -rf %t; split-file %s %t4# RUN: mkdir %t/subdir5 6# RUN: llvm-mc -filetype obj -triple x86_64-apple-darwin %t/foo.s -o %t/foo.o7# RUN: llvm-mc -filetype obj -triple x86_64-apple-darwin %t/bar.s -o %t/bar.o8# RUN: llvm-mc -filetype obj -triple x86_64-apple-darwin %t/main.s -o %t/main.o9 10# RUN: %lld -dylib -install_name @executable_path/libfoo.dylib %t/foo.o -o %t/subdir/libfoo.dylib11 12# RUN: %lld -dylib -reexport_library %t/subdir/libfoo.dylib %t/bar.o -o %t/libbar.dylib13 14## When linking executables, @executable_path/ in install_name should be replaced15## by the path of the executable.16# RUN: %lld -lSystem %t/main.o %t/libbar.dylib -o %t/subdir/test17 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 %s20 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 %s23# ERR: error: {{.*}}libbar.dylib: unable to locate re-export with install name @executable_path/libfoo.dylib24 25#--- foo.s26.globl _foo27_foo:28 retq29 30#--- bar.s31.globl _bar32_bar:33 retq34 35#--- main.s36.section __TEXT,__text37.global _main38_main:39 callq _foo40 callq _bar41 ret42