-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[PS5][Driver] Don't link with --build-id when -static #123930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PS5][Driver] Don't link with --build-id when -static #123930
Conversation
Users of the PlayStation SDK aren't given the means to create or run static executables. Uses of `-static` are limited a few specialized cases within SIE. A `--build-id` isn't wanted in those cases. SIE tracker: TOOLCHAIN-16704
@llvm/pr-subscribers-clang-driver Author: Edd Dawson (playstation-edd) ChangesUsers of the PlayStation SDK aren't given the means to create or run static executables. Uses of SIE tracker: TOOLCHAIN-16704 Full diff: https://github.com/llvm/llvm-project/pull/123930.diff 2 Files Affected:
diff --git a/clang/lib/Driver/ToolChains/PS4CPU.cpp b/clang/lib/Driver/ToolChains/PS4CPU.cpp
index e1187ce48c3e4c..4f9755db238d99 100644
--- a/clang/lib/Driver/ToolChains/PS4CPU.cpp
+++ b/clang/lib/Driver/ToolChains/PS4CPU.cpp
@@ -262,7 +262,10 @@ void tools::PS5cpu::Linker::ConstructJob(Compilation &C, const JobAction &JA,
// index the symbols. `uuid` is the cheapest fool-proof method.
// (The non-determinism and alternative methods are noted in the downstream
// PlayStation docs).
- CmdArgs.push_back("--build-id=uuid");
+ // Static executables are only used for a handful of specialized components,
+ // where the extra section is not wanted.
+ if (!Static)
+ CmdArgs.push_back("--build-id=uuid");
// All references are expected to be resolved at static link time for both
// executables and dynamic libraries. This has been the default linking
diff --git a/clang/test/Driver/ps5-linker.c b/clang/test/Driver/ps5-linker.c
index 9dd35c40619b68..777826aade7ff2 100644
--- a/clang/test/Driver/ps5-linker.c
+++ b/clang/test/Driver/ps5-linker.c
@@ -49,7 +49,6 @@
// CHECK-EXE: {{ld(\.exe)?}}"
// CHECK-EXE-SAME: "--eh-frame-hdr"
// CHECK-EXE-SAME: "--hash-style=sysv"
-// CHECK-EXE-SAME: "--build-id=uuid"
// CHECK-EXE-SAME: "--unresolved-symbols=report-all"
// CHECK-EXE-SAME: "-z" "now"
// CHECK-EXE-SAME: "-z" "start-stop-visibility=hidden"
@@ -63,10 +62,23 @@
// CHECK-NO-EXE: {{ld(\.exe)?}}"
// CHECK-NO-EXE-NOT: "--eh-frame-hdr"
// CHECK-NO-EXE-NOT: "--hash-style
-// CHECK-NO-EXE-NOT: "--build-id
// CHECK-NO-EXE-NOT: "--unresolved-symbols
// CHECK-NO-EXE-NOT: "-z"
+// Test that --build-id is supplied to the linker for non-static executables
+// and -shared.
+
+// RUN: %clang --target=x86_64-sie-ps5 %s -### 2>&1 | FileCheck --check-prefixes=CHECK-BUILD-ID %s
+// RUN: %clang --target=x86_64-sie-ps5 %s -shared -### 2>&1 | FileCheck --check-prefixes=CHECK-BUILD-ID %s
+// RUN: %clang --target=x86_64-sie-ps5 %s -static -### 2>&1 | FileCheck --check-prefixes=CHECK-NO-BUILD-ID %s
+// RUN: %clang --target=x86_64-sie-ps5 %s -r -### 2>&1 | FileCheck --check-prefixes=CHECK-NO-BUILD-ID %s
+
+// CHECK-BUILD-ID: {{ld(\.exe)?}}"
+// CHECK-BUILD-ID-SAME: "--build-id=uuid"
+
+// CHECK-NO-BUILD-ID: {{ld(\.exe)?}}"
+// CHECK-NO-BUILD-ID-NOT: "--build-id
+
// Test that an appropriate linker script is supplied by the driver, but can
// be overridden with -T.
|
@llvm/pr-subscribers-clang Author: Edd Dawson (playstation-edd) ChangesUsers of the PlayStation SDK aren't given the means to create or run static executables. Uses of SIE tracker: TOOLCHAIN-16704 Full diff: https://github.com/llvm/llvm-project/pull/123930.diff 2 Files Affected:
diff --git a/clang/lib/Driver/ToolChains/PS4CPU.cpp b/clang/lib/Driver/ToolChains/PS4CPU.cpp
index e1187ce48c3e4c..4f9755db238d99 100644
--- a/clang/lib/Driver/ToolChains/PS4CPU.cpp
+++ b/clang/lib/Driver/ToolChains/PS4CPU.cpp
@@ -262,7 +262,10 @@ void tools::PS5cpu::Linker::ConstructJob(Compilation &C, const JobAction &JA,
// index the symbols. `uuid` is the cheapest fool-proof method.
// (The non-determinism and alternative methods are noted in the downstream
// PlayStation docs).
- CmdArgs.push_back("--build-id=uuid");
+ // Static executables are only used for a handful of specialized components,
+ // where the extra section is not wanted.
+ if (!Static)
+ CmdArgs.push_back("--build-id=uuid");
// All references are expected to be resolved at static link time for both
// executables and dynamic libraries. This has been the default linking
diff --git a/clang/test/Driver/ps5-linker.c b/clang/test/Driver/ps5-linker.c
index 9dd35c40619b68..777826aade7ff2 100644
--- a/clang/test/Driver/ps5-linker.c
+++ b/clang/test/Driver/ps5-linker.c
@@ -49,7 +49,6 @@
// CHECK-EXE: {{ld(\.exe)?}}"
// CHECK-EXE-SAME: "--eh-frame-hdr"
// CHECK-EXE-SAME: "--hash-style=sysv"
-// CHECK-EXE-SAME: "--build-id=uuid"
// CHECK-EXE-SAME: "--unresolved-symbols=report-all"
// CHECK-EXE-SAME: "-z" "now"
// CHECK-EXE-SAME: "-z" "start-stop-visibility=hidden"
@@ -63,10 +62,23 @@
// CHECK-NO-EXE: {{ld(\.exe)?}}"
// CHECK-NO-EXE-NOT: "--eh-frame-hdr"
// CHECK-NO-EXE-NOT: "--hash-style
-// CHECK-NO-EXE-NOT: "--build-id
// CHECK-NO-EXE-NOT: "--unresolved-symbols
// CHECK-NO-EXE-NOT: "-z"
+// Test that --build-id is supplied to the linker for non-static executables
+// and -shared.
+
+// RUN: %clang --target=x86_64-sie-ps5 %s -### 2>&1 | FileCheck --check-prefixes=CHECK-BUILD-ID %s
+// RUN: %clang --target=x86_64-sie-ps5 %s -shared -### 2>&1 | FileCheck --check-prefixes=CHECK-BUILD-ID %s
+// RUN: %clang --target=x86_64-sie-ps5 %s -static -### 2>&1 | FileCheck --check-prefixes=CHECK-NO-BUILD-ID %s
+// RUN: %clang --target=x86_64-sie-ps5 %s -r -### 2>&1 | FileCheck --check-prefixes=CHECK-NO-BUILD-ID %s
+
+// CHECK-BUILD-ID: {{ld(\.exe)?}}"
+// CHECK-BUILD-ID-SAME: "--build-id=uuid"
+
+// CHECK-NO-BUILD-ID: {{ld(\.exe)?}}"
+// CHECK-NO-BUILD-ID-NOT: "--build-id
+
// Test that an appropriate linker script is supplied by the driver, but can
// be overridden with -T.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Users of the PlayStation SDK aren't given the means to create or run static executables. Uses of
-static
are limited a few specialized cases within SIE. A--build-id
isn't wanted in those cases.SIE tracker: TOOLCHAIN-16704