diff options
author | Alan Modra <amodra@gmail.com> | 2024-03-02 08:10:34 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2024-04-04 21:02:40 +1030 |
commit | f38e9921479a00b4e7a72a79088106859ec5fabc (patch) | |
tree | 770cb5581e3cf393fbe451e82c53296001b3fe3f /bfd/elf64-mips.c | |
parent | fab240554b76603775e8a0fec45c8b5808380684 (diff) | |
download | binutils-f38e9921479a00b4e7a72a79088106859ec5fabc.zip binutils-f38e9921479a00b4e7a72a79088106859ec5fabc.tar.gz binutils-f38e9921479a00b4e7a72a79088106859ec5fabc.tar.bz2 |
MIPS HI16 and LO16 reloc howtos
All the HI16 reloc howtos should have a rightshift of 16, and all the
LO16 relocs shouldn't complain on overflow. This was correct for
R_MIPS_LO16 and R_MIPS_LO16 (at least on the howto_table_rel entries),
and corresponding MIPS16, MICROMIPS and MIPS64 relocs, but not on many
other HI16 and LO16 relocs.
While we're at it, fix the HIGHER and HIGHEST rightshift too.
These changes are necessary to support addends outside the range
[0,32767] when those addends are stored in section contents. Note
that some of the reloc howtos changed here will always have zero
addends (GOT_HI16, CALL_HI16). Those don't really need changing, but
use what is clearly correct for hi16 relocs anyway.
PR 19977
* elf32-mips.c: Correct rightshift for HI16, HIGHER and HIGHEST
reloc howtos. Correct complain_on_overflow for LO16 relocs.
* elf64-mips.c: Likewise.
* elfn32-mips.c: Likewise.
Diffstat (limited to 'bfd/elf64-mips.c')
-rw-r--r-- | bfd/elf64-mips.c | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c index 736e5f5..afd7b30 100644 --- a/bfd/elf64-mips.c +++ b/bfd/elf64-mips.c @@ -431,7 +431,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = /* High 16 bits of displacement in global offset table. */ HOWTO (R_MIPS_GOT_HI16, /* type */ - 0, /* rightshift */ + 16, /* rightshift */ 4, /* size */ 16, /* bitsize */ false, /* pc_relative */ @@ -534,7 +534,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = /* High 16 bits of displacement in global offset table. */ HOWTO (R_MIPS_CALL_HI16, /* type */ - 0, /* rightshift */ + 16, /* rightshift */ 4, /* size */ 16, /* bitsize */ false, /* pc_relative */ @@ -691,7 +691,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = /* TLS local dynamic offset. */ HOWTO (R_MIPS_TLS_DTPREL_HI16, /* type */ - 0, /* rightshift */ + 16, /* rightshift */ 4, /* size */ 16, /* bitsize */ false, /* pc_relative */ @@ -711,7 +711,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = 16, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ + complain_overflow_dont, /* complain_on_overflow */ _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_TLS_DTPREL_LO16", /* name */ true, /* partial_inplace */ @@ -753,7 +753,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = /* TLS thread pointer offset. */ HOWTO (R_MIPS_TLS_TPREL_HI16, /* type */ - 0, /* rightshift */ + 16, /* rightshift */ 4, /* size */ 16, /* bitsize */ false, /* pc_relative */ @@ -773,7 +773,7 @@ static reloc_howto_type mips_elf64_howto_table_rel[] = 16, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ + complain_overflow_dont, /* complain_on_overflow */ _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_TLS_TPREL_LO16", /* name */ true, /* partial_inplace */ @@ -975,7 +975,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = /* High 16 bits of symbol value. */ HOWTO (R_MIPS_HI16, /* type */ - 0, /* rightshift */ + 16, /* rightshift */ 4, /* size */ 16, /* bitsize */ false, /* pc_relative */ @@ -1191,7 +1191,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = /* High 16 bits of displacement in global offset table. */ HOWTO (R_MIPS_GOT_HI16, /* type */ - 0, /* rightshift */ + 16, /* rightshift */ 4, /* size */ 16, /* bitsize */ false, /* pc_relative */ @@ -1285,7 +1285,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = /* Get the higher value of a 64 bit addend. */ HOWTO (R_MIPS_HIGHER, /* type */ - 0, /* rightshift */ + 32, /* rightshift */ 4, /* size */ 16, /* bitsize */ false, /* pc_relative */ @@ -1300,7 +1300,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = /* Get the highest value of a 64 bit addend. */ HOWTO (R_MIPS_HIGHEST, /* type */ - 0, /* rightshift */ + 48, /* rightshift */ 4, /* size */ 16, /* bitsize */ false, /* pc_relative */ @@ -1315,7 +1315,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = /* High 16 bits of displacement in global offset table. */ HOWTO (R_MIPS_CALL_HI16, /* type */ - 0, /* rightshift */ + 16, /* rightshift */ 4, /* size */ 16, /* bitsize */ false, /* pc_relative */ @@ -1472,7 +1472,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = /* TLS local dynamic offset. */ HOWTO (R_MIPS_TLS_DTPREL_HI16, /* type */ - 0, /* rightshift */ + 16, /* rightshift */ 4, /* size */ 16, /* bitsize */ false, /* pc_relative */ @@ -1492,7 +1492,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = 16, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ + complain_overflow_dont, /* complain_on_overflow */ _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_TLS_DTPREL_LO16", /* name */ false, /* partial_inplace */ @@ -1534,7 +1534,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = /* TLS thread pointer offset. */ HOWTO (R_MIPS_TLS_TPREL_HI16, /* type */ - 0, /* rightshift */ + 16, /* rightshift */ 4, /* size */ 16, /* bitsize */ false, /* pc_relative */ @@ -1554,7 +1554,7 @@ static reloc_howto_type mips_elf64_howto_table_rela[] = 16, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ + complain_overflow_dont, /* complain_on_overflow */ _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS_TLS_TPREL_LO16", /* name */ false, /* partial_inplace */ @@ -1799,7 +1799,7 @@ static reloc_howto_type mips16_elf64_howto_table_rel[] = /* MIPS16 TLS local dynamic offset. */ HOWTO (R_MIPS16_TLS_DTPREL_HI16, /* type */ - 0, /* rightshift */ + 16, /* rightshift */ 4, /* size */ 16, /* bitsize */ false, /* pc_relative */ @@ -1819,7 +1819,7 @@ static reloc_howto_type mips16_elf64_howto_table_rel[] = 16, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ + complain_overflow_dont, /* complain_on_overflow */ _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS16_TLS_DTPREL_LO16", /* name */ true, /* partial_inplace */ @@ -1844,7 +1844,7 @@ static reloc_howto_type mips16_elf64_howto_table_rel[] = /* MIPS16 TLS thread pointer offset. */ HOWTO (R_MIPS16_TLS_TPREL_HI16, /* type */ - 0, /* rightshift */ + 16, /* rightshift */ 4, /* size */ 16, /* bitsize */ false, /* pc_relative */ @@ -1864,7 +1864,7 @@ static reloc_howto_type mips16_elf64_howto_table_rel[] = 16, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ + complain_overflow_dont, /* complain_on_overflow */ _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS16_TLS_TPREL_LO16", /* name */ true, /* partial_inplace */ @@ -2015,7 +2015,7 @@ static reloc_howto_type mips16_elf64_howto_table_rela[] = /* MIPS16 TLS local dynamic offset. */ HOWTO (R_MIPS16_TLS_DTPREL_HI16, /* type */ - 0, /* rightshift */ + 16, /* rightshift */ 4, /* size */ 16, /* bitsize */ false, /* pc_relative */ @@ -2035,7 +2035,7 @@ static reloc_howto_type mips16_elf64_howto_table_rela[] = 16, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ + complain_overflow_dont, /* complain_on_overflow */ _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS16_TLS_DTPREL_LO16", /* name */ false, /* partial_inplace */ @@ -2060,7 +2060,7 @@ static reloc_howto_type mips16_elf64_howto_table_rela[] = /* MIPS16 TLS thread pointer offset. */ HOWTO (R_MIPS16_TLS_TPREL_HI16, /* type */ - 0, /* rightshift */ + 16, /* rightshift */ 4, /* size */ 16, /* bitsize */ false, /* pc_relative */ @@ -2080,7 +2080,7 @@ static reloc_howto_type mips16_elf64_howto_table_rela[] = 16, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ + complain_overflow_dont, /* complain_on_overflow */ _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS16_TLS_TPREL_LO16", /* name */ false, /* partial_inplace */ @@ -2311,7 +2311,7 @@ static reloc_howto_type micromips_elf64_howto_table_rel[] = /* High 16 bits of displacement in global offset table. */ HOWTO (R_MICROMIPS_GOT_HI16, /* type */ - 0, /* rightshift */ + 16, /* rightshift */ 4, /* size */ 16, /* bitsize */ false, /* pc_relative */ @@ -2363,7 +2363,7 @@ static reloc_howto_type micromips_elf64_howto_table_rel[] = /* High 16 bits of displacement in global offset table. */ HOWTO (R_MICROMIPS_CALL_HI16, /* type */ - 0, /* rightshift */ + 16, /* rightshift */ 4, /* size */ 16, /* bitsize */ false, /* pc_relative */ @@ -2475,7 +2475,7 @@ static reloc_howto_type micromips_elf64_howto_table_rel[] = /* TLS local dynamic offset. */ HOWTO (R_MICROMIPS_TLS_DTPREL_HI16, /* type */ - 0, /* rightshift */ + 16, /* rightshift */ 4, /* size */ 16, /* bitsize */ false, /* pc_relative */ @@ -2495,7 +2495,7 @@ static reloc_howto_type micromips_elf64_howto_table_rel[] = 16, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ + complain_overflow_dont, /* complain_on_overflow */ _bfd_mips_elf_generic_reloc, /* special_function */ "R_MICROMIPS_TLS_DTPREL_LO16", /* name */ true, /* partial_inplace */ @@ -2523,7 +2523,7 @@ static reloc_howto_type micromips_elf64_howto_table_rel[] = /* TLS thread pointer offset. */ HOWTO (R_MICROMIPS_TLS_TPREL_HI16, /* type */ - 0, /* rightshift */ + 16, /* rightshift */ 4, /* size */ 16, /* bitsize */ false, /* pc_relative */ @@ -2543,7 +2543,7 @@ static reloc_howto_type micromips_elf64_howto_table_rel[] = 16, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ + complain_overflow_dont, /* complain_on_overflow */ _bfd_mips_elf_generic_reloc, /* special_function */ "R_MICROMIPS_TLS_TPREL_LO16", /* name */ true, /* partial_inplace */ @@ -2790,7 +2790,7 @@ static reloc_howto_type micromips_elf64_howto_table_rela[] = /* High 16 bits of displacement in global offset table. */ HOWTO (R_MICROMIPS_GOT_HI16, /* type */ - 0, /* rightshift */ + 16, /* rightshift */ 4, /* size */ 16, /* bitsize */ false, /* pc_relative */ @@ -2835,7 +2835,7 @@ static reloc_howto_type micromips_elf64_howto_table_rela[] = /* Get the higher value of a 64 bit addend. */ HOWTO (R_MICROMIPS_HIGHER, /* type */ - 0, /* rightshift */ + 32, /* rightshift */ 4, /* size */ 16, /* bitsize */ false, /* pc_relative */ @@ -2850,7 +2850,7 @@ static reloc_howto_type micromips_elf64_howto_table_rela[] = /* Get the highest value of a 64 bit addend. */ HOWTO (R_MICROMIPS_HIGHEST, /* type */ - 0, /* rightshift */ + 48, /* rightshift */ 4, /* size */ 16, /* bitsize */ false, /* pc_relative */ @@ -2865,7 +2865,7 @@ static reloc_howto_type micromips_elf64_howto_table_rela[] = /* High 16 bits of displacement in global offset table. */ HOWTO (R_MICROMIPS_CALL_HI16, /* type */ - 0, /* rightshift */ + 16, /* rightshift */ 4, /* size */ 16, /* bitsize */ false, /* pc_relative */ @@ -2977,7 +2977,7 @@ static reloc_howto_type micromips_elf64_howto_table_rela[] = /* TLS local dynamic offset. */ HOWTO (R_MICROMIPS_TLS_DTPREL_HI16, /* type */ - 0, /* rightshift */ + 16, /* rightshift */ 4, /* size */ 16, /* bitsize */ false, /* pc_relative */ @@ -2997,7 +2997,7 @@ static reloc_howto_type micromips_elf64_howto_table_rela[] = 16, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ + complain_overflow_dont, /* complain_on_overflow */ _bfd_mips_elf_generic_reloc, /* special_function */ "R_MICROMIPS_TLS_DTPREL_LO16", /* name */ false, /* partial_inplace */ @@ -3025,7 +3025,7 @@ static reloc_howto_type micromips_elf64_howto_table_rela[] = /* TLS thread pointer offset. */ HOWTO (R_MICROMIPS_TLS_TPREL_HI16, /* type */ - 0, /* rightshift */ + 16, /* rightshift */ 4, /* size */ 16, /* bitsize */ false, /* pc_relative */ @@ -3045,7 +3045,7 @@ static reloc_howto_type micromips_elf64_howto_table_rela[] = 16, /* bitsize */ false, /* pc_relative */ 0, /* bitpos */ - complain_overflow_signed, /* complain_on_overflow */ + complain_overflow_dont, /* complain_on_overflow */ _bfd_mips_elf_generic_reloc, /* special_function */ "R_MICROMIPS_TLS_TPREL_LO16", /* name */ false, /* partial_inplace */ |