[clang] [PS5][Driver] Pass `-z rodynamic` to the linker (PR #115009)
Edd Dawson via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 5 07:35:57 PST 2024
https://github.com/playstation-edd created https://github.com/llvm/llvm-project/pull/115009
Until now, suppression of `DT_DEBUG` has been hardcoded as a downstream patch in lld. This can instead be achieved by passing `-z rodynamic`. Have the driver do this so that the private patch can be removed.
If the scope of lld's `-z rodynamic` is broadened (within reason) to do more in future, that's likely to be fine as `PT_DYNAMIC` isn't writable on PlayStation.
PS5 only. On PS4, the equivalent hardcoded configuration will remain in the proprietary linker.
SIE tracker: TOOLCHAIN-16704
>From e171d531a2d39998e8e82dd5fbd96315c0581fd7 Mon Sep 17 00:00:00 2001
From: Edd Dawson <edd.dawson at sony.com>
Date: Tue, 5 Nov 2024 14:51:36 +0000
Subject: [PATCH] [PS5][Driver] Pass `-z rodynamic` to the linker
Until now, suppression of `DT_DEBUG` has been hardcoded as a downstream
patch in lld. This can instead be achieved by passing `-z rodynamic`.
Have the driver do this so that the private patch can be removed.
If the scope of lld's `-z rodynamic` is broadened (within reason) to do
more in future, that's likely to be fine as `PT_DYNAMIC` isn't writable
on PlayStation.
PS5 only. On PS4, the equivalent hardcoded configuration will remain in
the proprietary linker.
SIE tracker: TOOLCHAIN-16704
---
clang/lib/Driver/ToolChains/PS4CPU.cpp | 4 ++++
clang/test/Driver/ps5-linker.c | 1 +
2 files changed, 5 insertions(+)
diff --git a/clang/lib/Driver/ToolChains/PS4CPU.cpp b/clang/lib/Driver/ToolChains/PS4CPU.cpp
index c5299d606f2386..261c136de782e7 100644
--- a/clang/lib/Driver/ToolChains/PS4CPU.cpp
+++ b/clang/lib/Driver/ToolChains/PS4CPU.cpp
@@ -277,6 +277,10 @@ void tools::PS5cpu::Linker::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-z");
CmdArgs.push_back("start-stop-visibility=hidden");
+ // DT_DEBUG is not supported on PlayStation.
+ CmdArgs.push_back("-z");
+ CmdArgs.push_back("rodynamic");
+
CmdArgs.push_back("-z");
CmdArgs.push_back("common-page-size=0x4000");
diff --git a/clang/test/Driver/ps5-linker.c b/clang/test/Driver/ps5-linker.c
index 363c431b6937eb..8a0ade91871295 100644
--- a/clang/test/Driver/ps5-linker.c
+++ b/clang/test/Driver/ps5-linker.c
@@ -53,6 +53,7 @@
// CHECK-EXE-SAME: "--unresolved-symbols=report-all"
// CHECK-EXE-SAME: "-z" "now"
// CHECK-EXE-SAME: "-z" "start-stop-visibility=hidden"
+// CHECK-EXE-SAME: "-z" "rodynamic"
// CHECK-EXE-SAME: "-z" "common-page-size=0x4000"
// CHECK-EXE-SAME: "-z" "max-page-size=0x4000"
// CHECK-EXE-SAME: "-z" "dead-reloc-in-nonalloc=.debug_*=0xffffffffffffffff"
More information about the cfe-commits
mailing list