mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-06 12:09:26 +08:00
7d81bc937c
Link-time relaxations of branches are common for MSP430, given that GCC can generate pessimal branch instructions, and the -mcode-region=either/-mdata-region=either options to shuffle sections can further change the type of branch instruction required. These relaxations can result in invalid code when .uleb128 directives, used in the .gcc_except_table section, are used to calculate the distance between two labels. A value for the .uleb128 directive is calculated at assembly-time, and can't be updated at link-time, even if relaxation causes the distance between the labels to change. This patch adds relocations for subtract expressions in .uleb128 directives, to allow the linker to re-calculate the value of these expressions after relaxation has been performed. bfd/ChangeLog: * bfd-in2.h (bfd_reloc_code_real): Add BFD_RELOC_MSP430_{SET,SUB}_ULEB128. * elf32-msp430.c (msp430_elf_ignore_reloc): New. (elf_msp430_howto_table): Add R_MSP430{,X}_GNU_{SET,SUB}_ULEB128. (msp430_reloc_map): Add R_MSP430_GNU_{SET,SUB}_ULEB128. (msp430x_reloc_map): Add R_MSP430X_GNU_{SET,SUB}_ULEB128. (write_uleb128): New. (msp430_final_link_relocate): Handle R_MSP430{,X}_GNU_{SET,SUB}_ULEB128. * libbfd.c (_bfd_write_unsigned_leb128): New. * libbfd.h (_bfd_write_unsigned_leb128): New prototype. Add BFD_RELOC_MSP430_{SET,SUB}_ULEB128. * reloc.c: Document BFD_RELOC_MSP430_{SET,SUB}_ULEB128. binutils/ChangeLog: * readelf.c (target_specific_reloc_handling): Handle R_MSP430{,X}_GNU_{SET,SUB}_ULEB128. gas/ChangeLog: * config/tc-msp430.c (msp430_insert_uleb128_fixes): New. (msp430_md_end): Call msp430_insert_uleb128_fixes. include/ChangeLog: * elf/msp430.h (elf_msp430_reloc_type): Add R_MSP430_GNU_{SET,SUB}_ULEB128. (elf_msp430x_reloc_type): Add R_MSP430X_GNU_{SET,SUB}_ULEB128. ld/ChangeLog: * testsuite/ld-msp430-elf/msp430-elf.exp: Run new tests. * testsuite/ld-msp430-elf/uleb128.s: New test. * testsuite/ld-msp430-elf/uleb128_430.d: New test. * testsuite/ld-msp430-elf/uleb128_430x.d: New test. |
||
---|---|---|
.. | ||
attr-gnu-main.s | ||
attr-gnu-obj.s | ||
attr-gnu-region-lower-upper.d | ||
attr-gnu-region-lower.d | ||
attr-gnu-region-upper.d | ||
finiarray-warn.ld | ||
finiarray-warn.r | ||
initarray-nowarn.ld | ||
initarray-nowarn.r | ||
initarray-warn.ld | ||
initarray-warn.r | ||
initarray.s | ||
main-bss-lower.d | ||
main-bss-upper.d | ||
main-const-lower.d | ||
main-const-upper.d | ||
main-text-lower.d | ||
main-text-upper.d | ||
main-var-lower.d | ||
main-var-upper.d | ||
main-with-data-bss-unique-sec.s | ||
main-with-data-bss.s | ||
main-with-text-rodata-unique-sec.s | ||
main-with-text-rodata.s | ||
msp430-elf.exp | ||
msp430-no-lower.ld | ||
msp430-tiny-ram.ld | ||
msp430-tiny-rom.ld | ||
msp430.ld | ||
preinitarray-warn.ld | ||
preinitarray-warn.r | ||
reloc-lo-430x.s | ||
uleb128_430.d | ||
uleb128_430x.d | ||
uleb128.s | ||
upper-input-sections.s | ||
valid-map-foo.s | ||
valid-map.d | ||
valid-map.map | ||
valid-map.s | ||
warn-no-lower-code.r | ||
warn-no-lower-data.r | ||
warn-no-lower.r | ||
warn-no-lower.s |