llvm-project

Форк
0
/
application-extension.s 
115 строк · 3.7 Кб
1
# REQUIRES: aarch64
2

3
## --no-leading-lines is needed for .tbd files.
4
# RUN: rm -rf %t; split-file --no-leading-lines %s %t
5

6
# RUN: llvm-mc -filetype=obj -triple=arm64-apple-macos -o %t/foo.o %t/foo.s
7
# RUN: llvm-mc -filetype=obj -triple=arm64-apple-macos -o %t/bar.o %t/bar.s
8

9
## MH_APP_EXTENSION_SAFE is only set on dylibs, and only if requested.
10
# RUN: %lld -arch arm64 -dylib -o %t/foo.dylib %t/foo.o
11
# RUN: llvm-otool -hv %t/foo.dylib | FileCheck --check-prefix=NOAPPEXT %s
12
# RUN: %lld -arch arm64 -dylib -o %t/foo-appext.dylib %t/foo.o \
13
# RUN:     -application_extension
14
# RUN: llvm-otool -hv %t/foo-appext.dylib | FileCheck --check-prefix=APPEXT %s
15
# RUN: %lld -arch arm64 -dylib -o %t/foo-noappext.dylib %t/foo.o \
16
# RUN:     -application_extension -no_application_extension
17
# RUN: llvm-otool -hv %t/foo-noappext.dylib \
18
# RUN:     | FileCheck --check-prefix=NOAPPEXT %s
19
# RUN: %lld -arch arm64 -bundle -o %t/foo.so %t/foo.o \
20
# RUN:     -application_extension
21
# RUN: llvm-otool -hv %t/foo.so | FileCheck --check-prefix=NOAPPEXT %s
22

23
# APPEXT: APP_EXTENSION_SAFE
24
# NOAPPEXT-NOT: APP_EXTENSION_SAFE
25

26
## The warning is emitted for all target types.
27
# RUN: %lld -arch arm64 -dylib -o %t/bar.dylib %t/bar.o \
28
# RUN:     -application_extension %t/foo-appext.dylib
29
# RUN: %lld -arch arm64 -dylib -o %t/bar.dylib %t/bar.o \
30
# RUN:     -application_extension -L %t -ltbd-appext
31
# RUN: not %lld -arch arm64 -dylib -o %t/bar.dylib %t/bar.o \
32
# RUN:     -application_extension %t/foo-noappext.dylib \
33
# RUN:     2>&1 | FileCheck --check-prefix=WARN %s
34
# RUN: not %lld -arch arm64 -dylib -o %t/bar.dylib %t/bar.o \
35
# RUN:     -application_extension -L %t -ltbd-noappext \
36
# RUN:     2>&1 | FileCheck --check-prefix=WARN %s
37
# RUN: not %lld -arch arm64 -bundle -o %t/bar.so %t/bar.o \
38
# RUN:     -application_extension %t/foo-noappext.dylib \
39
# RUN:     2>&1 | FileCheck --check-prefix=WARN %s
40
# RUN: not %lld -arch arm64 -bundle -o %t/bar.so %t/bar.o \
41
# RUN:     -application_extension -L %t -ltbd-noappext \
42
# RUN:     2>&1 | FileCheck --check-prefix=WARN %s
43

44
# WARN: using '-application_extension' with unsafe dylib:
45

46
## Test we warn on dylibs loaded indirectly via reexports.
47
# RUN: not %lld -arch arm64 -dylib -o %t/bar.dylib %t/bar.o \
48
# RUN:     -application_extension -L %t -lbaz-noappext-reexport \
49
# RUN:     -u _baz 2>&1 | FileCheck --check-prefix=WARN %s
50

51
#--- foo.s
52
.globl _foo
53
.p2align 2
54
_foo:
55
  ret
56

57
#--- libtbd-appext.tbd
58
--- !tapi-tbd
59
tbd-version: 4
60
targets: [ arm64-macos ]
61
uuids:
62
  - target: arm64-macos
63
    value:  2E994C7F-3F03-3A07-879C-55690D22BEDA
64
install-name:     '/usr/lib/libtbd-appext.dylib'
65
exports:
66
  - targets:      [ arm64-macos ]
67
    symbols:      [ _foo ]
68
...
69

70
#--- libtbd-noappext.tbd
71
--- !tapi-tbd
72
tbd-version: 4
73
targets: [ arm64-macos ]
74
flags: [ not_app_extension_safe ]
75
uuids:
76
  - target: arm64-macos
77
    value:  2E994C7F-3F03-3A07-879C-55690D22BEDA
78
install-name:     '/usr/lib/libtbd-noappext.dylib'
79
exports:
80
  - targets:      [ arm64-macos ]
81
    symbols:      [ _foo ]
82
...
83

84
#--- bar.s
85
.globl _bar
86
.p2align 2
87
_bar:
88
  ret
89

90
#--- libbaz-noappext-reexport.tbd
91
--- !tapi-tbd
92
tbd-version:      4
93
targets:          [ arm64-macos ]
94
uuids:
95
  - target:       arm64-macos
96
    value:        00000000-0000-0000-0000-000000000001
97
install-name:     '/usr/lib/libbaz.dylib'
98
reexported-libraries:
99
  - targets:      [ arm64-macos ]
100
    libraries:    [ '/usr/lib/libbaz-noappext-reexported.dylib']
101
--- !tapi-tbd
102
tbd-version:      4
103
targets:          [ arm64-macos ]
104
flags: [ not_app_extension_safe ]
105
uuids:
106
  - target:       arm64-macos
107
    value:        00000000-0000-0000-0000-000000000003
108
install-name:     '/usr/lib/libbaz-noappext-reexported.dylib'
109
parent-umbrella:
110
  - targets:      [ arm64-macos ]
111
    umbrella:     baz
112
exports:
113
  - targets:      [ arm64-macos ]
114
    symbols:      [ _baz ]
115
...
116

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

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

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

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