MIPS/BFD: Unify `bfd_reloc_outofrange' error reporting code
[deliverable/binutils-gdb.git] / bfd / elf32-i386.c
index 483146b1a5a962c8207ecd9084f90ad2afbf0564..8766d2b7b10c642e080b8608094545886d32e29a 100644 (file)
@@ -1544,7 +1544,7 @@ elf_i386_convert_load_reloc (bfd *abfd, Elf_Internal_Shdr *symtab_hdr,
   if (roff < 2)
     return TRUE;
 
-  /* Addend for R_386_GOT32 and R_386_GOT32X relocations must be 0.  */
+  /* Addend for R_386_GOT32X relocations must be 0.  */
   addend = bfd_get_32 (abfd, contents + roff);
   if (addend != 0)
     return TRUE;
@@ -1558,11 +1558,10 @@ elf_i386_convert_load_reloc (bfd *abfd, Elf_Internal_Shdr *symtab_hdr,
   modrm = bfd_get_8 (abfd, contents + roff - 1);
   baseless = (modrm & 0xc7) == 0x5;
 
-  if (r_type == R_386_GOT32X && baseless && is_pic)
+  if (baseless && is_pic)
     {
       /* For PIC, disallow R_386_GOT32X without a base register
-        since we don't know what the GOT base is.   Allow
-        R_386_GOT32 for existing object files.  */
+        since we don't know what the GOT base is.  */
       const char *name;
 
       if (h == NULL)
@@ -1582,22 +1581,12 @@ elf_i386_convert_load_reloc (bfd *abfd, Elf_Internal_Shdr *symtab_hdr,
 
   opcode = bfd_get_8 (abfd, contents + roff - 2);
 
-  /* Convert mov to lea since it has been done for a while.  */
-  if (opcode != 0x8b)
-    {
-      /* Only convert R_386_GOT32X relocation for call, jmp or
-        one of adc, add, and, cmp, or, sbb, sub, test, xor
-        instructions.  */
-      if (r_type != R_386_GOT32X)
-       return TRUE;
-    }
-
   /* Convert to R_386_32 if PIC is false or there is no base
      register.  */
   to_reloc_32 = !is_pic || baseless;
 
-  /* Try to convert R_386_GOT32 and R_386_GOT32X.  Get the symbol
-     referred to by the reloc.  */
+  /* Try to convert R_386_GOT32X.  Get the symbol referred to by the
+     reloc.  */
   if (h == NULL)
     {
       if (opcode == 0x0ff)
@@ -2267,7 +2256,7 @@ do_size:
            goto error_return;
        }
 
-      if ((r_type == R_386_GOT32 || r_type == R_386_GOT32X)
+      if (r_type == R_386_GOT32X
          && (h == NULL || h->type != STT_GNU_IFUNC))
        sec->need_convert_load = 1;
     }
@@ -3021,7 +3010,9 @@ elf_i386_convert_load (bfd *abfd, asection *sec,
       struct elf_link_hash_entry *h;
       bfd_boolean converted;
 
-      if (r_type != R_386_GOT32 && r_type != R_386_GOT32X)
+      /* Don't convert R_386_GOT32 since we can't tell if it is applied
+        to "mov $foo@GOT, %reg" which isn't a load via GOT.  */
+      if (r_type != R_386_GOT32X)
        continue;
 
       r_symndx = ELF32_R_SYM (irel->r_info);
@@ -5795,27 +5786,6 @@ elf_i386_hash_symbol (struct elf_link_hash_entry *h)
   return _bfd_elf_hash_symbol (h);
 }
 
-/* Hook called by the linker routine which adds symbols from an object
-   file.  */
-
-static bfd_boolean
-elf_i386_add_symbol_hook (bfd * abfd,
-                         struct bfd_link_info * info,
-                         Elf_Internal_Sym * sym,
-                         const char ** namep ATTRIBUTE_UNUSED,
-                         flagword * flagsp ATTRIBUTE_UNUSED,
-                         asection ** secp ATTRIBUTE_UNUSED,
-                         bfd_vma * valp ATTRIBUTE_UNUSED)
-{
-  if (ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE
-      && (abfd->flags & DYNAMIC) == 0
-      && bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
-    elf_tdata (info->output_bfd)->has_gnu_symbols
-      |= elf_gnu_symbol_unique;
-
-  return TRUE;
-}
-
 #define TARGET_LITTLE_SYM              i386_elf32_vec
 #define TARGET_LITTLE_NAME             "elf32-i386"
 #define ELF_ARCH                       bfd_arch_i386
@@ -5863,7 +5833,6 @@ elf_i386_add_symbol_hook (bfd * abfd,
 #define elf_backend_omit_section_dynsym \
   ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true)
 #define elf_backend_hash_symbol                      elf_i386_hash_symbol
-#define elf_backend_add_symbol_hook           elf_i386_add_symbol_hook
 #define elf_backend_fixup_symbol             elf_i386_fixup_symbol
 
 #include "elf32-target.h"
This page took 0.029368 seconds and 4 git commands to generate.