[clang] 221cbae - [PS5][Driver] Pass a target emulation to the linker (#114060)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 31 08:21:40 PDT 2024
Author: Edd Dawson
Date: 2024-10-31T15:21:36Z
New Revision: 221cbaed3e048f3de85d00c778420509d3dd5577
URL: https://github.com/llvm/llvm-project/commit/221cbaed3e048f3de85d00c778420509d3dd5577
DIFF: https://github.com/llvm/llvm-project/commit/221cbaed3e048f3de85d00c778420509d3dd5577.diff
LOG: [PS5][Driver] Pass a target emulation to the linker (#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
Added:
Modified:
clang/lib/Driver/ToolChains/PS4CPU.cpp
clang/test/Driver/ps5-linker.c
Removed:
################################################################################
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