[Commit]: AArch64: Refuse to link when unresolveable relocs are encountered
Nick Clifton
nickc@redhat.com
Thu Oct 12 12:36:00 GMT 2017
Hi Guys,
I am checking in the patch below to fix a problem recently encountered
with the AArch64 linker. It would report unresolvable relocs but
then continue to produce a (non-working) binary with no error code.
The problem turns out to be the AArch64 final_link_relocate function,
which was reporting the error but then returning a value of FALSE.
Since the final_link_relocate functions return a bfd_reloc_status_type
and a value of 0 corresponds to bfd_reloc_ok, the generic parts of the
linker assumed that everything was OK.
As well as fixing this issue in the AArch64 backend I have also taken
the liberty of changing the starting value of the bfd_reloc_status
enum so that TRUE and FALSE are no longer valid members of this enum.
I could not find a way to have the compiler automatically detect and
report when these unsupported values were used, but maybe that will
come in the future.
Cheers
Nick
bfd/ChangeLog
2017-10-12 Nick Clifton <nickc@redhat.com>
* reloc.c (enum bfd_reloc_status): Start values at 2.
* bfd-in2.h: Regenerate.
* elfnn-arch64.c (aarch64_relocate): Invert sense of function, so
that a TRUE return indicates success. Compare the result of
calling _bfd_aarch64_elf_put_addend against bfd_reloc_ok.
(build_one_stub): Change sense of tests against aarch64_relocate
return value.
(elfNN_aarch64_tls_relax): Return bfd_reloc_notsupported, rather
than FALSE, when an error is detected.
(elfNN_aarch64_final_link_relocate): Likewise.
ld/Changelog
2017-10-12 Nick Clifton <nickc@redhat.com>
* testsuite/ld-aarch64/pcrel_pic_defined.d: Expect errors not
warnings. Expect errors about unsupported relocations.
* testsuite/ld-aarch64/pcrel_pic_undefined.d: Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: aarch64-final-link-return-value.patch
Type: text/x-patch
Size: 8914 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20171012/1d9af426/attachment.bin>
More information about the Binutils
mailing list