aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-mips.c
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2005-02-11 22:29:10 +0000
committerMaciej W. Rozycki <macro@linux-mips.org>2005-02-11 22:29:10 +0000
commit254f0426b522d3abc060f9eee02484dab96fb699 (patch)
tree18e7cf53350077ce54944bf8f7d2578ced5f135a /bfd/elf32-mips.c
parent01b9137461f11882a03589e8c40fd718b0c09a09 (diff)
downloadgdb-254f0426b522d3abc060f9eee02484dab96fb699.zip
gdb-254f0426b522d3abc060f9eee02484dab96fb699.tar.gz
gdb-254f0426b522d3abc060f9eee02484dab96fb699.tar.bz2
* elf32-mips.c (_bfd_mips_elf32_gprel16_reloc): Reject
R_MIPS_LITERAL relocations for external symbols. * elf64-mips.c (mips_elf64_literal_reloc): Likewise. * elfn32-mips.c (mips_elf_literal_reloc): Likewise.
Diffstat (limited to 'bfd/elf32-mips.c')
-rw-r--r--bfd/elf32-mips.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index 07d8ba4..5c259f1 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -770,6 +770,17 @@ _bfd_mips_elf32_gprel16_reloc (bfd *abfd, arelent *reloc_entry,
bfd_reloc_status_type ret;
bfd_vma gp;
+ /* R_MIPS_LITERAL relocations are defined for local symbols only. */
+ if (reloc_entry->howto->type == R_MIPS_LITERAL
+ && output_bfd != NULL
+ && (symbol->flags & BSF_SECTION_SYM) == 0
+ && (symbol->flags & BSF_LOCAL) != 0)
+ {
+ *error_message = (char *)
+ _("literal relocation occurs for an external symbol");
+ return bfd_reloc_outofrange;
+ }
+
if (output_bfd != NULL)
relocatable = TRUE;
else