* gdbmi.texinfo: Lots of typos and grammar fixes from Brian
[deliverable/binutils-gdb.git] / bfd / elf32-m68k.c
index 23ecf36a14258baec7e91b8f50875baef0182c19..38e6e9cb395411d4c6db5a09407ecc3d8f483332 100644 (file)
@@ -43,8 +43,6 @@ static boolean elf_m68k_gc_sweep_hook
           const Elf_Internal_Rela *));
 static boolean elf_m68k_adjust_dynamic_symbol
   PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-static boolean elf_m68k_adjust_dynindx
-  PARAMS ((struct elf_link_hash_entry *, PTR));
 static boolean elf_m68k_size_dynamic_sections
   PARAMS ((bfd *, struct bfd_link_info *));
 static boolean elf_m68k_relocate_section
@@ -121,7 +119,7 @@ static reloc_howto_type howto_table[] = {
 
 static void
 rtype_to_howto (abfd, cache_ptr, dst)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      arelent *cache_ptr;
      Elf_Internal_Rela *dst;
 {
@@ -166,7 +164,7 @@ static const struct
 
 static reloc_howto_type *
 reloc_type_lookup (abfd, code)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      bfd_reloc_code_real_type code;
 {
   unsigned int i;
@@ -226,9 +224,9 @@ static const bfd_byte elf_m68k_plt_entry[PLT_ENTRY_SIZE] =
 /* Procedure linkage table entries for the cpu32 */
 static const bfd_byte elf_cpu32_plt0_entry[PLT_CPU32_ENTRY_SIZE] =
 {
-  0x20, 0x7b, 0x01, 0x70, /* moveal %pc@(0xc), %a0 */
+  0x22, 0x7b, 0x01, 0x70, /* moveal %pc@(0xc), %a1 */
   0, 0, 0, 0,             /* replaced with offset to .got + 4.  */
-  0x4e, 0xd0,             /* jmp %a0@ */
+  0x4e, 0xd1,             /* jmp %a1@ */
   0, 0, 0, 0,             /* replace with offset to .got +8. */
   0, 0, 0, 0,             /* pad out to 24 bytes.  */
   0, 0, 0, 0,             /* pad out to 24 bytes.  */
@@ -237,9 +235,9 @@ static const bfd_byte elf_cpu32_plt0_entry[PLT_CPU32_ENTRY_SIZE] =
 
 static const bfd_byte elf_cpu32_plt_entry[PLT_CPU32_ENTRY_SIZE] =
 {
-  0x20, 0x7b, 0x01, 0x70,  /* moveal %pc@(0xc), %a0 */
+  0x22, 0x7b, 0x01, 0x70,  /* moveal %pc@(0xc), %a1 */
   0, 0, 0, 0,              /* replaced with offset to symbol's .got entry.  */
-  0x4e, 0xd0,              /* jmp %a0@ */
+  0x4e, 0xd1,              /* jmp %a1@ */
   0x2f, 0x3c,              /* move.l #offset,-(%sp) */
   0, 0, 0, 0,              /* replaced with offset into relocation table.  */
   0x60, 0xff,              /* bra.l .plt */
@@ -791,7 +789,7 @@ elf_m68k_check_relocs (abfd, info, sec, relocs)
 static asection *
 elf_m68k_gc_mark_hook (abfd, info, rel, h, sym)
      bfd *abfd;
-     struct bfd_link_info *info;
+     struct bfd_link_info *info ATTRIBUTE_UNUSED;
      Elf_Internal_Rela *rel;
      struct elf_link_hash_entry *h;
      Elf_Internal_Sym *sym;
@@ -857,11 +855,11 @@ elf_m68k_gc_sweep_hook (abfd, info, sec, relocs)
   local_got_refcounts = elf_local_got_refcounts (abfd);
 
   dynobj = elf_hash_table (info)->dynobj;
-  if (dynobj)
-    {
-      sgot = bfd_get_section_by_name (dynobj, ".got");
-      srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
-    }
+  if (dynobj == NULL)
+    return true;
+
+  sgot = bfd_get_section_by_name (dynobj, ".got");
+  srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
 
   relend = relocs + sec->reloc_count;
   for (rel = relocs; rel < relend; rel++)
@@ -889,7 +887,7 @@ elf_m68k_gc_sweep_hook (abfd, info, sec, relocs)
                    }
                }
            }
-         else
+         else if (local_got_refcounts != NULL)
            {
              if (local_got_refcounts[r_symndx] > 0)
                {
@@ -1264,7 +1262,7 @@ elf_m68k_size_dynamic_sections (output_bfd, info)
 
       if (strip)
        {
-         _bfd_strip_section_from_output (s);
+         _bfd_strip_section_from_output (info, s);
          continue;
        }
 
@@ -1312,51 +1310,6 @@ elf_m68k_size_dynamic_sections (output_bfd, info)
        }
     }
 
-  /* If we are generating a shared library, we generate a section
-     symbol for each output section for which we might need to copy
-     relocs.  These are local symbols, which means that they must come
-     first in the dynamic symbol table.  That means we must increment
-     the dynamic symbol index of every other dynamic symbol.  */
-  if (info->shared)
-    {
-      int c;
-
-      c = 0;
-      for (s = output_bfd->sections; s != NULL; s = s->next)
-       {
-         if ((s->flags & SEC_LINKER_CREATED) != 0
-             || (s->flags & SEC_ALLOC) == 0)
-           continue;
-
-         elf_section_data (s)->dynindx = c + 1;
-
-         /* These symbols will have no names, so we don't need to
-             fiddle with dynstr_index.  */
-
-         ++c;
-       }
-
-      elf_link_hash_traverse (elf_hash_table (info),
-                             elf_m68k_adjust_dynindx,
-                             (PTR) &c);
-      elf_hash_table (info)->dynsymcount += c;
-    }
-
-  return true;
-}
-
-/* Increment the index of a dynamic symbol by a given amount.  Called
-   via elf_link_hash_traverse.  */
-
-static boolean
-elf_m68k_adjust_dynindx (h, cparg)
-     struct elf_link_hash_entry *h;
-     PTR cparg;
-{
-  int *cp = (int *) cparg;
-
-  if (h->dynindx != -1)
-    h->dynindx += *cp;
   return true;
 }
 
@@ -1370,7 +1323,7 @@ elf_m68k_adjust_dynindx (h, cparg)
 static boolean
 elf_m68k_discard_copies (h, ignore)
      struct elf_m68k_link_hash_entry *h;
-     PTR ignore;
+     PTR ignore ATTRIBUTE_UNUSED;
 {
   struct elf_m68k_pcrel_relocs_copied *s;
 
@@ -1532,7 +1485,8 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
            {
              if (!(info->callbacks->undefined_symbol
                    (info, h->root.root.string, input_bfd,
-                    input_section, rel->r_offset)))
+                    input_section, rel->r_offset,
+                    (!info->shared || info->no_undefined))))
                return false;
              relocation = 0;
            }
@@ -2087,7 +2041,6 @@ elf_m68k_finish_dynamic_sections (output_bfd, info)
   bfd *dynobj;
   asection *sgot;
   asection *sdyn;
-  int plt_entry0_size, plt_off1, plt_off2;
 
   dynobj = elf_hash_table (info)->dynobj;
 
@@ -2214,50 +2167,6 @@ elf_m68k_finish_dynamic_sections (output_bfd, info)
 
   elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
 
-  if (info->shared)
-    {
-      asection *sdynsym;
-      asection *s;
-      Elf_Internal_Sym sym;
-      int c;
-
-      /* Set up the section symbols for the output sections.  */
-
-      sdynsym = bfd_get_section_by_name (dynobj, ".dynsym");
-      BFD_ASSERT (sdynsym != NULL);
-
-      sym.st_size = 0;
-      sym.st_name = 0;
-      sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
-      sym.st_other = 0;
-
-      c = 0;
-      for (s = output_bfd->sections; s != NULL; s = s->next)
-       {
-         int indx;
-
-         if (elf_section_data (s)->dynindx == 0)
-           continue;
-
-         sym.st_value = s->vma;
-
-         indx = elf_section_data (s)->this_idx;
-         BFD_ASSERT (indx > 0);
-         sym.st_shndx = indx;
-
-         bfd_elf32_swap_symbol_out (output_bfd, &sym,
-                                    (PTR) (((Elf32_External_Sym *)
-                                            sdynsym->contents)
-                                           + elf_section_data (s)->dynindx));
-
-         ++c;
-       }
-
-      /* Set the sh_info field of the output .dynsym section to the
-         index of the first global symbol.  */
-      elf_section_data (sdynsym->output_section)->this_hdr.sh_info = c + 1;
-    }
-
   return true;
 }
 
This page took 0.027049 seconds and 4 git commands to generate.