[lld] [lld] Adds support for xros. (PR #83031)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 26 12:56:51 PST 2024
https://github.com/rohit-rao updated https://github.com/llvm/llvm-project/pull/83031
>From 6293ab8f5e654929cf42ed6e978d230cfb16c9dc Mon Sep 17 00:00:00 2001
From: Rohit Rao <rohitrao at google.com>
Date: Mon, 26 Feb 2024 11:46:24 -0500
Subject: [PATCH 1/3] [lld] Adds support for xros.
---
lld/MachO/Driver.cpp | 19 +++++++++++++------
lld/MachO/Options.td | 2 +-
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index a57f60c5eed36b..16478d41cd3683 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -691,6 +691,8 @@ static PlatformVersion parsePlatformVersion(const Arg *arg) {
.Cases("tvos-simulator", "8", PLATFORM_TVOSSIMULATOR)
.Cases("watchos-simulator", "9", PLATFORM_WATCHOSSIMULATOR)
.Cases("driverkit", "10", PLATFORM_DRIVERKIT)
+ .Cases("xros", "11", PLATFORM_XROS)
+ .Cases("xros-simulator", "12", PLATFORM_XROS_SIMULATOR)
.Default(PLATFORM_UNKNOWN);
if (platformVersion.platform == PLATFORM_UNKNOWN)
error(Twine("malformed platform: ") + platformStr);
@@ -985,6 +987,8 @@ PlatformType macho::removeSimulator(PlatformType platform) {
return PLATFORM_TVOS;
case PLATFORM_WATCHOSSIMULATOR:
return PLATFORM_WATCHOS;
+ case PLATFORM_XROS_SIMULATOR:
+ return PLATFORM_XROS;
default:
return platform;
}
@@ -1001,15 +1005,17 @@ static bool shouldAdhocSignByDefault(Architecture arch, PlatformType platform) {
return platform == PLATFORM_MACOS || platform == PLATFORM_IOSSIMULATOR ||
platform == PLATFORM_TVOSSIMULATOR ||
- platform == PLATFORM_WATCHOSSIMULATOR;
+ platform == PLATFORM_WATCHOSSIMULATOR ||
+ platform == PLATFORM_XROS_SIMULATOR;
}
static bool dataConstDefault(const InputArgList &args) {
- static const std::array<std::pair<PlatformType, VersionTuple>, 5> minVersion =
+ static const std::array<std::pair<PlatformType, VersionTuple>, 6> minVersion =
{{{PLATFORM_MACOS, VersionTuple(10, 15)},
{PLATFORM_IOS, VersionTuple(13, 0)},
{PLATFORM_TVOS, VersionTuple(13, 0)},
{PLATFORM_WATCHOS, VersionTuple(6, 0)},
+ {PLATFORM_XROS, VersionTuple(1, 0)},
{PLATFORM_BRIDGEOS, VersionTuple(4, 0)}}};
PlatformType platform = removeSimulator(config->platformInfo.target.Platform);
auto it = llvm::find_if(minVersion,
@@ -1045,11 +1051,12 @@ static bool shouldEmitChainedFixups(const InputArgList &args) {
bool isRequested = arg != nullptr;
// Version numbers taken from the Xcode 13.3 release notes.
- static const std::array<std::pair<PlatformType, VersionTuple>, 4> minVersion =
+ static const std::array<std::pair<PlatformType, VersionTuple>, 5> minVersion =
{{{PLATFORM_MACOS, VersionTuple(11, 0)},
{PLATFORM_IOS, VersionTuple(13, 4)},
{PLATFORM_TVOS, VersionTuple(14, 0)},
- {PLATFORM_WATCHOS, VersionTuple(7, 0)}}};
+ {PLATFORM_WATCHOS, VersionTuple(7, 0)},
+ {PLATFORM_XROS, VersionTuple(1, 0)}}};
PlatformType platform = removeSimulator(config->platformInfo.target.Platform);
auto it = llvm::find_if(minVersion,
[&](const auto &p) { return p.first == platform; });
@@ -1688,8 +1695,8 @@ bool link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
if (args.getLastArg(OPT_reproducible))
config->zeroModTime = true;
- std::array<PlatformType, 3> encryptablePlatforms{
- PLATFORM_IOS, PLATFORM_WATCHOS, PLATFORM_TVOS};
+ std::array<PlatformType, 4> encryptablePlatforms{
+ PLATFORM_IOS, PLATFORM_WATCHOS, PLATFORM_TVOS, PLATFORM_XROS};
config->emitEncryptionInfo =
args.hasFlag(OPT_encryptable, OPT_no_encryption,
is_contained(encryptablePlatforms, config->platform()));
diff --git a/lld/MachO/Options.td b/lld/MachO/Options.td
index 01e73b789f9aab..a524e4a4c50841 100644
--- a/lld/MachO/Options.td
+++ b/lld/MachO/Options.td
@@ -377,7 +377,7 @@ def grp_version : OptionGroup<"version">, HelpText<"VERSION TARGETING">;
def platform_version : MultiArg<["-"], "platform_version", 3>,
MetaVarName<"<platform> <min_version> <sdk_version>">,
- HelpText<"Platform (e.g., macos, ios, tvos, watchos, bridgeos, mac-catalyst, ios-sim, tvos-sim, watchos-sim, driverkit) and version numbers">,
+ HelpText<"Platform (e.g., macos, ios, tvos, watchos, xros, bridgeos, mac-catalyst, ios-sim, tvos-sim, watchos-sim, xros-sim, driverkit) and version numbers">,
Group<grp_version>;
def sdk_version : Separate<["-"], "sdk_version">,
HelpText<"This option is undocumented in ld64">,
>From 1544937a1f44f16e4894c35634509f4a8d2a8030 Mon Sep 17 00:00:00 2001
From: Rohit Rao <rohitrao at google.com>
Date: Mon, 26 Feb 2024 12:06:01 -0500
Subject: [PATCH 2/3] fixup! [lld] Adds support for xros.
---
lld/MachO/Driver.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 16478d41cd3683..018ceec97f204a 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -1696,7 +1696,7 @@ bool link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
config->zeroModTime = true;
std::array<PlatformType, 4> encryptablePlatforms{
- PLATFORM_IOS, PLATFORM_WATCHOS, PLATFORM_TVOS, PLATFORM_XROS};
+ PLATFORM_IOS, PLATFORM_WATCHOS, PLATFORM_TVOS, PLATFORM_XROS};
config->emitEncryptionInfo =
args.hasFlag(OPT_encryptable, OPT_no_encryption,
is_contained(encryptablePlatforms, config->platform()));
>From 227e323c60628c09f2b2ed354b75d22b3888e4e9 Mon Sep 17 00:00:00 2001
From: Rohit Rao <rohitrao at google.com>
Date: Mon, 26 Feb 2024 15:56:30 -0500
Subject: [PATCH 3/3] fixup! [lld] Adds support for xros.
---
lld/test/MachO/platform-version.s | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lld/test/MachO/platform-version.s b/lld/test/MachO/platform-version.s
index 047aea02fcde31..57fbae62b2ffcd 100644
--- a/lld/test/MachO/platform-version.s
+++ b/lld/test/MachO/platform-version.s
@@ -55,7 +55,7 @@
# RUN: -platform_version 0 1 5 \
# RUN: | FileCheck --check-prefix=FAIL-PLATFORM %s
# RUN: not %no-arg-lld -arch x86_64 -o %t %t.o 2>&1 \
-# RUN: -platform_version 11 1 5 \
+# RUN: -platform_version 13 1 5 \
# RUN: | FileCheck --check-prefix=FAIL-PLATFORM %s
# FAIL-PLATFORM: malformed platform: {{.*}}
# FAIL-PLATFORM-NOT: malformed {{minimum|sdk}} version: {{.*}}
More information about the llvm-commits
mailing list