ld: Fix several 32-bit SPARC plugin tests
Several ld plugin tests currently FAIL on 32-bit Solaris/SPARC:
FAIL: load plugin with source
FAIL: plugin claimfile lost symbol with source
FAIL: plugin claimfile replace symbol with source
FAIL: plugin claimfile resolve symbol with source
FAIL: plugin claimfile replace file with source
FAIL: plugin set symbol visibility with source
FAIL: plugin ignore lib with source
FAIL: plugin claimfile replace lib with source
FAIL: plugin 2 with source lib
FAIL: load plugin 2 with source
FAIL: load plugin 2 with source and -r
FAIL: plugin 3 with source lib
FAIL: load plugin 3 with source
FAIL: load plugin 3 with source and -r
FAIL: PR ld/20070
all of them in the same way:
./ld-new: BFD (GNU Binutils) 2.34.50.
20200328 internal error, aborting at /vol/src/gnu/binutils/hg/master/git/bfd/elf32-sparc.c:154 in sparc_final_write_processing
This happens when bfd_get_mach returns 0 when abfd refers to a source
file:
$11 = {
filename = 0x28c358 "/vol/src/gnu/binutils/hg/master/local/ld/testsuite/ld-plugin/func.c (symbol from plugin)", xvec = 0x24ed6c <sparc_elf32_sol2_vec>,
[...]
While I could find no specification what abfd's are allowed/expected in
*_final_write_processing, I could find no other target that behaved the
same. And indeed ignoring the 0 case fixes the failures. The code now
errors for other values. 64-bit SPARC is not affected because it doesn't
have a specific implementation of elf_backend_final_write_processing.
Tested on sparc-sun-solaris2.11.
2020-04-07 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Nick Clifton <nickc@redhat.com>
* elf32-sparc.c (sparc_final_write_processing): Fix whitespace.
<0>: Ignore.
<default>: Error rather than abort.