include/elf/
[deliverable/binutils-gdb.git] / bfd / elf32-i370.c
index 9c5cfbdc9381a8963de1a52af77eb85933cd08f2..a6174c2ea20ac327c37bed2b9f787f65dfa530d8 100644 (file)
@@ -1,6 +1,6 @@
 /* i370-specific support for 32-bit ELF
    Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004,
-   2005, 2006, 2007 Free Software Foundation, Inc.
+   2005, 2006, 2007, 2008, 2010  Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
    Hacked by Linas Vepstas for i370 linas@linas.org
 
@@ -375,9 +375,6 @@ i370_elf_section_from_shdr (bfd *abfd,
 
   newsect = hdr->bfd_section;
   flags = bfd_get_section_flags (abfd, newsect);
-  if (hdr->sh_flags & SHF_EXCLUDE)
-    flags |= SEC_EXCLUDE;
-
   if (hdr->sh_type == SHT_ORDERED)
     flags |= SEC_SORT_ENTRIES;
 
@@ -807,7 +804,6 @@ i370_elf_check_relocs (bfd *abfd,
   struct elf_link_hash_entry **sym_hashes;
   const Elf_Internal_Rela *rel;
   const Elf_Internal_Rela *rel_end;
-  bfd_vma *local_got_offsets;
   asection *sreloc;
 
   if (info->relocatable)
@@ -821,7 +817,6 @@ i370_elf_check_relocs (bfd *abfd,
   dynobj = elf_hash_table (info)->dynobj;
   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
   sym_hashes = elf_sym_hashes (abfd);
-  local_got_offsets = elf_local_got_offsets (abfd);
 
   sreloc = NULL;
 
@@ -852,33 +847,11 @@ i370_elf_check_relocs (bfd *abfd,
 #endif
          if (sreloc == NULL)
            {
-             const char *name;
-
-             name = (bfd_elf_string_from_elf_section
-                     (abfd,
-                      elf_elfheader (abfd)->e_shstrndx,
-                      elf_section_data (sec)->rel_hdr.sh_name));
-             if (name == NULL)
-               return FALSE;
-
-             BFD_ASSERT (CONST_STRNEQ (name, ".rela")
-                         && strcmp (bfd_get_section_name (abfd, sec), name + 5) == 0);
+             sreloc = _bfd_elf_make_dynamic_reloc_section
+               (sec, dynobj, 2, abfd, /*rela?*/ TRUE);
 
-             sreloc = bfd_get_section_by_name (dynobj, name);
              if (sreloc == NULL)
-               {
-                 flagword flags;
-
-                 flags = (SEC_HAS_CONTENTS | SEC_READONLY
-                          | SEC_IN_MEMORY | SEC_LINKER_CREATED);
-                 if ((sec->flags & SEC_ALLOC) != 0)
-                   flags |= SEC_ALLOC | SEC_LOAD;
-                 sreloc = bfd_make_section_with_flags (dynobj, name,
-                                                       flags);
-                 if (sreloc == NULL
-                     || ! bfd_set_section_alignment (dynobj, sreloc, 2))
-                   return FALSE;
-               }
+               return FALSE;
            }
 
          sreloc->size += sizeof (Elf32_External_Rela);
@@ -989,6 +962,7 @@ i370_elf_finish_dynamic_sections (bfd *output_bfd,
       sym.st_name = 0;
       sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
       sym.st_other = 0;
+      sym.st_target_internal = 0;
 
       for (s = output_bfd->sections; s != NULL; s = s->next)
        {
@@ -1064,11 +1038,9 @@ i370_elf_relocate_section (bfd *output_bfd,
 {
   Elf_Internal_Shdr *symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
   struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd);
-  bfd *dynobj = elf_hash_table (info)->dynobj;
   Elf_Internal_Rela *rel = relocs;
   Elf_Internal_Rela *relend = relocs + input_section->reloc_count;
   asection *sreloc = NULL;
-  bfd_vma *local_got_offsets;
   bfd_boolean ret = TRUE;
 
 #ifdef DEBUG
@@ -1082,8 +1054,6 @@ i370_elf_relocate_section (bfd *output_bfd,
     /* Initialize howto table if needed.  */
     i370_elf_howto_init ();
 
-  local_got_offsets = elf_local_got_offsets (input_bfd);
-
   for (; rel < relend; rel++)
     {
       enum i370_reloc_type r_type    = (enum i370_reloc_type) ELF32_R_TYPE (rel->r_info);
@@ -1172,15 +1142,8 @@ i370_elf_relocate_section (bfd *output_bfd,
        }
 
       if (sec != NULL && elf_discarded_section (sec))
-       {
-         /* For relocs against symbols from removed linkonce sections,
-            or sections discarded by a linker script, we just want the
-            section contents zeroed.  Avoid any special processing.  */
-         _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
-         rel->r_info = 0;
-         rel->r_addend = 0;
-         continue;
-       }
+       RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
+                                        rel, relend, howto, contents);
 
       if (info->relocatable)
        continue;
@@ -1214,7 +1177,7 @@ i370_elf_relocate_section (bfd *output_bfd,
        case (int) R_I370_ADDR31:
        case (int) R_I370_ADDR16:
          if (info->shared
-             && r_symndx != 0)
+             && r_symndx != STN_UNDEF)
            {
              Elf_Internal_Rela outrel;
              bfd_byte *loc;
@@ -1232,22 +1195,10 @@ i370_elf_relocate_section (bfd *output_bfd,
 
              if (sreloc == NULL)
                {
-                 const char *name;
-
-                 name = (bfd_elf_string_from_elf_section
-                         (input_bfd,
-                          elf_elfheader (input_bfd)->e_shstrndx,
-                          elf_section_data (input_section)->rel_hdr.sh_name));
-                 if (name == NULL)
+                 sreloc = _bfd_elf_get_dynamic_reloc_section
+                   (input_bfd, input_section, /*rela?*/ TRUE);
+                 if (sreloc == NULL)
                    return FALSE;
-
-                 BFD_ASSERT (CONST_STRNEQ (name, ".rela")
-                             && strcmp (bfd_get_section_name (input_bfd,
-                                                              input_section),
-                                        name + 5) == 0);
-
-                 sreloc = bfd_get_section_by_name (dynobj, name);
-                 BFD_ASSERT (sreloc != NULL);
                }
 
              skip = 0;
This page took 0.025547 seconds and 4 git commands to generate.