[clang] [PS5][Driver] Pass default -z options to PS5 linker (PR #113162)
Edd Dawson via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 22 09:23:52 PDT 2024
================
@@ -240,11 +242,32 @@ void tools::PS5cpu::Linker::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back(
Args.MakeArgString("--sysroot=" + TC.getSDKLibraryRootDir()));
- // Default to PIE for non-static executables.
- const bool PIE =
- !Args.hasArg(options::OPT_r, options::OPT_shared, options::OPT_static);
- if (Args.hasFlag(options::OPT_pie, options::OPT_no_pie, PIE))
- CmdArgs.push_back("-pie");
+ if (!Relocatable) {
+ // Default to PIE for non-static executables.
+ const bool PIE = !Args.hasArg(options::OPT_shared, options::OPT_static);
+ if (Args.hasFlag(options::OPT_pie, options::OPT_no_pie, PIE))
+ CmdArgs.push_back("-pie");
----------------
playstation-edd wrote:
The inclusion was deliberate. I took the opportunity to perform the check for `OPT_r` in one place. But I didn't spot the edge-case change in behaviour that you mention, forgetting that `hasArg()` had a side-effect - sorry!
Would we prefer that undo this bit and defer to a separate PR? Or update the final commit message and perhaps add a test case for the behaviour change?
https://github.com/llvm/llvm-project/pull/113162
More information about the cfe-commits
mailing list