File: link-search-at-loader-path-symlink.s

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (57 lines) | stat: -rw-r--r-- 1,989 bytes parent folder | download | duplicates (21)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# REQUIRES: x86, shell

# RUN: rm -rf %t; split-file %s %t

# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/foo.s -o %t/foo.o
# RUN: llvm-mc -filetype obj -triple x86_64-apple-darwin %t/bar.s -o %t/bar.o
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/test.s -o %t/test.o

## 1. Test symlink with reexport to @rpath and rpath pointing to @loader_path.
## The @loader_path-relative path is looked after resolving the symlink.

# RUN: mkdir -p %t/Foo1.framework/Versions/A
# RUN: %lld -dylib -install_name @rpath/libbar1.dylib %t/bar.o -o %t/Foo1.framework/Versions/A/libbar1.dylib

# RUN: %lld -dylib -install_name %t/Foo1.framework/Versions/A/Foo1 %t/foo.o \
# RUN:     -reexport_library %t/Foo1.framework/Versions/A/libbar1.dylib \
# RUN:     -rpath @loader_path/. \
# RUN:     -o %t/Foo1.framework/Versions/A/Foo1
# RUN: ln -sf A %t/Foo1.framework/Versions/Current
# RUN: ln -sf Versions/Current/Foo1 %t/Foo1.framework/Foo1

# RUN: %lld -lSystem -F%t -framework Foo1 %t/test.o -o %t/test1

## 2. Test symlink with reexport to @loader_path-relative path directly.
## The @loader_path-relative path is looked after resolving the symlink.
## ld64 gets this wrong -- it calls realpath() but ignores the result.
## (ld64-609, Options.cpp, Options::findFile(), "@loader_path/" handling.)

# RUN: mkdir -p %t/Foo2.framework/Versions/A
# RUN: %lld -dylib -install_name @loader_path/libbar2.dylib %t/bar.o -o %t/Foo2.framework/Versions/A/libbar2.dylib

# RUN: %lld -dylib -install_name %t/Foo2.framework/Versions/A/Foo2 %t/foo.o \
# RUN:     -reexport_library %t/Foo2.framework/Versions/A/libbar2.dylib \
# RUN:     -o %t/Foo2.framework/Versions/A/Foo2
# RUN: ln -sf A %t/Foo2.framework/Versions/Current
# RUN: ln -sf Versions/Current/Foo2 %t/Foo2.framework/Foo2

# RUN: %lld -lSystem -F%t -framework Foo2 %t/test.o -o %t/test2

#--- foo.s
.globl _foo
_foo:
  ret

#--- bar.s
.globl _bar
_bar:
  ret

#--- test.s
.globl _main
.text
_main:
  callq _foo
  callq _bar
  ret