* libxcoff.h (struct xcoff_backend_data_rec): Constify src param
[binutils-gdb.git] / bfd / elf32-m68k.c
index 9b5e93f529e58b4bc97a1e3a0b92b0459886c383..a3df85d5b5944e7b9e9e7b4490e9e902c1161a76 100644 (file)
@@ -1,5 +1,6 @@
 /* Motorola 68k series support for 32-bit ELF
-   Copyright 1993, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
+   Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+   Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -181,7 +182,6 @@ reloc_type_lookup (abfd, code)
 /* end code generated by elf.el */
 
 #define USE_RELA
-
 \f
 /* Functions for the m68k ELF linker.  */
 
@@ -227,7 +227,7 @@ static const bfd_byte elf_cpu32_plt0_entry[PLT_CPU32_ENTRY_SIZE] =
   0x2f, 0x3b, 0x01, 0x70, /* move.l (%pc,addr),-(%sp) */
   0, 0, 0, 0,             /* replaced with offset to .got + 4.  */
   0x22, 0x7b, 0x01, 0x70, /* moveal %pc@(0xc), %a1 */
-  0, 0, 0, 0,             /* replace with offset to .got +8. */
+  0, 0, 0, 0,             /* replace with offset to .got +8.  */
   0x4e, 0xd1,             /* jmp %a1@ */
   0, 0, 0, 0,             /* pad out to 24 bytes.  */
   0, 0
@@ -376,12 +376,12 @@ elf32_m68k_copy_private_bfd_data (ibfd, obfd)
   if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
       || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
     return true;
+
   in_flags = elf_elfheader (ibfd)->e_flags;
+
   elf_elfheader (obfd)->e_flags = in_flags;
   elf_flags_init (obfd) = true;
+
   return true;
 }
 
@@ -932,7 +932,6 @@ elf_m68k_gc_sweep_hook (abfd, info, sec, relocs)
   return true;
 }
 
-
 /* Adjust a symbol defined by a dynamic object and referenced by a
    regular object.  The current definition is in some section of the
    dynamic object, but we're not including those sections.  We have to
@@ -1325,7 +1324,6 @@ elf_m68k_size_dynamic_sections (output_bfd, info)
    in regular objects.  We allocated space for them in the check_relocs
    routine, but we won't fill them in in the relocate_section routine.  */
 
-/*ARGSUSED*/
 static boolean
 elf_m68k_discard_copies (h, ignore)
      struct elf_m68k_link_hash_entry *h;
@@ -1465,7 +1463,14 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
                      && ((! info->symbolic && h->dynindx != -1)
                          || (h->elf_link_hash_flags
                              & ELF_LINK_HASH_DEF_REGULAR) == 0)
-                     && (input_section->flags & SEC_ALLOC) != 0
+                     && ((input_section->flags & SEC_ALLOC) != 0
+                         /* DWARF will emit R_68K_32 relocations in its
+                            sections against symbols defined externally
+                            in shared libraries.  We can't do anything
+                            with them here.  */
+                         || ((input_section->flags & SEC_DEBUGGING) != 0
+                             && (h->elf_link_hash_flags
+                                 & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
                      && (r_type == R_68K_8
                          || r_type == R_68K_16
                          || r_type == R_68K_32
@@ -2139,7 +2144,7 @@ elf_m68k_finish_dynamic_sections (output_bfd, info)
                           + sgot->output_offset + 8
                           - (splt->output_section->vma + 10)),
                          splt->contents + 12);
-              elf_section_data (splt->output_section)->this_hdr.sh_entsize 
+              elf_section_data (splt->output_section)->this_hdr.sh_entsize
                = PLT_ENTRY_SIZE;
             }
           else /* cpu32 */
@@ -2155,7 +2160,7 @@ elf_m68k_finish_dynamic_sections (output_bfd, info)
                           + sgot->output_offset + 8
                           - (splt->output_section->vma + 10)),
                          splt->contents + 12);
-              elf_section_data (splt->output_section)->this_hdr.sh_entsize 
+              elf_section_data (splt->output_section)->this_hdr.sh_entsize
                = PLT_CPU32_ENTRY_SIZE;
             }
        }
@@ -2302,7 +2307,7 @@ bfd_m68k_elf32_create_embedded_relocs (abfd, info, datasec, relsec, errmsg)
       if (targetsec != NULL)
        strncpy (p + 4, targetsec->output_section->name, 8);
     }
-  
+
   if (free_extsyms != NULL)
     free (free_extsyms);
   if (free_relocs != NULL)