]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[PATCH] picolibc: Use %:find-file for both test and access to picolibc.ld
authorKeith Packard <keithp@keithp.com>
Sat, 31 Jan 2026 14:00:26 +0000 (07:00 -0700)
committerJeff Law <jeffrey.law@oss.qualcomm.com>
Sat, 31 Jan 2026 14:00:26 +0000 (07:00 -0700)
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.

gcc/config/picolibc-spec.h

index d1024ced3e7f6395cc8d8403d7b3aba590ec1f3a..def290ee0b1269b741a8f4f27d4853e39825acb3 100644 (file)
@@ -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}"