[clang] [PS5][Driver] Allow selection of CRT with `-L` (PR #145869)
Edd Dawson via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 27 07:00:09 PDT 2025
================
@@ -200,12 +200,10 @@
// CHECK-NO-TARGETLIB-SAME: "-L."
// RUN: mkdir -p %t.dir/myroot/target/lib
-// RUN: touch %t.dir/myroot/target/lib/crti.o
// RUN: env SCE_PROSPERO_SDK_DIR=%t.dir/myroot %clang --target=x64_64-sie-ps5 %s -### -Luser 2>&1 | FileCheck --check-prefixes=CHECK-TARGETLIB %s
// RUN: %clang --target=x64_64-sie-ps5 %s -### -Luser --sysroot=%t.dir/myroot 2>&1 | FileCheck --check-prefixes=CHECK-TARGETLIB %s
// CHECK-TARGETLIB: {{ld(\.exe)?}}"
// CHECK-TARGETLIB-SAME: "-Luser"
// CHECK-TARGETLIB-SAME: "-L{{.*}}myroot{{/|\\\\}}target{{/|\\\\}}lib"
// CHECK-TARGETLIB-SAME: "-L."
----------------
playstation-edd wrote:
> Just to check the thinking: we don't need to check how the linker is directed to crti.o, these check lines are purely about ensuring the correct -L flags come out of the driver?
In short: yes.
In full:
The deleted line checked that `crti.o` was resolved to `<user-supplied-sysroot>/target/lib/crti.o` by the driver. That resolution will still occur, because `-L<user-supplied-sysroot>/target/lib` and `-l:crti.o` are passed to the linker, but it will now be the linker that does the resolution instead of the driver.
The removed line below could have been replaced with:
```
// CHECK-TARGETLIB-SAME: "-l:crti.o"
```
But the user supplied sysroot has no interaction with this part - `"-l:crti.o"` appears regardless. And since the appearance of `"-l:crti.o"` and friends are checked elsewhere in this file, I didn't think it was worth repeating again here.
The remaining `CHECK-TARGETLIB` lines continue to confirm user supplied library paths are passed to the linker before the defaults (`<sysroot>/target/lib` and `.`).
https://github.com/llvm/llvm-project/pull/145869
More information about the cfe-commits
mailing list