llvm-project

Форк
0
/
special-symbol-ld-previous.s 
121 строка · 5.7 Кб
1
# REQUIRES: x86
2

3
# RUN: rm -rf %t; split-file --no-leading-lines %s %t
4

5
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/ref_xxx.s -o %t/ref_xxx.o
6
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/ref_ySyy.s -o %t/ref_ySyy.o
7
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/ref_zzz.s -o %t/ref_zzz.o
8

9
## Case 1: special symbol $ld$previous affects the install name / compatibility version
10
## since the specified version 11.0.0 is within the affected range [3.0, 14.0).
11

12
# RUN: %lld -o %t/libfoo1.dylib %t/libLDPreviousInstallName.tbd %t/ref_xxx.o -dylib -platform_version macos 11.0.0 11.0.0
13
# RUN: llvm-objdump --macho --dylibs-used %t/libfoo1.dylib | FileCheck --check-prefix=CASE1 %s
14
# CASE1: /Old (compatibility version 1.2.3, current version 5.0.0)
15

16
## Case 2: special symbol $ld$previous does not affect the install name / compatibility version
17
## since the specified version 2.0.0 is lower than the affected range [3.0, 14.0).
18

19
# RUN: %lld -o %t/libfoo2.dylib %t/libLDPreviousInstallName.tbd %t/ref_xxx.o -dylib -platform_version macos 2.0.0 2.0.0
20
# RUN: llvm-objdump --macho --dylibs-used %t/libfoo2.dylib | FileCheck --check-prefix=CASE2 %s
21
# CASE2: /New (compatibility version 1.1.1, current version 5.0.0)
22

23
## Case 3: special symbol $ld$previous does not affect the install name / compatibility version
24
## since the specified version 14.0.0 is higher than the affected range [3.0, 14.0).
25

26
# RUN: %lld -o %t/libfoo3.dylib %t/libLDPreviousInstallName.tbd %t/ref_xxx.o -dylib -platform_version macos 2.0.0 2.0.0
27
# RUN: llvm-objdump --macho --dylibs-used %t/libfoo3.dylib | FileCheck --check-prefix=CASE3 %s
28
# CASE3: /New (compatibility version 1.1.1, current version 5.0.0)
29

30
## The remaining cases test handling when a symbol name is part of $ld$previous.
31

32
## Case 4: special symbol $ld$previous affects the install name / compatibility version if and only if:
33
##   * the specified version 11.0.0 is within the affected range [3.0, 14.0), and
34
##   * the symbol name after $previous$ points to a referenced symbol
35
# RUN: %lld -o %t/libfoo4_yes.dylib %t/libLDPreviousInstallName-Symbol.tbd %t/ref_ySyy.o -dylib -platform_version macos 11.0.0 11.0.0
36
# RUN: llvm-otool -L %t/libfoo4_yes.dylib | FileCheck --check-prefix=CASE4-YES --implicit-check-not=/New %s
37
# CASE4-YES: /Old (compatibility version 1.2.3, current version 1.2.3)
38

39
## $previous has no effect because deployment target is too new.
40
# RUN: %lld -o %t/libfoo4_no.dylib %t/libLDPreviousInstallName-Symbol.tbd %t/ref_ySyy.o -dylib -platform_version macos 14.0.0 14.0.0
41
# RUN: llvm-otool -L %t/libfoo4_no.dylib | FileCheck --check-prefix=CASE4-NO --implicit-check-not=/Old %s
42
# CASE4-NO: /New (compatibility version 1.1.1, current version 5.0.0)
43

44
## $previous has no effect because named symbol isn't referenced.
45
# RUN: %lld -o %t/libfoo4_no.dylib %t/libLDPreviousInstallName-Symbol.tbd %t/ref_zzz.o -dylib -platform_version macos 11.0.0 11.0.0
46
# RUN: llvm-otool -L %t/libfoo4_no.dylib | FileCheck --check-prefix=CASE4-NO %s
47

48
## Case 5: Reference two symbols that add different $previous names each,
49
## and one that references the "normal" dylib.
50
## This should produce three different load commands.
51
# RUN: %lld -o %t/libfoo5.dylib %t/libLDPreviousInstallName-Symbol.tbd %t/ref_xxx.o %t/ref_ySyy.o %t/ref_zzz.o -dylib -platform_version macos 11.0.0 11.0.0
52
# RUN: llvm-otool -L %t/libfoo5.dylib | FileCheck --check-prefix=CASE5 %s
53
# CASE5: /New (compatibility version 1.1.1, current version 5.0.0)
54
# CASE5-DAG: /Another (compatibility version 1.1.1, current version 5.0.0)
55
# CASE5-DAG: /Old (compatibility version 1.2.3, current version 1.2.3)
56

57
## Check that we emit a warning for an invalid start, end and compatibility versions.
58

59
# RUN: %no-fatal-warnings-lld -o %t/libfoo1.dylib %t/libLDPreviousInvalid.tbd %t/ref_xxx.o -dylib \
60
# RUN:  -platform_version macos 11.0.0 11.0.0 2>&1 | FileCheck --check-prefix=INVALID-VERSION %s
61

62
# INVALID-VERSION-DAG: libLDPreviousInvalid.tbd(/Old): failed to parse start version, symbol '$ld$previous$/New$1.2.3$1$3.a$14.0$$' ignored
63
# INVALID-VERSION-DAG: libLDPreviousInvalid.tbd(/Old): failed to parse end version, symbol '$ld$previous$/New$1.2.3$1$3.0$14.b$$' ignored
64
# INVALID-VERSION-DAG: libLDPreviousInvalid.tbd(/Old): failed to parse compatibility version, symbol '$ld$previous$/New$1.2.c$1$3.0$14.0$$' ignored
65

66
#--- ref_xxx.s
67
.long	_xxx@GOTPCREL
68

69
#--- ref_ySyy.s
70
.long	_y$yy@GOTPCREL
71

72
#--- ref_zzz.s
73
.long	_zzz@GOTPCREL
74

75
#--- libLDPreviousInstallName.tbd
76
--- !tapi-tbd-v3
77
archs:           [ x86_64 ]
78
uuids:           [ 'x86_64: 19311019-01AB-342E-812B-73A74271A715' ]
79
platform:        macosx
80
install-name:    '/New'
81
current-version: 5
82
compatibility-version: 1.1.1
83
exports:
84
  - archs:           [ x86_64 ]
85
    symbols:         [ '$ld$previous$/Old$1.2.3$1$3.0$14.0$$', _xxx ]
86
...
87

88
#--- libLDPreviousInstallName-Symbol.tbd
89
--- !tapi-tbd-v3
90
archs:           [ x86_64 ]
91
uuids:           [ 'x86_64: 19311019-01AB-342E-812B-73A74271A715' ]
92
platform:        macosx
93
install-name:    '/New'
94
current-version: 5
95
compatibility-version: 1.1.1
96
exports:
97
  - archs:           [ x86_64 ]
98
    symbols:         [
99
      '$ld$previous$/Another$$1$3.0$14.0$_xxx$',
100
      '$ld$previous$/Old$1.2.3$1$3.0$14.0$_y$yy$',
101
      _xxx,
102
      '_y$yy',
103
      _zzz,
104
    ]
105
...
106

107
#--- libLDPreviousInvalid.tbd
108
--- !tapi-tbd-v3
109
archs:           [ x86_64 ]
110
uuids:           [ 'x86_64: 19311019-01AB-342E-112B-73A74271A715' ]
111
platform:        macosx
112
install-name:    '/Old'
113
current-version: 5
114
compatibility-version: 1.1.1
115
exports:
116
  - archs:           [ x86_64 ]
117
    symbols:         [ '$ld$previous$/New$1.2.3$1$3.a$14.0$$',
118
                       '$ld$previous$/New$1.2.3$1$3.0$14.b$$',
119
                       '$ld$previous$/New$1.2.c$1$3.0$14.0$$',
120
                       _xxx ]
121
...
122

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.