[lld] 38a6374 - [lld-macho] Only codesign by default on arm64 macOS
Jez Ng via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 12 14:26:45 PST 2021
Author: Jez Ng
Date: 2021-03-12T17:26:27-05:00
New Revision: 38a6374564a5fbdca0643fce8ee224c689188640
URL: https://github.com/llvm/llvm-project/commit/38a6374564a5fbdca0643fce8ee224c689188640
DIFF: https://github.com/llvm/llvm-project/commit/38a6374564a5fbdca0643fce8ee224c689188640.diff
LOG: [lld-macho] Only codesign by default on arm64 macOS
instead of doing it on all arm64 platforms.
Reviewed By: #lld-macho, gkm
Differential Revision: https://reviews.llvm.org/D98446
Added:
Modified:
lld/MachO/Driver.cpp
lld/test/MachO/Inputs/iPhoneSimulator.sdk/usr/lib/libSystem.tbd
lld/test/MachO/adhoc-codesign.s
Removed:
################################################################################
diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 3674cd927ffa..655d4cc555a5 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -921,7 +921,8 @@ bool macho::link(ArrayRef<const char *> argsArr, bool canExitEarly,
config->adhocCodesign = args.hasFlag(
OPT_adhoc_codesign, OPT_no_adhoc_codesign,
- config->target.Arch == AK_arm64 || config->target.Arch == AK_arm64e);
+ (config->target.Arch == AK_arm64 || config->target.Arch == AK_arm64e) &&
+ config->target.Platform == PlatformKind::macOS);
if (args.hasArg(OPT_v)) {
message(getLLDVersion());
diff --git a/lld/test/MachO/Inputs/iPhoneSimulator.sdk/usr/lib/libSystem.tbd b/lld/test/MachO/Inputs/iPhoneSimulator.sdk/usr/lib/libSystem.tbd
index 4c9641f3af2c..ce806648c205 100644
--- a/lld/test/MachO/Inputs/iPhoneSimulator.sdk/usr/lib/libSystem.tbd
+++ b/lld/test/MachO/Inputs/iPhoneSimulator.sdk/usr/lib/libSystem.tbd
@@ -1,16 +1,20 @@
--- !tapi-tbd-v3
-archs: [ i386, x86_64 ]
-uuids: [ 'i386: 00000000-0000-0000-0000-000000000000', 'x86_64: 00000000-0000-0000-0000-000000000001' ]
+archs: [ i386, x86_64, arm64 ]
+uuids: [ 'i386: 00000000-0000-0000-0000-000000000000',
+ 'x86_64: 00000000-0000-0000-0000-000000000001',
+ 'arm64: 00000000-0000-0000-0000-000000000002' ]
platform: ios
install-name: '/usr/lib/libSystem.dylib'
current-version: 1281
exports:
- - archs: [ i386, x86_64 ]
+ - archs: [ i386, x86_64, arm64 ]
re-exports: [ '/usr/lib/system/libcache.dylib' ]
symbols: [ __crashreporter_info__, _cache_create ]
--- !tapi-tbd-v3
-archs: [ i386, x86_64 ]
-uuids: [ 'i386: 00000000-0000-0000-0000-000000000002', 'x86_64: 00000000-0000-0000-0000-000000000003' ]
+archs: [ i386, x86_64, arm64 ]
+uuids: [ 'i386: 00000000-0000-0000-0000-000000000003',
+ 'x86_64: 00000000-0000-0000-0000-000000000004',
+ 'arm64: 00000000-0000-0000-0000-000000000005' ]
platform: ios
install-name: '/usr/lib/system/libcache.dylib'
current-version: 83
@@ -24,11 +28,13 @@ exports:
# The following TAPI document is not re-exported by any other document in this
# TBD file, and should therefore be inaccessible.
--- !tapi-tbd-v3
-archs: [ i386, x86_64 ]
-uuids: [ 'i386: 00000000-0000-0000-0000-000000000003', 'x86_64: 00000000-0000-0000-0000-000000000004' ]
+archs: [ i386, x86_64, arm64 ]
+uuids: [ 'i386: 00000000-0000-0000-0000-000000000006',
+ 'x86_64: 00000000-0000-0000-0000-000000000007',
+ 'arm64: 00000000-0000-0000-0000-000000000008' ]
platform: ios
install-name: '/usr/lib/libnotreexported.dylib'
exports:
- - archs: [ i386, x86_64 ]
+ - archs: [ i386, x86_64, arm64 ]
symbols: [ _from_non_reexported_tapi_dylib ]
...
diff --git a/lld/test/MachO/adhoc-codesign.s b/lld/test/MachO/adhoc-codesign.s
index c111f3fa15df..7828f03d0636 100644
--- a/lld/test/MachO/adhoc-codesign.s
+++ b/lld/test/MachO/adhoc-codesign.s
@@ -3,55 +3,79 @@
# RUN: rm -rf %t
# RUN: split-file %s %t
-# RUN: llvm-mc -filetype=obj -triple=arm64-apple-macos -o %t/main-arm64.o %t/main.s
-# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos -o %t/main-x86_64.o %t/main.s
-# RUN: llvm-mc -filetype=obj -triple=arm64-apple-macos -o %t/foo-arm64.o %t/foo.s
-# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos -o %t/foo-x86_64.o %t/foo.s
+# RUN: llvm-mc -filetype=obj -triple=arm64-apple-macos -o %t/main-arm64-macos.o %t/main.s
+# RUN: llvm-mc -filetype=obj -triple=arm64-apple-iossimulator -o %t/main-arm64-sim.o %t/main.s
+# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos -o %t/main-x86_64-macos.o %t/main.s
+# RUN: llvm-mc -filetype=obj -triple=arm64-apple-macos -o %t/foo-arm64-macos.o %t/foo.s
+# RUN: llvm-mc -filetype=obj -triple=arm64-apple-iossimulator -o %t/foo-arm64-sim.o %t/foo.s
+# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos -o %t/foo-x86_64-macos.o %t/foo.s
# Exhaustive test for:
-# (x86_64, arm64) x (default, -adhoc_codesign, -no_adhoc-codesign) x (execute, dylib, bundle)
+# (x86_64-macos, arm64-macos, arm64-ios-simulator) x (default, -adhoc_codesign, -no_adhoc-codesign) x (execute, dylib, bundle)
-# RUN: %lld -lSystem -arch x86_64 -execute -o %t/out %t/main-x86_64.o
+# RUN: %lld -lSystem -arch x86_64 -execute -o %t/out %t/main-x86_64-macos.o
# RUN: llvm-objdump --macho --all-headers %t/out | FileCheck --check-prefix=NO-ADHOC %s
-# RUN: %lld -arch x86_64 -dylib -o %t/out %t/foo-x86_64.o
+# RUN: %lld -arch x86_64 -dylib -o %t/out %t/foo-x86_64-macos.o
# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=NO-ADHOC %s
-# RUN: %lld -arch x86_64 -bundle -o %t/out %t/foo-x86_64.o
+# RUN: %lld -arch x86_64 -bundle -o %t/out %t/foo-x86_64-macos.o
# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=NO-ADHOC %s
-# RUN: %lld -lSystem -arch x86_64 -execute -adhoc_codesign -o %t/out %t/main-x86_64.o
+# RUN: %lld -lSystem -arch x86_64 -execute -adhoc_codesign -o %t/out %t/main-x86_64-macos.o
# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=ADHOC %s
-# RUN: %lld -arch x86_64 -dylib -adhoc_codesign -o %t/out %t/foo-x86_64.o
+# RUN: %lld -arch x86_64 -dylib -adhoc_codesign -o %t/out %t/foo-x86_64-macos.o
# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=ADHOC %s
-# RUN: %lld -arch x86_64 -bundle -adhoc_codesign -o %t/out %t/foo-x86_64.o
+# RUN: %lld -arch x86_64 -bundle -adhoc_codesign -o %t/out %t/foo-x86_64-macos.o
# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=ADHOC %s
-# RUN: %lld -lSystem -arch x86_64 -execute -no_adhoc_codesign -o %t/out %t/main-x86_64.o
+# RUN: %lld -lSystem -arch x86_64 -execute -no_adhoc_codesign -o %t/out %t/main-x86_64-macos.o
# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=NO-ADHOC %s
-# RUN: %lld -arch x86_64 -dylib -no_adhoc_codesign -o %t/out %t/foo-x86_64.o
+# RUN: %lld -arch x86_64 -dylib -no_adhoc_codesign -o %t/out %t/foo-x86_64-macos.o
# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=NO-ADHOC %s
-# RUN: %lld -arch x86_64 -bundle -no_adhoc_codesign -o %t/out %t/foo-x86_64.o
+# RUN: %lld -arch x86_64 -bundle -no_adhoc_codesign -o %t/out %t/foo-x86_64-macos.o
# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=NO-ADHOC %s
-# RUN: %lld -lSystem -arch arm64 -execute -o %t/out %t/main-arm64.o
+# RUN: %lld -lSystem -arch arm64 -execute -o %t/out %t/main-arm64-macos.o
# RUN: llvm-objdump --macho --all-headers %t/out | FileCheck --check-prefix=ADHOC %s
-# RUN: %lld -arch arm64 -dylib -o %t/out %t/foo-arm64.o
+# RUN: %lld -arch arm64 -dylib -o %t/out %t/foo-arm64-macos.o
# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=ADHOC %s
-# RUN: %lld -arch arm64 -bundle -o %t/out %t/foo-arm64.o
+# RUN: %lld -arch arm64 -bundle -o %t/out %t/foo-arm64-macos.o
# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=ADHOC %s
-# RUN: %lld -lSystem -arch arm64 -execute -adhoc_codesign -o %t/out %t/main-arm64.o
+# RUN: %lld -lSystem -arch arm64 -execute -adhoc_codesign -o %t/out %t/main-arm64-macos.o
# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=ADHOC %s
-# RUN: %lld -arch arm64 -dylib -adhoc_codesign -o %t/out %t/foo-arm64.o
+# RUN: %lld -arch arm64 -dylib -adhoc_codesign -o %t/out %t/foo-arm64-macos.o
# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=ADHOC %s
-# RUN: %lld -arch arm64 -bundle -adhoc_codesign -o %t/out %t/foo-arm64.o
+# RUN: %lld -arch arm64 -bundle -adhoc_codesign -o %t/out %t/foo-arm64-macos.o
# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=ADHOC %s
-# RUN: %lld -lSystem -arch arm64 -execute -no_adhoc_codesign -o %t/out %t/main-arm64.o
+# RUN: %lld -lSystem -arch arm64 -execute -no_adhoc_codesign -o %t/out %t/main-arm64-macos.o
# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=NO-ADHOC %s
-# RUN: %lld -arch arm64 -dylib -no_adhoc_codesign -o %t/out %t/foo-arm64.o
+# RUN: %lld -arch arm64 -dylib -no_adhoc_codesign -o %t/out %t/foo-arm64-macos.o
# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=NO-ADHOC %s
-# RUN: %lld -arch arm64 -bundle -no_adhoc_codesign -o %t/out %t/foo-arm64.o
+# RUN: %lld -arch arm64 -bundle -no_adhoc_codesign -o %t/out %t/foo-arm64-macos.o
+# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=NO-ADHOC %s
+
+
+# RUN: ld64.lld -arch arm64 -platform_version ios-simulator 14.0 15.0 -execute -o %t/out %t/main-arm64-sim.o -syslibroot %S/Inputs/iPhoneSimulator.sdk -lSystem
+# RUN: llvm-objdump --macho --all-headers %t/out | FileCheck --check-prefix=NO-ADHOC %s
+# RUN: ld64.lld -arch arm64 -platform_version ios-simulator 14.0 15.0 -dylib -o %t/out %t/foo-arm64-sim.o
+# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=NO-ADHOC %s
+# RUN: ld64.lld -arch arm64 -platform_version ios-simulator 14.0 15.0 -bundle -o %t/out %t/foo-arm64-sim.o
+# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=NO-ADHOC %s
+
+# RUN: ld64.lld -arch arm64 -platform_version ios-simulator 14.0 15.0 -execute -adhoc_codesign -o %t/out %t/main-arm64-sim.o -syslibroot %S/Inputs/iPhoneSimulator.sdk -lSystem
+# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=ADHOC %s
+# RUN: ld64.lld -arch arm64 -platform_version ios-simulator 14.0 15.0 -dylib -adhoc_codesign -o %t/out %t/foo-arm64-sim.o
+# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=ADHOC %s
+# RUN: ld64.lld -arch arm64 -platform_version ios-simulator 14.0 15.0 -bundle -adhoc_codesign -o %t/out %t/foo-arm64-sim.o
+# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=ADHOC %s
+
+# RUN: ld64.lld -lSystem -arch arm64 -platform_version ios-simulator 14.0 15.0 -execute -no_adhoc_codesign -o %t/out %t/main-arm64-sim.o -syslibroot %S/Inputs/iPhoneSimulator.sdk
+# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=NO-ADHOC %s
+# RUN: ld64.lld -arch arm64 -platform_version ios-simulator 14.0 15.0 -dylib -no_adhoc_codesign -o %t/out %t/foo-arm64-sim.o
+# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=NO-ADHOC %s
+# RUN: ld64.lld -arch arm64 -platform_version ios-simulator 14.0 15.0 -bundle -no_adhoc_codesign -o %t/out %t/foo-arm64-sim.o
# RUN: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=NO-ADHOC %s
# ADHOC: cmd LC_CODE_SIGNATURE
More information about the llvm-commits
mailing list