Fix binary compatibility between GCC and the TI compiler for the PRU target.
authorDimitar Dimitrov <dimitar@dinux.eu>
Wed, 9 May 2018 10:39:32 +0000 (11:39 +0100)
committerNick Clifton <nickc@redhat.com>
Wed, 9 May 2018 10:39:32 +0000 (11:39 +0100)
commit493ffac5aad8c39215702435c2506fd4d3077191
treed481a149cbadab37e15ad1fc5300a109fe4d3640
parent84f9f8c33021593afd79fc89cc419db44f7bc112
Fix binary compatibility between GCC and the TI compiler for the PRU target.

My original implementation for LDI32 pseudo does not conform to
the TI ABI.  I wrongly documented my TI PRU ELF object files inspection,
which got propagated into my binutils implementation.

Issue was exposed when running the GCC ABI testsuite against TI toolchain.
According to TI ABI, LDI32 must use first LDI instruction to load
the MSB 16bits, and second LDI instruction for the LSB 16bits.

This patch will break binary compatibility with previously released
binutils versions for PRU. Still, I think it is better to fix
binutils to conform to the chip vendor ABI.

bfd * elf32-pru.c (pru_elf32_do_ldi32_relocate): Make LDI32 relocation
conformant to TI ABI.
(pru_elf32_relax_section): Likewise.
(pru_elf_relax_delete_bytes): Fix offsets for new LDI32 code.
* elf32-pru.c (pru_elf32_do_ldi32_relocate): Ignore addend.
(pru_elf32_pmem_relocate): Trap - should not get here.
(pru_elf32_relocate_section): Add support for REL relocations.
(elf_info_to_howto_rel): Enable REL.
(elf_backend_may_use_rel_p): Likewise.
(elf_backend_may_use_rela_p): Likewise.
(elf_backend_default_use_rela_p): Likewise.

gas * config/tc-pru.c (md_apply_fix): Make LDI32 relocation conformant
to TI ABI.
(pru_assemble_arg_i): Likewise.
(output_insn_ldi32): Likewise.
* testsuite/gas/pru/ldi.d: Update test for the now fixed LDI32.
* gas/config/tc-pru.c (pru_assemble_arg_b): Check imm8 operand range.
* gas/testsuite/gas/pru/illegal2.l: New test.
* gas/testsuite/gas/pru/illegal2.s: New test.
* gas/testsuite/gas/pru/pru.exp: Register new illegal2 test.

ld * scripttempl/pru.sc: Add LD sections to allow linking TI
toolchain object files.
* scripttempl/pru.sc: Switch to init_array.
* testsuite/ld-pru/ldi32.d: Update LDI32 test to conform to TI ABI.
* testsuite/ld-pru/norelax_ldi32-data.d: Likewise.
* testsuite/ld-pru/norelax_ldi32-dis.d: Likewise.
* testsuite/ld-pru/relax_ldi32-data.d: Likewise.
* testsuite/ld-pru/relax_ldi32-dis.d: Likewise.
15 files changed:
bfd/ChangeLog
bfd/elf32-pru.c
gas/ChangeLog
gas/config/tc-pru.c
gas/testsuite/gas/pru/illegal2.l [new file with mode: 0644]
gas/testsuite/gas/pru/illegal2.s [new file with mode: 0644]
gas/testsuite/gas/pru/ldi.d
gas/testsuite/gas/pru/pru.exp
ld/ChangeLog
ld/scripttempl/pru.sc
ld/testsuite/ld-pru/ldi32.d
ld/testsuite/ld-pru/norelax_ldi32-data.d
ld/testsuite/ld-pru/norelax_ldi32-dis.d
ld/testsuite/ld-pru/relax_ldi32-data.d
ld/testsuite/ld-pru/relax_ldi32-dis.d
This page took 0.02799 seconds and 4 git commands to generate.