summaryrefslogtreecommitdiff
path: root/bfd/elfn32-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
commit9435372041a8824deb18a9225e6817b61c7afc6b (patch)
treedb13329a6f51cba8ddf02b18f31e0c05d0d80508 /bfd/elfn32-mips.c
parent2b8d852852071c562593fa51629edb176b96eec9 (diff)
downloadbinutils-redhat-9435372041a8824deb18a9225e6817b61c7afc6b.tar.gz
* 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/elfn32-mips.c')
-rw-r--r--bfd/elfn32-mips.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c
index d87c45c076..228601caa5 100644
--- a/bfd/elfn32-mips.c
+++ b/bfd/elfn32-mips.c
@@ -1348,6 +1348,16 @@ mips_elf_literal_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
bfd_reloc_status_type ret;
bfd_vma gp;
+ /* R_MIPS_LITERAL 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 *)
+ _("literal relocation occurs for an external symbol");
+ return bfd_reloc_outofrange;
+ }
+
/* FIXME: The entries in the .lit8 and .lit4 sections should be merged. */
if (output_bfd != NULL)
relocatable = TRUE;