configure: Use LDFLAGS when trying linkers
A user may configure LDFLAGS
but not LD
. When choosing a linker, we
will prefer ldd
, then ld.gold
, then ld.bfd
-- however, we have to
check for a working linker. If either of these fail, we try the next in
line.
However, we were not considering the $LDFLAGS
when checking if these
linkers worked. So we would pick a linker that does not support the
current $LDFLAGS and fail further down the line when we used that linker
with those flags.
Fixes #24565 (closed), where LDFLAGS=-Wl,-z,pack-relative-relocs
is not
supported by ld.gold
but that was being picked still.