PR 33629 ldscripts symlink in .libs/ created too late
Alan Modra
amodra@gmail.com
Mon Feb 2 08:15:22 GMT 2026
On Mon, Feb 02, 2026 at 08:11:07AM +0100, Jan Beulich wrote:
> On 31.01.2026 01:46, Alan Modra wrote:
> > --- a/ld/Makefile.am
> > +++ b/ld/Makefile.am
> > @@ -658,13 +658,18 @@ ld_new_LDADD = $(EMULATION_OFILES) $(EMUL_EXTRA_OFILES) $(BFDLIB) $(LIBCTF) \
> > # Dependency tracking for the generated emulation files.
> > EXTRA_ld_new_SOURCES += $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES)
> >
> > +# The standard rule plus set up a symlink when --enable-shared for "make chcek"
> > +ld-new$(EXEEXT): $(ld_new_OBJECTS) $(ld_new_DEPENDENCIES) $(EXTRA_ld_new_DEPENDENCIES)
> > + @rm -f ld-new$(EXEEXT)
> > + $(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 .
>
> Oh, interesting: You can add a rule here and automake will then be smart enough
> to not emit the default rule. Good to know.
>
> One small issue though: I think the symlink creation wants to move ahead of the
> linking, or else if you interrupt the build at the "right" point (or, pretty
> unlikely, the symlink creation actually fails), re-running make without having
> made any other changes would result in a no-op, i.e. the missing symlink not
> being created.
>
> I also don't think the testing for the existence of ld-new really should be here.
> It may have made a little bit of sense in the check-DEJAGNU rule, yet even there
> it was already questionable. (Additionally it was lacking $(EXEEXT) afaict.)
>
> If you agree, I can certainly make a follow-on patch.
You're welcome to improve any of my patches!
--
Alan Modra
More information about the Binutils
mailing list