Skip to content

Commit 0c57f89

Browse files
authored
[lld-macho]Added missing commit from PR/135241 (#137672)
1 parent c5f6190 commit 0c57f89

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

lld/test/MachO/reexport-with-rpath.s

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
# REQUIRES: x86
2+
## This tests that lld handles (re)exported libraries with rpath properly .
3+
## The tests are as follows:
4+
## - libAee re-exports libBee while defining the install-path with @rpath variable
5+
## - libBee re-exports libCee while defining the install-path with @rpath variable
6+
## - libCee contains _c_func symbol.
7+
##
8+
## We check that when linking a main which references _c_func, lld can find the symbol.
9+
210
# RUN: rm -rf %t; split-file %s %t
311
# RUN: mkdir -p %t/cc/two/three
412
# RUN: mkdir -p %t/bb/two/three
@@ -7,10 +15,12 @@
715
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/c.s -o %t/c.o
816
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/b.s -o %t/b.o
917
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/a.s -o %t/a.o
18+
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/main.s -o %t/main.o
1019

1120
# RUN: %lld -dylib -install_name @rpath/two/three/libCee.dylib %t/c.o -o %t/cc/two/three/libCee.dylib
1221
# RUN: %lld -dylib -install_name @rpath/two/three/libBee.dylib -L%t/cc/two/three -sub_library libCee -lCee %t/b.o -o %t/bb/two/three/libBee.dylib -rpath %t/cc
13-
# RUN: %lld -dylib -install_name @rpath/two/three/libAee.dylib -L%t/bb/two/three -sub_library libBee -lBee %t/a.o -o %t/aa/two/three/libAee.dylib
22+
# RUN: %lld -dylib -install_name @rpath/two/three/libAee.dylib -L%t/bb/two/three -sub_library libBee -lBee %t/a.o -o %t/aa/two/three/libAee.dylib -rpath %t/aa
23+
# RUN: %lld %t/main.o -L%t/aa/two/three -lAee -o a.out -rpath %t/aa -rpath %t/bb -rpath %t/cc
1424

1525
#--- c.s
1626
.text
@@ -33,3 +43,11 @@ _b_func:
3343
_a_func:
3444
mov $0, %rax
3545
ret
46+
47+
#--- main.s
48+
.globl _main
49+
_main:
50+
callq _c_func
51+
callq _b_func
52+
callq _a_func
53+
ret

0 commit comments

Comments
 (0)