binutils-gdb/ld/testsuite/ld-mips-elf/unaligned-insn.s

16 lines
165 B
ArmAsm
Raw Normal View History

MIPS/BFD: Report `bfd_reloc_outofrange' errors as such A `bfd_reloc_outofrange' condition from `mips_elf_calculate_relocation' currently triggers the warning callback, which in the case of LD prints messages like: foo.o: In function `foo': (.text+0x0): warning: JALX to a non-word-aligned address or: foo.o: In function `foo': (.text+0x0): warning: PC-relative load from unaligned address and nothing else, which suggests this is a benign condition and link has otherwise successfully run to completion. This is however not the case, the link terminates right away with no further messages and no output produced. Use the general error or warning info callback then, preserving the message format. Also set a BFD error condition so that a failure is unambiguously reported. Complement the change with a set of suitable test suite additions. bfd/ * elfxx-mips.c (_bfd_mips_elf_relocate_section) <bfd_reloc_outofrange>: Call `->einfo' rather than `->warning'. Call `bfd_set_error'. ld/ * testsuite/ld-mips-elf/unaligned-jalx-0.d: New test. * testsuite/ld-mips-elf/unaligned-jalx-1.d: New test. * testsuite/ld-mips-elf/unaligned-jalx-2.d: New test. * testsuite/ld-mips-elf/unaligned-jalx-mips16-0.d: New test. * testsuite/ld-mips-elf/unaligned-jalx-mips16-1.d: New test. * testsuite/ld-mips-elf/unaligned-jalx-mips16-2.d: New test. * testsuite/ld-mips-elf/unaligned-jalx-micromips-0.d: New test. * testsuite/ld-mips-elf/unaligned-jalx-micromips-1.d: New test. * testsuite/ld-mips-elf/unaligned-jalx-micromips-2.d: New test. * testsuite/ld-mips-elf/unaligned-lwpc-0.d: New test. * testsuite/ld-mips-elf/unaligned-lwpc-1.d: New test. * testsuite/ld-mips-elf/unaligned-lwpc-2.d: New test. * testsuite/ld-mips-elf/unaligned-lwpc-3.d: New test. * testsuite/ld-mips-elf/unaligned-ldpc-0.d: New test. * testsuite/ld-mips-elf/unaligned-ldpc-1.d: New test. * testsuite/ld-mips-elf/unaligned-ldpc-2.d: New test. * testsuite/ld-mips-elf/unaligned-ldpc-3.d: New test. * testsuite/ld-mips-elf/unaligned-ldpc-4.d: New test. * testsuite/ld-mips-elf/unaligned-jalx-0.s: New test source. * testsuite/ld-mips-elf/unaligned-jalx-1.s: New test source. * testsuite/ld-mips-elf/unaligned-jalx-2.s: New test source. * testsuite/ld-mips-elf/unaligned-insn.s: New test source. * testsuite/ld-mips-elf/unaligned-lwpc-0.s: New test source. * testsuite/ld-mips-elf/unaligned-lwpc-1.s: New test source. * testsuite/ld-mips-elf/unaligned-lwpc-2.s: New test source. * testsuite/ld-mips-elf/unaligned-lwpc-3.s: New test source. * testsuite/ld-mips-elf/unaligned-ldpc-0.s: New test source. * testsuite/ld-mips-elf/unaligned-ldpc-1.s: New test source. * testsuite/ld-mips-elf/unaligned-ldpc-2.s: New test source. * testsuite/ld-mips-elf/unaligned-ldpc-3.s: New test source. * testsuite/ld-mips-elf/unaligned-ldpc-4.s: New test source. * testsuite/ld-mips-elf/unaligned-syms.s: New test source. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
2016-05-25 21:59:37 +02:00
.macro sym n:req
.if \n
.globl bar\@
.type bar\@, @function
bar\@ :
.insn
.hword 0
.size bar\@, . - bar\@
sym \n - 1
.endif
.endm
.text
.align 4
sym 8