From 254f0426b522d3abc060f9eee02484dab96fb699 Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Fri, 11 Feb 2005 22:29:10 +0000 Subject: * 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. --- bfd/elf32-mips.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'bfd/elf32-mips.c') 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 -- cgit v1.1