daily update
[deliverable/binutils-gdb.git] / bfd / elf32-mcore.c
index 6bb2e758ef89d1074d1f5872bde25e39b5676413..a0784f6b0d05857339f079f7d0aa13ddf3eafd0a 100644 (file)
@@ -1,5 +1,5 @@
 /* Motorola MCore specific support for 32-bit ELF
-   Copyright 1994, 1995, 1999 Free Software Foundation, Inc.
+   Copyright 1994, 1995, 1999, 2000, 2001 Free Software Foundation, Inc.
 
 This file is part of BFD, the Binary File Descriptor library.
 
@@ -39,8 +39,6 @@ static void mcore_elf_info_to_howto
   PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
 static boolean mcore_elf_set_private_flags
   PARAMS ((bfd *, flagword));
-static boolean mcore_elf_copy_private_bfd_data
-  PARAMS ((bfd *, bfd *));
 static boolean mcore_elf_merge_private_bfd_data
   PARAMS ((bfd *, bfd *));
 static bfd_reloc_status_type mcore_elf_unsupported_reloc
@@ -48,6 +46,15 @@ static bfd_reloc_status_type mcore_elf_unsupported_reloc
 static boolean mcore_elf_relocate_section
   PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
           Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
+static asection * mcore_elf_gc_mark_hook
+  PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
+          struct elf_link_hash_entry *, Elf_Internal_Sym *));
+static boolean mcore_elf_gc_sweep_hook
+  PARAMS ((bfd *, struct bfd_link_info *, asection *,
+          const Elf_Internal_Rela *));
+static boolean mcore_elf_check_relocs
+  PARAMS ((bfd *, struct bfd_link_info *, asection *,
+          const Elf_Internal_Rela *));
 
 static reloc_howto_type * mcore_elf_howto_table [(int) R_MCORE_max];
 
@@ -233,7 +240,6 @@ mcore_elf_howto_init ()
       mcore_elf_howto_table [type] = & mcore_elf_howto_raw [i];
     }
 }
-
 \f
 static reloc_howto_type *
 mcore_elf_reloc_type_lookup (abfd, code)
@@ -293,24 +299,6 @@ mcore_elf_set_private_flags (abfd, flags)
   return true;
 }
 
-/* Copy backend specific data from one object module to another.  */
-static boolean
-mcore_elf_copy_private_bfd_data (ibfd, obfd)
-     bfd * ibfd;
-     bfd * obfd;
-{
-  if (   bfd_get_flavour (ibfd) != bfd_target_elf_flavour
-      || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
-    return true;
-
-  BFD_ASSERT (! elf_flags_init (obfd)
-             || elf_elfheader (obfd)->e_flags == elf_elfheader (ibfd)->e_flags);
-
-  elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
-  elf_flags_init (obfd) = true;
-  return true;
-}
-
 /* Merge backend specific data from an object file to the output
    object file when linking.  */
 static boolean
@@ -346,7 +334,6 @@ mcore_elf_merge_private_bfd_data (ibfd, obfd)
 
   return true;
 }
-
 \f
 /* Don't pretend we can deal with unsupported relocs.  */
 
@@ -364,13 +351,12 @@ mcore_elf_unsupported_reloc (abfd, reloc_entry, symbol, data, input_section,
   BFD_ASSERT (reloc_entry->howto != (reloc_howto_type *)0);
 
   _bfd_error_handler (_("%s: Relocation %s (%d) is not currently supported.\n"),
-                     bfd_get_filename (abfd),
+                     bfd_archive_filename (abfd),
                      reloc_entry->howto->name,
                      reloc_entry->howto->type);
 
   return bfd_reloc_notsupported;
 }
-
 \f
 /* The RELOCATE_SECTION function is called by the ELF backend linker
    to handle the relocations for a section.
@@ -404,7 +390,7 @@ mcore_elf_unsupported_reloc (abfd, reloc_entry, symbol, data, input_section,
 static boolean
 mcore_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                          contents, relocs, local_syms, local_sections)
-     bfd * output_bfd ATTRIBUTE_UNUSED;
+     bfd * output_bfd;
      struct bfd_link_info * info;
      bfd * input_bfd;
      asection * input_section;
@@ -422,7 +408,7 @@ mcore_elf_relocate_section (output_bfd, info, input_bfd, input_section,
 #ifdef DEBUG
   fprintf (stderr,
           "mcore_elf_relocate_section called for %s section %s, %ld relocations%s\n",
-          bfd_get_filename (input_bfd),
+          bfd_archive_filename (input_bfd),
           bfd_section_name(input_bfd, input_section),
           (long) input_section->reloc_count,
           (info->relocateable) ? " (relocatable)" : "");
@@ -450,7 +436,7 @@ mcore_elf_relocate_section (output_bfd, info, input_bfd, input_section,
          || ! mcore_elf_howto_table [(int)r_type])
        {
          _bfd_error_handler (_("%s: Unknown relocation type %d\n"),
-                             bfd_get_filename (input_bfd),
+                             bfd_archive_filename (input_bfd),
                              (int) r_type);
 
          bfd_set_error (bfd_error_bad_value);
@@ -491,7 +477,7 @@ mcore_elf_relocate_section (output_bfd, info, input_bfd, input_section,
       if (howto->special_function == mcore_elf_unsupported_reloc)
        {
          _bfd_error_handler (_("%s: Relocation %s (%d) is not currently supported.\n"),
-                             bfd_get_filename (input_bfd),
+                             bfd_archive_filename (input_bfd),
                              howto->name,
                              (int)r_type);
 
@@ -504,9 +490,8 @@ mcore_elf_relocate_section (output_bfd, info, input_bfd, input_section,
        {
          sym = local_syms + r_symndx;
          sec = local_sections [r_symndx];
-         relocation = (sec->output_section->vma
-                       + sec->output_offset
-                       + sym->st_value);
+         relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+         addend = rel->r_addend;
        }
       else
        {
@@ -544,7 +529,7 @@ mcore_elf_relocate_section (output_bfd, info, input_bfd, input_section,
        case R_MCORE_PCRELJSR_IMM11BY2:
          oldinst = bfd_get_16 (input_bfd, contents + offset);
 #define        MCORE_INST_BSR  0xF800
-         bfd_put_16 (input_bfd, MCORE_INST_BSR, contents + offset);
+         bfd_put_16 (input_bfd, (bfd_vma) MCORE_INST_BSR, contents + offset);
          break;
        }
 
@@ -559,7 +544,7 @@ mcore_elf_relocate_section (output_bfd, info, input_bfd, input_section,
       if (r != bfd_reloc_ok && r_type == R_MCORE_PCRELJSR_IMM11BY2)
        {
          /* Wasn't ok, back it out and give up.  */
-         bfd_put_16 (input_bfd, oldinst, contents + offset);
+         bfd_put_16 (input_bfd, (bfd_vma) oldinst, contents + offset);
          r = bfd_reloc_ok;
        }
 
@@ -642,13 +627,7 @@ mcore_elf_gc_mark_hook (abfd, info, rel, h, sym)
     }
   else
     {
-      if (!(elf_bad_symtab (abfd)
-           && ELF_ST_BIND (sym->st_info) != STB_LOCAL)
-         && ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE)
-               && sym->st_shndx != SHN_COMMON))
-       {
-         return bfd_section_from_elf_index (abfd, sym->st_shndx);
-       }
+      return bfd_section_from_elf_index (abfd, sym->st_shndx);
     }
 
   return NULL;
@@ -738,7 +717,6 @@ mcore_elf_check_relocs (abfd, info, sec, relocs)
 #define elf_info_to_howto      mcore_elf_info_to_howto
 #define elf_info_to_howto_rel  NULL
 
-#define bfd_elf32_bfd_copy_private_bfd_data    mcore_elf_copy_private_bfd_data
 #define bfd_elf32_bfd_merge_private_bfd_data   mcore_elf_merge_private_bfd_data
 #define bfd_elf32_bfd_set_private_flags                mcore_elf_set_private_flags
 #define bfd_elf32_bfd_reloc_type_lookup                mcore_elf_reloc_type_lookup
This page took 0.026376 seconds and 4 git commands to generate.