[clang] [PS5][Driver] Pass `-z rodynamic` to the linker (PR #115009)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 5 07:36:30 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-driver
Author: Edd Dawson (playstation-edd)
<details>
<summary>Changes</summary>
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
---
Full diff: https://github.com/llvm/llvm-project/pull/115009.diff
2 Files Affected:
- (modified) clang/lib/Driver/ToolChains/PS4CPU.cpp (+4)
- (modified) clang/test/Driver/ps5-linker.c (+1)
``````````diff
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"
``````````
</details>
https://github.com/llvm/llvm-project/pull/115009
More information about the cfe-commits
mailing list