aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-mips.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2024-03-02 08:10:34 +1030
committerAlan Modra <amodra@gmail.com>2024-04-04 21:02:40 +1030
commitf38e9921479a00b4e7a72a79088106859ec5fabc (patch)
tree770cb5581e3cf393fbe451e82c53296001b3fe3f /bfd/elf32-mips.c
parentfab240554b76603775e8a0fec45c8b5808380684 (diff)
downloadgdb-f38e9921479a00b4e7a72a79088106859ec5fabc.zip
gdb-f38e9921479a00b4e7a72a79088106859ec5fabc.tar.gz
gdb-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/elf32-mips.c')
-rw-r--r--bfd/elf32-mips.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index f97986c..bec7a20 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -404,7 +404,7 @@ static reloc_howto_type elf_mips_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 */
@@ -454,7 +454,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] =
/* 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 */
@@ -469,7 +469,7 @@ static reloc_howto_type elf_mips_howto_table_rel[] =
/* 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 */
@@ -484,7 +484,7 @@ static reloc_howto_type elf_mips_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 */
@@ -612,7 +612,7 @@ static reloc_howto_type elf_mips_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 */
@@ -632,7 +632,7 @@ static reloc_howto_type elf_mips_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 */
@@ -674,7 +674,7 @@ static reloc_howto_type elf_mips_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 */
@@ -694,7 +694,7 @@ static reloc_howto_type elf_mips_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 */
@@ -955,7 +955,7 @@ static reloc_howto_type elf_mips16_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 */
@@ -975,7 +975,7 @@ static reloc_howto_type elf_mips16_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 */
@@ -1000,7 +1000,7 @@ static reloc_howto_type elf_mips16_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 */
@@ -1020,7 +1020,7 @@ static reloc_howto_type elf_mips16_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 */
@@ -1251,7 +1251,7 @@ static reloc_howto_type elf_micromips_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 */
@@ -1296,7 +1296,7 @@ static reloc_howto_type elf_micromips_howto_table_rel[] =
/* 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 */
@@ -1311,7 +1311,7 @@ static reloc_howto_type elf_micromips_howto_table_rel[] =
/* 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 */
@@ -1326,7 +1326,7 @@ static reloc_howto_type elf_micromips_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 */
@@ -1438,7 +1438,7 @@ static reloc_howto_type elf_micromips_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 */
@@ -1458,7 +1458,7 @@ static reloc_howto_type elf_micromips_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 */
@@ -1486,7 +1486,7 @@ static reloc_howto_type elf_micromips_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 */
@@ -1506,7 +1506,7 @@ static reloc_howto_type elf_micromips_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 */