diff options
| author | Alan Modra <amodra@gmail.com> | 2026-02-20 17:29:50 +0000 |
|---|---|---|
| committer | Maciej W. Rozycki <macro@redhat.com> | 2026-02-20 17:29:50 +0000 |
| commit | 95d96d49d039a31e8062f032bc24585aeaf85657 (patch) | |
| tree | 3c5ec117563478bd2bfdff98831eb623578e6b49 /ld | |
| parent | 1dbbff036491f3277fefb6ffba95edaa02a9a3b8 (diff) | |
| download | fsf-binutils-gdb-95d96d49d039a31e8062f032bc24585aeaf85657.tar.gz fsf-binutils-gdb-95d96d49d039a31e8062f032bc24585aeaf85657.tar.bz2 fsf-binutils-gdb-95d96d49d039a31e8062f032bc24585aeaf85657.zip | |
BFD: Correct archive format determination for non-default link emulations
Fix an issue with archive format determination coming from commit
b228303dd14e ("PR binutils/13278: --plugin doesn't work on archive"),
<https://inbox.sourceware.org/binutils/20111011064345.GM25970@bubble.grove.modra.org/>,
causing the default link emulation to be used despite archive members
being in another object format and consequently triggering segmentation
faults in `cris-aout' LD with the default (`crisaout') emulation where
archive members are in the ELF format.
Address the issue by always checking the format of the first member of
an archive even if no default target has been specified, except when the
target being checked against is be the plugin target. Verified by hand
and the `powerpc64le-linux-gnu' target to cause no issue with the recipe
in PR binutils/13278 and removing failures from segmentation faults with
the new tests:
cris-aout -FAIL: CRIS regular archive link (implicit emulation)
cris-aout -FAIL: CRIS thin archive link (implicit emulation)
Co-Authored-By: Maciej W. Rozycki <macro@redhat.com>
Diffstat (limited to 'ld')
| -rw-r--r-- | ld/testsuite/ld-cris/archive.exp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/ld/testsuite/ld-cris/archive.exp b/ld/testsuite/ld-cris/archive.exp index b5eb28bd56a..12768e80458 100644 --- a/ld/testsuite/ld-cris/archive.exp +++ b/ld/testsuite/ld-cris/archive.exp @@ -82,6 +82,14 @@ run_ld_link_tests [list \ {nm "" ../ld-archive/nx.nd}} \ "abcx" \ ] \ + [list "CRIS regular archive link (implicit emulation)" \ + "-e ff" "tmpdir/ab.a --verbose --print-map" \ + "$asemul" {../ld-archive/abc.s} \ + {{ld ../ld-archive/abc.vd} \ + {nm "" ../ld-archive/abc.nd} \ + {nm "" ../ld-archive/nx.nd}} \ + "abci" \ + ] \ ] # PR binutils/33485 hits with the aout archive format and with this # test that format is used with non-aout targets, hence the reverse @@ -99,3 +107,19 @@ run_ld_link_tests [list \ "abtcx" \ ] \ ] +# PR binutils/33485 hits with the aout archive format and with this +# test that format is used with non-aout targets, hence the reverse +# condition. Cf. the note at the top. +if { ![istarget cris-*-*aout*] } { + setup_xfail "binutils/33485" "*-*-*" +} +run_ld_link_tests [list \ + [list "CRIS thin archive link (implicit emulation)" \ + "-e ff" "tmpdir/abt.a --verbose --print-map" \ + "$asemul" {../ld-archive/abc.s} \ + {{ld ../ld-archive/abtc.vd} \ + {nm "" ../ld-archive/abc.nd} \ + {nm "" ../ld-archive/nx.nd}} \ + "abtci" \ + ] \ +] |
