* elf32-mips.c (mips_elf_gprel32_reloc): Reject
authorMaciej W. Rozycki <macro@linux-mips.org>
Mon, 7 Feb 2005 02:44:59 +0000 (02:44 +0000)
committerMaciej W. Rozycki <macro@linux-mips.org>
Mon, 7 Feb 2005 02:44:59 +0000 (02:44 +0000)
R_MIPS_GPREL32 relocations against external symbols.
* elf64-mips.c (mips_elf64_gprel32_reloc): Replace an incorrect
comment.

bfd/ChangeLog
bfd/elf32-mips.c
bfd/elf64-mips.c

index b13e41c3e72ba204a33a6660e0e758378dedf06a..033bf574deccd601133a2f228e69e3d554c3ebbb 100644 (file)
@@ -1,3 +1,10 @@
+2005-02-07  Maciej W. Rozycki  <macro@mips.com>
+
+       * 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.
+
 2005-02-07  Alan Modra  <amodra@bigpond.net.au>
 
        * elf-bfd.h (elf_string_from_elf_strtab): Delete macro.
index 9774215d018059ad795151dd5fc42360f7dbf2b2..07d8ba4b5e3659c0f79b2a594b5448b437332d9e 100644 (file)
@@ -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
index 699b8628cf36205127ca9b850bb4d154edc5d88f..e1051be9b086f06bd6cc2cb35831b4ce8a814ad7 100644 (file)
@@ -1586,8 +1586,7 @@ mips_elf64_gprel32_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol,
   bfd_vma relocation;
   bfd_vma val;
 
-  /* If we're relocating, and this is an external symbol, we don't want
-     to change anything.  */
+  /* 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)
This page took 0.033674 seconds and 4 git commands to generate.