https://gcc.gnu.org/g:9839ae8f24180d20d8aea5de60a94f41dbfdcda8
commit r16-7216-g9839ae8f24180d20d8aea5de60a94f41dbfdcda8 Author: Keith Packard <[email protected]> Date: Sat Jan 31 07:00:26 2026 -0700 [PATCH] picolibc: Use %:find-file for both test and access to picolibc.ld If the gcc driver and linker don't agree on what the search path for linker scripts is, then the driver may discover a file that the linker won't end up using. This results in linking failures when applications don't specific an explicit linker script. Fix this by duplicating the call to %:find-file for both test and in the parameter passed to the linker. gcc/ * config/picolibc-spec.h (LIBC_LINK_SPEC): Use find-file for test and access to picolibc.ld. Diff: --- gcc/config/picolibc-spec.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config/picolibc-spec.h b/gcc/config/picolibc-spec.h index d1024ced3e7f..def290ee0b12 100644 --- a/gcc/config/picolibc-spec.h +++ b/gcc/config/picolibc-spec.h @@ -39,7 +39,7 @@ * Define vfscanf if --scanf is set */ #define LIBC_LINK_SPEC \ - " %{!shared:%{!r:%{!T*: %:if-exists-then-else(%:find-file(" PICOLIBC_LD ") -T" PICOLIBC_LD ")}}}" \ + " %{!shared:%{!r:%{!T*: %:if-exists-then-else(%:find-file(" PICOLIBC_LD ") -T%:find-file(" PICOLIBC_LD "))}}}" \ " %{-printf=*:--defsym=" USER_LABEL_PREFIX "vfprintf=" USER_LABEL_PREFIX "__%*_vfprintf}" \ " %{-scanf=*:--defsym=" USER_LABEL_PREFIX "vfscanf=" USER_LABEL_PREFIX "__%*_vfscanf}"
