MIPS/BFD: Move attribute check after ELF file header flag check
authorMaciej W. Rozycki <macro@imgtec.com>
Mon, 4 Jan 2016 23:30:00 +0000 (23:30 +0000)
committerMaciej W. Rozycki <macro@imgtec.com>
Mon, 4 Jan 2016 23:30:00 +0000 (23:30 +0000)
commitd537eeb527bb80fb791d22a7eedec245856b9d35
tree662e3b839feee9b1ef630b85561d129bb493c6de
parent43d223b5430a93dc0d777276471128800b9887cf
MIPS/BFD: Move attribute check after ELF file header flag check

We have a problem in that in making compatibility checks while merging
private BFD data on the MIPS target we give priority to the attribute
check, which may fail and cause the function to abort early on.  The
problem with this is the ABI compatibility aspect recorded in the
attributes is relatively minor compared to aspects recorded in the ELF
file header.  However the premature exit causes any more important
compatibility aspect violated to be masked and not reported to the user
once a problem with attributes has been noticed.

So move the attribute check after the ELF file header flag check in
`_bfd_mips_elf_merge_private_bfd_data', and do not return prematurely
there.  Take advantage of the resulting grouping of ELF file header
handling together and remove the premature success return point for the
first input object being handled, letting the code later on figure out
output ABI flags even for this object.

Update LD test cases according to messages from ELF file header checks
now preceding ones from attribute checks.

bfd/
* elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Move
attribute check after ELF file header flag check.

ld/
* testsuite/ld-mips-elf/attr-gnu-4-14.d: Update the order of
messages expected according to MIPS BFD private data merge
changes.
* testsuite/ld-mips-elf/attr-gnu-4-24.d: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-34.d: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-41.d: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-42.d: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-43.d: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-45.d: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-46.d: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-47.d: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-48.d: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-49.d: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-54.d: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-64.d: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-74.d: Likewise.
17 files changed:
bfd/ChangeLog
bfd/elfxx-mips.c
ld/ChangeLog
ld/testsuite/ld-mips-elf/attr-gnu-4-14.d
ld/testsuite/ld-mips-elf/attr-gnu-4-24.d
ld/testsuite/ld-mips-elf/attr-gnu-4-34.d
ld/testsuite/ld-mips-elf/attr-gnu-4-41.d
ld/testsuite/ld-mips-elf/attr-gnu-4-42.d
ld/testsuite/ld-mips-elf/attr-gnu-4-43.d
ld/testsuite/ld-mips-elf/attr-gnu-4-45.d
ld/testsuite/ld-mips-elf/attr-gnu-4-46.d
ld/testsuite/ld-mips-elf/attr-gnu-4-47.d
ld/testsuite/ld-mips-elf/attr-gnu-4-48.d
ld/testsuite/ld-mips-elf/attr-gnu-4-49.d
ld/testsuite/ld-mips-elf/attr-gnu-4-54.d
ld/testsuite/ld-mips-elf/attr-gnu-4-64.d
ld/testsuite/ld-mips-elf/attr-gnu-4-74.d