aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-mips.c
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2005-02-07 02:44:59 +0000
committerMaciej W. Rozycki <macro@linux-mips.org>2005-02-07 02:44:59 +0000
commit765f2ef6956841baed46e6203a7b9be1b248285c (patch)
tree2b16e11328f25373f20edf2a18cb0c4be27b7c25 /bfd/elf32-mips.c
parent74e5ef4498ddf857524927fda93a56c5875d5adf (diff)
downloadgdb-765f2ef6956841baed46e6203a7b9be1b248285c.zip
gdb-765f2ef6956841baed46e6203a7b9be1b248285c.tar.gz
gdb-765f2ef6956841baed46e6203a7b9be1b248285c.tar.bz2
* elf32-mips.c (mips_elf_gprel32_reloc): Reject
R_MIPS_GPREL32 relocations against external symbols. * elf64-mips.c (mips_elf64_gprel32_reloc): Replace an incorrect comment.
Diffstat (limited to 'bfd/elf32-mips.c')
-rw-r--r--bfd/elf32-mips.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index 9774215..07d8ba4 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -800,6 +800,16 @@ mips_elf_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
bfd_reloc_status_type ret;
bfd_vma gp;
+ /* R_MIPS_GPREL32 relocations are defined for local symbols only. */
+ if (output_bfd != NULL
+ && (symbol->flags & BSF_SECTION_SYM) == 0
+ && (symbol->flags & BSF_LOCAL) != 0)
+ {
+ *error_message = (char *)
+ _("32bits gp relative relocation occurs for an external symbol");
+ return bfd_reloc_outofrange;
+ }
+
if (output_bfd != NULL)
relocatable = TRUE;
else