116 lines · plain
1# REQUIRES: aarch642 3## --no-leading-lines is needed for .tbd files.4# RUN: rm -rf %t; split-file --no-leading-lines %s %t5 6# RUN: llvm-mc -filetype=obj -triple=arm64-apple-macos -o %t/foo.o %t/foo.s7# RUN: llvm-mc -filetype=obj -triple=arm64-apple-macos -o %t/bar.o %t/bar.s8 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.o11# RUN: llvm-otool -hv %t/foo.dylib | FileCheck --check-prefix=NOAPPEXT %s12# RUN: %lld -arch arm64 -dylib -o %t/foo-appext.dylib %t/foo.o \13# RUN: -application_extension14# RUN: llvm-otool -hv %t/foo-appext.dylib | FileCheck --check-prefix=APPEXT %s15# RUN: %lld -arch arm64 -dylib -o %t/foo-noappext.dylib %t/foo.o \16# RUN: -application_extension -no_application_extension17# RUN: llvm-otool -hv %t/foo-noappext.dylib \18# RUN: | FileCheck --check-prefix=NOAPPEXT %s19# RUN: %lld -arch arm64 -bundle -o %t/foo.so %t/foo.o \20# RUN: -application_extension21# RUN: llvm-otool -hv %t/foo.so | FileCheck --check-prefix=NOAPPEXT %s22 23# APPEXT: APP_EXTENSION_SAFE24# NOAPPEXT-NOT: APP_EXTENSION_SAFE25 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.dylib29# RUN: %lld -arch arm64 -dylib -o %t/bar.dylib %t/bar.o \30# RUN: -application_extension -L %t -ltbd-appext31# 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 %s34# 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 %s37# 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 %s40# 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 %s43 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 %s50 51#--- foo.s52.globl _foo53.p2align 254_foo:55 ret56 57#--- libtbd-appext.tbd58--- !tapi-tbd59tbd-version: 460targets: [ arm64-macos ]61uuids:62 - target: arm64-macos63 value: 2E994C7F-3F03-3A07-879C-55690D22BEDA64install-name: '/usr/lib/libtbd-appext.dylib'65exports:66 - targets: [ arm64-macos ]67 symbols: [ _foo ]68...69 70#--- libtbd-noappext.tbd71--- !tapi-tbd72tbd-version: 473targets: [ arm64-macos ]74flags: [ not_app_extension_safe ]75uuids:76 - target: arm64-macos77 value: 2E994C7F-3F03-3A07-879C-55690D22BEDA78install-name: '/usr/lib/libtbd-noappext.dylib'79exports:80 - targets: [ arm64-macos ]81 symbols: [ _foo ]82...83 84#--- bar.s85.globl _bar86.p2align 287_bar:88 ret89 90#--- libbaz-noappext-reexport.tbd91--- !tapi-tbd92tbd-version: 493targets: [ arm64-macos ]94uuids:95 - target: arm64-macos96 value: 00000000-0000-0000-0000-00000000000197install-name: '/usr/lib/libbaz.dylib'98reexported-libraries:99 - targets: [ arm64-macos ]100 libraries: [ '/usr/lib/libbaz-noappext-reexported.dylib']101--- !tapi-tbd102tbd-version: 4103targets: [ arm64-macos ]104flags: [ not_app_extension_safe ]105uuids:106 - target: arm64-macos107 value: 00000000-0000-0000-0000-000000000003108install-name: '/usr/lib/libbaz-noappext-reexported.dylib'109parent-umbrella:110 - targets: [ arm64-macos ]111 umbrella: baz112exports:113 - targets: [ arm64-macos ]114 symbols: [ _baz ]115...116