[clang] [PS5][Driver] Pass a target emulation to the linker (PR #114060)
Edd Dawson via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 29 07:18:05 PDT 2024
https://github.com/playstation-edd created https://github.com/llvm/llvm-project/pull/114060
Until now, this has been hardcoded as a downstream patch in lld. Add it to the driver so that the private patch can be removed.
PS5 only. On PS4, the equivalent hardcoded configuration will remain in the proprietary linker.
SIE tracker: TOOLCHAIN-16704
>From 61dda6647ffc73f836ddd8c4e15204eff6d2c53e Mon Sep 17 00:00:00 2001
From: Edd Dawson <edd.dawson at sony.com>
Date: Fri, 25 Oct 2024 14:10:10 +0100
Subject: [PATCH] [PS5][Driver] Pass a target emulation to the linker
Until now, this has been hardcoded as a downstream patch in lld. Add it
to the driver so that the private patch can be removed.
PS5 only. On PS4, the equivalent hardcoded configuration will remain in
the proprietary linker.
SIE tracker: TOOLCHAIN-16704
---
clang/lib/Driver/ToolChains/PS4CPU.cpp | 3 +++
clang/test/Driver/ps5-linker.c | 7 +++++++
2 files changed, 10 insertions(+)
diff --git a/clang/lib/Driver/ToolChains/PS4CPU.cpp b/clang/lib/Driver/ToolChains/PS4CPU.cpp
index 9daafbe703f68e..aaba95951c5060 100644
--- a/clang/lib/Driver/ToolChains/PS4CPU.cpp
+++ b/clang/lib/Driver/ToolChains/PS4CPU.cpp
@@ -241,6 +241,9 @@ void tools::PS5cpu::Linker::ConstructJob(Compilation &C, const JobAction &JA,
// handled somewhere else.
Args.ClaimAllArgs(options::OPT_w);
+ CmdArgs.push_back("-m");
+ CmdArgs.push_back("elf_x86_64_fbsd");
+
CmdArgs.push_back(
Args.MakeArgString("--sysroot=" + TC.getSDKLibraryRootDir()));
diff --git a/clang/test/Driver/ps5-linker.c b/clang/test/Driver/ps5-linker.c
index 2080f4dc91a7fb..5175d8dbca567a 100644
--- a/clang/test/Driver/ps5-linker.c
+++ b/clang/test/Driver/ps5-linker.c
@@ -1,3 +1,10 @@
+// Test that a target emulation is supplied to the linker
+
+// RUN: %clang --target=x86_64-sie-ps5 %s -### 2>&1 | FileCheck --check-prefixes=CHECK-EMU %s
+
+// CHECK-EMU: {{ld(\.exe)?}}"
+// CHECK-EMU-SAME: "-m" "elf_x86_64_fbsd"
+
// Test that PIE is the default for main components
// RUN: %clang --target=x86_64-sie-ps5 %s -### 2>&1 | FileCheck --check-prefixes=CHECK-PIE %s
More information about the cfe-commits
mailing list