aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-06-12 16:29:05 +0930
committerAlan Modra <amodra@gmail.com>2022-06-14 10:03:55 +0930
commitd712f2768ac5e71027657d85b921fc0e85d94bcd (patch)
tree5725d2e6d081faee5bc818e5c65af4dfa908a16d /bfd
parent5f269b46201975658dc5f4218acc6d836fa12ab6 (diff)
downloadgdb-d712f2768ac5e71027657d85b921fc0e85d94bcd.zip
gdb-d712f2768ac5e71027657d85b921fc0e85d94bcd.tar.gz
gdb-d712f2768ac5e71027657d85b921fc0e85d94bcd.tar.bz2
BFD_RELOC_MIPS_16
MIPS should not be using BFD_RELOC_16 for its R_MIPS_16 relocation, since R_MIPS_16 specifies a 16-bit field in a 32-bit word. BFD_RELOC_16, emitted by generic code to handle fixups on 16-bit data directives, expects fixups to operate on the whole of a 16-bit word. This patch corrects the problem by using BFD_RELOC_MIPS_16, a new bfd reloc that is used to generate R_MIPS_16. BFD_RELOC_16 is handled in md_apply_fix for cases where the fixup can be applied at assembly time. Like BFD_RELOC_8, BFD_RELOC_16 now has no corresponding object file relocation, and thus .half, .hword, .short and .dc.w must be resolved at assembly time. BFD_RELOC_MIPS_REL16 is removed by this patch since it isn't used. PR 3243 PR 26542 * reloc.c (BFD_RELOC_MIPS_16): Rename from BFD_RELOC_MIPS_REL16. * elf32-mips.c (mips_reloc_map): Map BFD_RELOC_MIPS_16 to R_MIPS_16. * elf64-mips.c (mips_reloc_map): Likewise, delete BFD_RELOC_MIPS_REL16. * elfn32-mips.c (mips_reloc_map): Likewise. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. gas/ * config/tc-mips.c (append_insn): Handle BFD_RELOC_MIPS_16. (macro_build): Likewise. (mips_percent_op <%half>): Generate BFD_RELOC_MIPS_16. (md_apply_fix): Handle BFD_RELOC_16 and BFD_RELOC_MIPS_16 when fx_done. ld/ * testsuite/ld-mips-elf/reloc-local-overflow.d, * testsuite/ld-mips-elf/reloc-local-overflow.s: Rewrite.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/bfd-in2.h2
-rw-r--r--bfd/elf32-mips.c2
-rw-r--r--bfd/elf64-mips.c3
-rw-r--r--bfd/elfn32-mips.c3
-rw-r--r--bfd/libbfd.h2
-rw-r--r--bfd/reloc.c2
6 files changed, 6 insertions, 8 deletions
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 64e74ad..14d3763 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -2611,7 +2611,7 @@ to compensate for the borrow when the low bits are added. */
BFD_RELOC_MICROMIPS_HIGHER,
BFD_RELOC_MIPS_SCN_DISP,
BFD_RELOC_MICROMIPS_SCN_DISP,
- BFD_RELOC_MIPS_REL16,
+ BFD_RELOC_MIPS_16,
BFD_RELOC_MIPS_RELGOT,
BFD_RELOC_MIPS_JALR,
BFD_RELOC_MICROMIPS_JALR,
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index b08c27e..b611515 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -1978,7 +1978,7 @@ struct elf_reloc_map {
static const struct elf_reloc_map mips_reloc_map[] =
{
{ BFD_RELOC_NONE, R_MIPS_NONE },
- { BFD_RELOC_16, R_MIPS_16 },
+ { BFD_RELOC_MIPS_16, R_MIPS_16 },
{ BFD_RELOC_32, R_MIPS_32 },
/* There is no BFD reloc for R_MIPS_REL32. */
{ BFD_RELOC_64, R_MIPS_64 },
diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c
index a97f422..8097e7c 100644
--- a/bfd/elf64-mips.c
+++ b/bfd/elf64-mips.c
@@ -3683,7 +3683,7 @@ struct elf_reloc_map {
static const struct elf_reloc_map mips_reloc_map[] =
{
{ BFD_RELOC_NONE, R_MIPS_NONE },
- { BFD_RELOC_16, R_MIPS_16 },
+ { BFD_RELOC_MIPS_16, R_MIPS_16 },
{ BFD_RELOC_32, R_MIPS_32 },
/* There is no BFD reloc for R_MIPS_REL32. */
{ BFD_RELOC_64, R_MIPS_64 },
@@ -3713,7 +3713,6 @@ static const struct elf_reloc_map mips_reloc_map[] =
{ BFD_RELOC_MIPS_CALL_HI16, R_MIPS_CALL_HI16 },
{ BFD_RELOC_MIPS_CALL_LO16, R_MIPS_CALL_LO16 },
{ BFD_RELOC_MIPS_SCN_DISP, R_MIPS_SCN_DISP },
- { BFD_RELOC_MIPS_REL16, R_MIPS_REL16 },
/* Use of R_MIPS_ADD_IMMEDIATE and R_MIPS_PJUMP is deprecated. */
{ BFD_RELOC_MIPS_RELGOT, R_MIPS_RELGOT },
{ BFD_RELOC_MIPS_JALR, R_MIPS_JALR },
diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c
index 2027230..7cae394 100644
--- a/bfd/elfn32-mips.c
+++ b/bfd/elfn32-mips.c
@@ -3513,7 +3513,7 @@ struct elf_reloc_map {
static const struct elf_reloc_map mips_reloc_map[] =
{
{ BFD_RELOC_NONE, R_MIPS_NONE },
- { BFD_RELOC_16, R_MIPS_16 },
+ { BFD_RELOC_MIPS_16, R_MIPS_16 },
{ BFD_RELOC_32, R_MIPS_32 },
/* There is no BFD reloc for R_MIPS_REL32. */
{ BFD_RELOC_CTOR, R_MIPS_32 },
@@ -3543,7 +3543,6 @@ static const struct elf_reloc_map mips_reloc_map[] =
{ BFD_RELOC_MIPS_CALL_HI16, R_MIPS_CALL_HI16 },
{ BFD_RELOC_MIPS_CALL_LO16, R_MIPS_CALL_LO16 },
{ BFD_RELOC_MIPS_SCN_DISP, R_MIPS_SCN_DISP },
- { BFD_RELOC_MIPS_REL16, R_MIPS_REL16 },
/* Use of R_MIPS_ADD_IMMEDIATE and R_MIPS_PJUMP is deprecated. */
{ BFD_RELOC_MIPS_RELGOT, R_MIPS_RELGOT },
{ BFD_RELOC_MIPS_JALR, R_MIPS_JALR },
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index 8c02e29..4a3020c 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -1285,7 +1285,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_MICROMIPS_HIGHER",
"BFD_RELOC_MIPS_SCN_DISP",
"BFD_RELOC_MICROMIPS_SCN_DISP",
- "BFD_RELOC_MIPS_REL16",
+ "BFD_RELOC_MIPS_16",
"BFD_RELOC_MIPS_RELGOT",
"BFD_RELOC_MIPS_JALR",
"BFD_RELOC_MICROMIPS_JALR",
diff --git a/bfd/reloc.c b/bfd/reloc.c
index 76c309b..eb8dba3 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -2293,7 +2293,7 @@ ENUMX
ENUMX
BFD_RELOC_MICROMIPS_SCN_DISP
ENUMX
- BFD_RELOC_MIPS_REL16
+ BFD_RELOC_MIPS_16
ENUMX
BFD_RELOC_MIPS_RELGOT
ENUMX