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.

Signed-off-by: Keith Packard <[email protected]>
---
 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 d1024ced3e7..def290ee0b1 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}"
 
-- 
2.51.0

Reply via email to