MIPS reloc howto special_function entries
Maciej W. Rozycki
macro@orcam.me.uk
Sat Jul 12 00:35:04 GMT 2025
On Tue, 2 Apr 2024, Alan Modra wrote:
> This corrects the DTPREL_HI16/LO16 and TPREL_HI16/LO16 howtos to use
> _bfd_mips_elf_{hi,lo}16_reloc special functions, in order to support
> addends outside the range [0,32767] on these relocations.
>
> R_MIPS_GOT_HI16, R_MIPS_GOT_LO16, R_MIPS_CALL_HI16 and R_MIPS_CALL_LO16
> are left alone as it seems that we (quite reasonably) only support
> zero addends for those relocs.
I have now pushed this part of your change as well.
I've made small tweaks here:
> diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
> index 2ddbf0c768d..2977710804d 100644
> --- a/gas/testsuite/gas/mips/mips.exp
> +++ b/gas/testsuite/gas/mips/mips.exp
> @@ -1567,6 +1567,9 @@ if { [istarget mips*-*-vxworks*] } {
> if $has_newabi { run_dump_test "cfi-n64-1" }
>
> run_dump_test "pr12915"
> +
> + run_dump_test_arches pr19977 [mips_arch_list_all]
> +
-- to keep formatting consistent with the rest of the file.
> diff --git a/gas/testsuite/gas/mips/pr19977.s b/gas/testsuite/gas/mips/pr19977.s
> new file mode 100644
> index 00000000000..403f60937a9
> --- /dev/null
> +++ b/gas/testsuite/gas/mips/pr19977.s
> @@ -0,0 +1,13 @@
> + .text
> +foo:
> + li $3,%tprel_hi($loc0+0x11229988)
> + sll $3,16
> + addiu $3,%tprel_lo($loc0+0x11229988)
> +
> + li $3,%dtprel_hi($loc0+0x11229988)
> + sll $3,16
> + addiu $3,%dtprel_lo($loc0+0x11229988)
> +
> + .section .tdata,"awT",%progbits
> +$loc0:
> + .word 0
I have also expanded the sequences used here with expressions producing
section-relative relocations. This does not matter much for assembly, but
triggers a different path in relocatable links and will be used with the
final change from this series.
Thank you for your contribution.
Maciej
More information about the Binutils
mailing list