[PATCH] ld: move symlink-ing of ldscripts a little earlier

Jan Beulich jbeulich@suse.com
Fri Feb 6 15:07:07 GMT 2026


Following up commit a29a6230b820 "PR 33629 ldscripts symlink in .libs/
created too late", move the symlink-ing ahead of the linking of the final
binary, to eliminate the slim chance of the build being interrupted (or
failing) at that (so far) final step. If that happened, a subsequent make
invocation with no other changes made would then not re-attempt this step.

Necessarily with this the test for the existence of the binary needs to be
removed. Perhaps that shouldn't have been there anyway, the more that the
check was lacking $(EXEEXT).
---
I'm leaving the "cd" there, but I wonder if we wouldn't better do without
it. Largely theoretically it can fail, yet it failing would be ignored,
and the symlink creation would then be attempted one directory up (where
the "test" then should result in nothing to be done, as a real ldscripts
directory should be there already).

--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -661,8 +661,8 @@ EXTRA_ld_new_SOURCES += $(ALL_EMULATION_
 # The standard rule plus set up a symlink when --enable-shared for "make check"
 ld-new$(EXEEXT): $(ld_new_OBJECTS) $(ld_new_DEPENDENCIES) $(EXTRA_ld_new_DEPENDENCIES)
 	@rm -f ld-new$(EXEEXT)
+	$(AM_V_at)cd .libs; test -e ldscripts || $(LN_S) ../ldscripts .
 	$(AM_V_CCLD)$(LINK) $(ld_new_OBJECTS) $(ld_new_LDADD) $(LIBS)
-	$(AM_V_at)cd .libs; test ! -e ld-new || test -e ldscripts || $(LN_S) ../ldscripts .
 
 # This is the real libbfd.a and libctf.a created by libtool.
 TESTBFDLIB = @TESTBFDLIB@
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -2370,8 +2370,8 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULAT
 # The standard rule plus set up a symlink when --enable-shared for "make check"
 ld-new$(EXEEXT): $(ld_new_OBJECTS) $(ld_new_DEPENDENCIES) $(EXTRA_ld_new_DEPENDENCIES)
 	@rm -f ld-new$(EXEEXT)
+	$(AM_V_at)cd .libs; test -e ldscripts || $(LN_S) ../ldscripts .
 	$(AM_V_CCLD)$(LINK) $(ld_new_OBJECTS) $(ld_new_LDADD) $(LIBS)
-	$(AM_V_at)cd .libs; test ! -e ld-new || test -e ldscripts || $(LN_S) ../ldscripts .
 
 check-DEJAGNU: site.exp
 	srcroot=`cd $(srcdir) && pwd`; export srcroot; \


More information about the Binutils mailing list