[lld] bd57070 - [lld-macho] Update -adhoc_codesign default
Keith Smiley via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 8 13:49:23 PST 2022
Author: Keith Smiley
Date: 2022-12-08T13:47:38-08:00
New Revision: bd570709c06a19637f3e8df47cb6f9a094fa6aa8
URL: https://github.com/llvm/llvm-project/commit/bd570709c06a19637f3e8df47cb6f9a094fa6aa8
DIFF: https://github.com/llvm/llvm-project/commit/bd570709c06a19637f3e8df47cb6f9a094fa6aa8.diff
LOG: [lld-macho] Update -adhoc_codesign default
With newer versions of ld64 it generates an adhoc signature by default
for all arm64 simulator targets. This default is especially important
for unit test targets that rarely have custom codesigning requirements
but otherwise won't run on arm64 macs.
Differential Revision: https://reviews.llvm.org/D139672
Added:
Modified:
lld/MachO/Driver.cpp
lld/test/MachO/adhoc-codesign.s
Removed:
################################################################################
diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 74a1311d54313..f17873fd25101 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -936,6 +936,15 @@ static bool supportsNoPie() {
config->arch() == AK_arm64_32);
}
+static bool shouldAdhocSignByDefault(Architecture arch, PlatformType platform) {
+ if (arch != AK_arm64 && arch != AK_arm64e)
+ return false;
+
+ return platform == PLATFORM_MACOS || platform == PLATFORM_IOSSIMULATOR ||
+ platform == PLATFORM_TVOSSIMULATOR ||
+ platform == PLATFORM_WATCHOSSIMULATOR;
+}
+
static bool dataConstDefault(const InputArgList &args) {
static const std::array<std::pair<PlatformType, VersionTuple>, 5> minVersion =
{{{PLATFORM_MACOS, VersionTuple(10, 15)},
@@ -1735,8 +1744,7 @@ bool macho::link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
config->adhocCodesign = args.hasFlag(
OPT_adhoc_codesign, OPT_no_adhoc_codesign,
- (config->arch() == AK_arm64 || config->arch() == AK_arm64e) &&
- config->platform() == PLATFORM_MACOS);
+ shouldAdhocSignByDefault(config->arch(), config->platform()));
if (args.hasArg(OPT_v)) {
message(getLLDVersion(), lld::errs());
diff --git a/lld/test/MachO/adhoc-codesign.s b/lld/test/MachO/adhoc-codesign.s
index 9c063c7b8f10d..ca08f40102c9f 100644
--- a/lld/test/MachO/adhoc-codesign.s
+++ b/lld/test/MachO/adhoc-codesign.s
@@ -57,11 +57,11 @@
# RUN: %no-arg-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: llvm-objdump --macho --all-headers %t/out | FileCheck --check-prefix=ADHOC %s
# RUN: %no-arg-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: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=ADHOC %s
# RUN: %no-arg-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: llvm-objdump --macho --all-headers %t/out| FileCheck --check-prefix=ADHOC %s
# RUN: %no-arg-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
More information about the llvm-commits
mailing list