[clang] [PS4, PS5][Driver] Pass `-L<...>/target/lib -L.` to linker (PR #109796)
Paul T Robinson via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 24 07:18:52 PDT 2024
================
@@ -46,3 +46,26 @@
// CHECK-SYSROOT: {{ld(\.exe)?}}"
// CHECK-SYSROOT-SAME: "--sysroot=mysdk"
+
+// Test that "." is always added to library search paths. This is long-standing
+// behavior, unique to PlayStation toolchains.
+
+// RUN: %clang --target=x64_64-sie-ps5 %s -### 2>&1 | FileCheck --check-prefixes=CHECK-LDOT %s
+
+// CHECK-LDOT: {{ld(\.exe)?}}"
+// CHECK-LDOT-SAME: "-L."
+
+// Test that <sdk-root>/target/lib is added to library search paths, if it
+// exists and no --sysroot is specified.
+
+// RUN: rm -rf %t.dir && mkdir -p %t.dir/target/lib
+// RUN: env SCE_PROSPERO_SDK_DIR=%t.dir %clang --target=x64_64-sie-ps5 %s -### 2>&1 | FileCheck --check-prefixes=CHECK-TARGETLIB %s
+
+// CHECK-TARGETLIB: {{ld(\.exe)?}}"
+// CHECK-TARGETLIB-SAME: "-L{{.*[/\\]}}target/lib"
+
+// RUN: env SCE_PROSPERO_SDK_DIR=missing %clang --target=x64_64-sie-ps5 %s -### 2>&1 | FileCheck --check-prefixes=CHECK-NO-TARGETLIB %s
----------------
pogo59 wrote:
This assumes `missing` is not present. While that's likely to be true, I might prefer to sequence the tests this way:
```
rm -rf %t.dir && mkdir -p %t.dir
env SCE_PROSPERO_SDK_DIR=%t.dir .... CHECK-NO-TARGETLIB
mkdir -p %t.dir/target/lib
env SCE_PROSPERO_SDK_DIR=%t.dir .... CHECK-TARGETLIB
```
It's a smidge more robust and self-explanatory IMO.
https://github.com/llvm/llvm-project/pull/109796
More information about the cfe-commits
mailing list