Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions clang/lib/Driver/ToolChains/PS4CPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,12 @@ void tools::PS5cpu::Linker::ConstructJob(Compilation &C, const JobAction &JA,
// with the SDK. The scripts are inside <sdkroot>/target/lib, which is
// added as a search path elsewhere.
// "PRX" has long stood for "PlayStation Relocatable eXecutable".
CmdArgs.push_back("--default-script");
CmdArgs.push_back(Static ? "static.script"
: Shared ? "prx.script"
: "main.script");
if (!Args.hasArgNoClaim(options::OPT_T)) {
CmdArgs.push_back("--default-script");
CmdArgs.push_back(Static ? "static.script"
: Shared ? "prx.script"
: "main.script");
}
}

if (Static)
Expand Down
7 changes: 6 additions & 1 deletion clang/test/Driver/ps5-linker.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,24 @@
// CHECK-NO-EXE-NOT: "--unresolved-symbols
// CHECK-NO-EXE-NOT: "-z"

// Test that an appropriate linker script is supplied by the driver.
// Test that an appropriate linker script is supplied by the driver, but can
// be overridden with -T.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: -T/--script

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no --script on clang. I may not understand your comment.

Copy link
Collaborator

@bd1976bris bd1976bris Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No you haven't. I just assumed that there was, apologies.


// RUN: %clang --target=x86_64-sie-ps5 %s -### 2>&1 | FileCheck --check-prefixes=CHECK-SCRIPT -DSCRIPT=main %s
// RUN: %clang --target=x86_64-sie-ps5 %s -shared -### 2>&1 | FileCheck --check-prefixes=CHECK-SCRIPT -DSCRIPT=prx %s
// RUN: %clang --target=x86_64-sie-ps5 %s -static -### 2>&1 | FileCheck --check-prefixes=CHECK-SCRIPT -DSCRIPT=static %s
// RUN: %clang --target=x86_64-sie-ps5 %s -r -### 2>&1 | FileCheck --check-prefixes=CHECK-NO-SCRIPT %s
// RUN: %clang --target=x86_64-sie-ps5 %s -T custom.script -### 2>&1 | FileCheck --check-prefixes=CHECK-CUSTOM-SCRIPT --implicit-check-not "\"{{-T|--script|--default-script}}\"" %s

// CHECK-SCRIPT: {{ld(\.exe)?}}"
// CHECK-SCRIPT-SAME: "--default-script" "[[SCRIPT]].script"

// CHECK-NO-SCRIPT: {{ld(\.exe)?}}"
// CHECK-NO-SCRIPT-NOT: "--default-script"

// CHECK-CUSTOM-SCRIPT: {{ld(\.exe)?}}"
// CHECK-CUSTOM-SCRIPT-SAME: "-T" "custom.script"

// Test that -static is forwarded to the linker

// RUN: %clang --target=x86_64-sie-ps5 -static %s -### 2>&1 | FileCheck --check-prefixes=CHECK-STATIC %s
Expand Down
Loading