llvm-project
56 строк · 1.9 Кб
1# REQUIRES: x86, shell
2
3# RUN: rm -rf %t; split-file %s %t
4
5# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/foo.s -o %t/foo.o
6# RUN: llvm-mc -filetype obj -triple x86_64-apple-darwin %t/bar.s -o %t/bar.o
7# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/test.s -o %t/test.o
8
9## 1. Test symlink with reexport to @rpath and rpath pointing to @loader_path.
10## The @loader_path-relative path is looked after resolving the symlink.
11
12# RUN: mkdir -p %t/Foo1.framework/Versions/A
13# RUN: %lld -dylib -install_name @rpath/libbar1.dylib %t/bar.o -o %t/Foo1.framework/Versions/A/libbar1.dylib
14
15# RUN: %lld -dylib -install_name %t/Foo1.framework/Versions/A/Foo1 %t/foo.o \
16# RUN: -reexport_library %t/Foo1.framework/Versions/A/libbar1.dylib \
17# RUN: -rpath @loader_path/. \
18# RUN: -o %t/Foo1.framework/Versions/A/Foo1
19# RUN: ln -sf A %t/Foo1.framework/Versions/Current
20# RUN: ln -sf Versions/Current/Foo1 %t/Foo1.framework/Foo1
21
22# RUN: %lld -lSystem -F%t -framework Foo1 %t/test.o -o %t/test1
23
24## 2. Test symlink with reexport to @loader_path-relative path directly.
25## The @loader_path-relative path is looked after resolving the symlink.
26## ld64 gets this wrong -- it calls realpath() but ignores the result.
27## (ld64-609, Options.cpp, Options::findFile(), "@loader_path/" handling.)
28
29# RUN: mkdir -p %t/Foo2.framework/Versions/A
30# RUN: %lld -dylib -install_name @loader_path/libbar2.dylib %t/bar.o -o %t/Foo2.framework/Versions/A/libbar2.dylib
31
32# RUN: %lld -dylib -install_name %t/Foo2.framework/Versions/A/Foo2 %t/foo.o \
33# RUN: -reexport_library %t/Foo2.framework/Versions/A/libbar2.dylib \
34# RUN: -o %t/Foo2.framework/Versions/A/Foo2
35# RUN: ln -sf A %t/Foo2.framework/Versions/Current
36# RUN: ln -sf Versions/Current/Foo2 %t/Foo2.framework/Foo2
37
38# RUN: %lld -lSystem -F%t -framework Foo2 %t/test.o -o %t/test2
39
40#--- foo.s
41.globl _foo
42_foo:
43ret
44
45#--- bar.s
46.globl _bar
47_bar:
48ret
49
50#--- test.s
51.globl _main
52.text
53_main:
54callq _foo
55callq _bar
56ret
57
58