nameless LOAD_DLL_DEBUG_EVENT causes ntdll.dll to be missing
[binutils-gdb.git] / bfd / elf32-nios2.c
index 2d6f07a32cdb5d5447de975152e0609d74b12361..82e55164c8b9d71c3c194961787028c43d68b969 100644 (file)
@@ -880,10 +880,10 @@ nios2_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
 
     case 212:        /* Linux/Nios II */
       /* pr_cursig */
-      elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+      elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
 
       /* pr_pid */
-      elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
+      elf_tdata (abfd)->core->pid = bfd_get_32 (abfd, note->descdata + 24);
 
       /* pr_reg */
       offset = 72;
@@ -907,9 +907,9 @@ nios2_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
       return FALSE;
 
     case 124:        /* Linux/Nios II elf_prpsinfo */
-      elf_tdata (abfd)->core_program
+      elf_tdata (abfd)->core->program
        = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
-      elf_tdata (abfd)->core_command
+      elf_tdata (abfd)->core->command
        = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
     }
 
@@ -918,7 +918,7 @@ nios2_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
      implementations, so strip it off if it exists.  */
 
   {
-    char *command = elf_tdata (abfd)->core_command;
+    char *command = elf_tdata (abfd)->core->command;
     int n = strlen (command);
 
     if (0 < n && command[n - 1] == ' ')
@@ -1136,7 +1136,7 @@ bfd_vma hiadj (bfd_vma symbol_value)
 /* Do the relocations that require special handling.  */
 static bfd_reloc_status_type
 nios2_elf32_do_hi16_relocate (bfd *abfd, reloc_howto_type *howto, 
-                             asection *input_section ATTRIBUTE_UNUSED, 
+                             asection *input_section,
                              bfd_byte *data, bfd_vma offset, 
                              bfd_vma symbol_value, bfd_vma addend)
 {
@@ -1149,7 +1149,7 @@ nios2_elf32_do_hi16_relocate (bfd *abfd, reloc_howto_type *howto,
 
 static bfd_reloc_status_type
 nios2_elf32_do_lo16_relocate (bfd *abfd, reloc_howto_type *howto,
-                             asection *input_section ATTRIBUTE_UNUSED, 
+                             asection *input_section,
                              bfd_byte *data, bfd_vma offset, 
                              bfd_vma symbol_value, bfd_vma addend)
 {
@@ -1162,7 +1162,7 @@ nios2_elf32_do_lo16_relocate (bfd *abfd, reloc_howto_type *howto,
 
 static bfd_reloc_status_type
 nios2_elf32_do_hiadj16_relocate (bfd *abfd, reloc_howto_type *howto,
-                                asection *input_section ATTRIBUTE_UNUSED, 
+                                asection *input_section,
                                 bfd_byte *data, bfd_vma offset,
                                 bfd_vma symbol_value, bfd_vma addend)
 {
@@ -1175,7 +1175,7 @@ nios2_elf32_do_hiadj16_relocate (bfd *abfd, reloc_howto_type *howto,
 
 static bfd_reloc_status_type
 nios2_elf32_do_pcrel_lo16_relocate (bfd *abfd, reloc_howto_type *howto,
-                                   asection *input_section ATTRIBUTE_UNUSED,
+                                   asection *input_section,
                                    bfd_byte *data, bfd_vma offset,
                                    bfd_vma symbol_value, bfd_vma addend)
 {
@@ -1188,8 +1188,7 @@ nios2_elf32_do_pcrel_lo16_relocate (bfd *abfd, reloc_howto_type *howto,
 
 static bfd_reloc_status_type
 nios2_elf32_do_pcrel_hiadj16_relocate (bfd *abfd, reloc_howto_type *howto,
-                                      asection *input_section
-                                      ATTRIBUTE_UNUSED,
+                                      asection *input_section,
                                       bfd_byte *data, bfd_vma offset,
                                       bfd_vma symbol_value, bfd_vma addend)
 {
@@ -1205,7 +1204,7 @@ nios2_elf32_do_pcrel_hiadj16_relocate (bfd *abfd, reloc_howto_type *howto,
 
 static bfd_reloc_status_type
 nios2_elf32_do_pcrel16_relocate (bfd *abfd, reloc_howto_type *howto,
-                                asection *input_section ATTRIBUTE_UNUSED, 
+                                asection *input_section,
                                 bfd_byte *data, bfd_vma offset, 
                                 bfd_vma symbol_value, bfd_vma addend)
 {
@@ -1219,7 +1218,7 @@ nios2_elf32_do_pcrel16_relocate (bfd *abfd, reloc_howto_type *howto,
 
 static bfd_reloc_status_type
 nios2_elf32_do_call26_relocate (bfd *abfd, reloc_howto_type *howto,
-                               asection *input_section ATTRIBUTE_UNUSED, 
+                               asection *input_section,
                                bfd_byte *data, bfd_vma offset, 
                                bfd_vma symbol_value, bfd_vma addend)
 {
@@ -1234,7 +1233,7 @@ nios2_elf32_do_call26_relocate (bfd *abfd, reloc_howto_type *howto,
 
 static bfd_reloc_status_type
 nios2_elf32_do_gprel_relocate (bfd *abfd, reloc_howto_type *howto,
-                              asection *input_section ATTRIBUTE_UNUSED, 
+                              asection *input_section,
                               bfd_byte *data, bfd_vma offset, 
                               bfd_vma symbol_value, bfd_vma addend)
 {
@@ -1246,7 +1245,7 @@ nios2_elf32_do_gprel_relocate (bfd *abfd, reloc_howto_type *howto,
 
 static bfd_reloc_status_type
 nios2_elf32_do_ujmp_relocate (bfd *abfd, reloc_howto_type *howto,
-                             asection *input_section ATTRIBUTE_UNUSED, 
+                             asection *input_section,
                              bfd_byte *data, bfd_vma offset, 
                              bfd_vma symbol_value, bfd_vma addend)
 {
@@ -1269,7 +1268,7 @@ nios2_elf32_do_ujmp_relocate (bfd *abfd, reloc_howto_type *howto,
 
 static bfd_reloc_status_type
 nios2_elf32_do_cjmp_relocate (bfd *abfd, reloc_howto_type *howto,
-                             asection *input_section ATTRIBUTE_UNUSED, 
+                             asection *input_section,
                              bfd_byte *data, bfd_vma offset, 
                              bfd_vma symbol_value, bfd_vma addend)
 {
@@ -1292,7 +1291,7 @@ nios2_elf32_do_cjmp_relocate (bfd *abfd, reloc_howto_type *howto,
 
 static bfd_reloc_status_type
 nios2_elf32_do_callr_relocate (bfd *abfd, reloc_howto_type *howto,
-                              asection *input_section ATTRIBUTE_UNUSED, 
+                              asection *input_section,
                               bfd_byte *data, bfd_vma offset, 
                               bfd_vma symbol_value, bfd_vma addend)
 {
@@ -1718,12 +1717,12 @@ nios2_elf32_relocate_section (bfd *output_bfd,
        }
       else
        {
-         bfd_boolean warned;
+         bfd_boolean warned, ignored;
 
          RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
                                   r_symndx, symtab_hdr, sym_hashes,
                                   h, sec, relocation,
-                                  unresolved_reloc, warned);
+                                  unresolved_reloc, warned, ignored);
        }
 
       if (sec && discarded_section (sec))
@@ -2601,6 +2600,10 @@ nios2_elf32_check_relocs (bfd *abfd, struct bfd_link_info *info,
          while (h->root.type == bfd_link_hash_indirect
                 || h->root.type == bfd_link_hash_warning)
            h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+         /* PR15323, ref flags aren't set for references in the same
+            object.  */
+         h->root.non_ir_ref = 1;
        }
 
       r_type = ELF32_R_TYPE (rel->r_info);
@@ -2838,7 +2841,7 @@ nios2_elf32_check_relocs (bfd *abfd, struct bfd_link_info *info,
    relocation.  */
 static asection *
 nios2_elf32_gc_mark_hook (asection *sec,
-                         struct bfd_link_info *info ATTRIBUTE_UNUSED,
+                         struct bfd_link_info *info,
                          Elf_Internal_Rela *rel,
                          struct elf_link_hash_entry *h,
                          Elf_Internal_Sym *sym)
@@ -3260,9 +3263,6 @@ nios2_elf32_finish_dynamic_sections (bfd *output_bfd,
              nios2_elf32_install_imm16 (splt, 4, hiadj (corrected));
              nios2_elf32_install_imm16 (splt, 12, (corrected & 0xffff) + 4);
              nios2_elf32_install_imm16 (splt, 16, (corrected & 0xffff) + 8);
-
-             elf_section_data (splt->output_section)->this_hdr.sh_entsize
-               = 24;
            }
          else
            {
@@ -3288,9 +3288,6 @@ nios2_elf32_finish_dynamic_sections (bfd *output_bfd,
                                         (got_address & 0xffff) + 4);
              nios2_elf32_install_imm16 (splt, res_size + 20,
                                         (got_address & 0xffff) + 8);
-
-             elf_section_data (splt->output_section)->this_hdr.sh_entsize
-               = 28 + res_size;
            }
        }
     }
@@ -3958,7 +3955,7 @@ nios2_elf32_link_hash_table_create (bfd *abfd)
   struct elf32_nios2_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf32_nios2_link_hash_table);
 
-  ret = bfd_malloc (amt);
+  ret = bfd_zmalloc (amt);
   if (ret == NULL)
     return NULL;
 
@@ -3972,17 +3969,14 @@ nios2_elf32_link_hash_table_create (bfd *abfd)
       return NULL;
     }
 
-  ret->sdynbss = NULL;
-  ret->srelbss = NULL;
-  ret->sbss = NULL;
-  ret->tls_ldm_got.refcount = 0;
-  ret->sym_cache.abfd = NULL;
   return &ret->root.root;
 }
 
 /* Implement elf_backend_reloc_type_class.  */
 static enum elf_reloc_type_class
-nios2_elf32_reloc_type_class (const Elf_Internal_Rela *rela)
+nios2_elf32_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+                             const asection *rel_sec ATTRIBUTE_UNUSED,
+                             const Elf_Internal_Rela *rela)
 {
   switch ((int) ELF32_R_TYPE (rela->r_info))
     {