Skip to content

Commit c69ed8a

Browse files
[PS4][Driver] Only pass -lto-debug-options to linker when necessary (#101202)
The PS4 linker doesn't accept an empty LTO options string. Passing nothing is also consistent with other drivers. SIE tracker: TOOLCHAIN-16575
1 parent 273e74b commit c69ed8a

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

clang/lib/Driver/ToolChains/PS4CPU.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,9 @@ void tools::PS4cpu::Linker::ConstructJob(Compilation &C, const JobAction &JA,
177177
if (StringRef Threads = getLTOParallelism(Args, D); !Threads.empty())
178178
AddLTOFlag(Twine("-threads=") + Threads);
179179

180-
CmdArgs.push_back(Args.MakeArgString(Twine("-lto-debug-options=") + LTOArgs));
180+
if (*LTOArgs)
181+
CmdArgs.push_back(
182+
Args.MakeArgString(Twine("-lto-debug-options=") + LTOArgs));
181183

182184
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs))
183185
TC.addSanitizerArgs(Args, CmdArgs, "-l", "");

clang/test/Driver/ps4-linker.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,8 @@
1616
// RUN: %clang --target=x86_64-scei-ps4 -flto=full -fcrash-diagnostics-dir=mydumps %s -### 2>&1 | FileCheck --check-prefixes=CHECK-DIAG-LTO %s
1717

1818
// CHECK-DIAG-LTO: "-lto-debug-options= -crash-diagnostics-dir=mydumps"
19+
20+
// Test that -lto-debug-options is only supplied to the linker when necessary
21+
22+
// RUN: %clang --target=x86_64-scei-ps4 %s -### 2>&1 | FileCheck --check-prefixes=CHECK-NO-LTO %s
23+
// CHECK-NO-LTO-NOT: -lto-debug-options

0 commit comments

Comments
 (0)