[PATCH] ld: Append LDFLAGS to flags variable in default_ld_link
Maciej W. Rozycki
macro@orcam.me.uk
Mon Apr 27 23:34:00 GMT 2026
On Mon, 27 Apr 2026, John David Anglin wrote:
> ld: Append LDFLAGS to flags variable in default_ld_link
>
> The following change is needed to fix errors trying to load the
> milli.a archive for the hppa*64*-*-hpux* target when the host
> system isn't hpux.
>
> We need to create a dummy milli.a archive for this target and
> append the directory of this archive to LDFLAGS.
>
> This assumes the testsuite takes the LDFLAGS environment variable
> into account. However, some tests in the ld testsuite use the
> low-level `ld-link' procedure and it fails to take LDFLAGS into
> account.
>
> This change modifies the `default_ld_link' procedure to append
> $LDFLAGS to the flags variable and fix the above issue.
>
> This change potentially affects the `alpha*-*-*vms*' target but
> currently no tests run for it make direct use of `ld-link'.
Technically this is a fix to the testsuite/lib/ld-lib.exp part of commit
740341b9be65 ("Provide dummy libraries for alpha-vms"), so as I previously
suggested can you please combine your update with the removal of $LDFLAGS
propagation from `run_ld_link_tests' (and now that I've double-checked
said commit, also other places such as `section_check') and mention it in
the description that this is so that $LDFLAGS is taken into account with
all linker invocations rather than the chosen ones only? Or do you have
reasons you'd rather not to?
Alan: do you agree that this approach makes more sense? We have numerous
`ld_link' invocations across the test framework, a few of which only get
LDFLAGS passed and all would otherwise have to be updated and any new ones
arranged accordingly. While one can argue this is an incompatible change,
because `default_ld_link' can be overridden and therefore people's setups
out there will have to be updated accordingly, it seems to me in line with
its sibling handlers such as `default_ld_assemble' or `default_ld_compile'
which use analogous variables such as $ASFLAGS or $CFLAGS_FOR_TARGET, so
that will be consistent with what we already have anyway.
NB `ld_link' rather than `ld-link' please.
Maciej
More information about the Binutils
mailing list