* doc/c-xtensa.texi (Literal Directive): Spelling correction.
[deliverable/binutils-gdb.git] / bfd / elf.c
index fac05e0d886f14e3cf12be00f9fc9e3eac4e01b7..7f402c3cb32cec9a058192c1ee2451ceab7d417c 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -17,7 +17,7 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 /*  SECTION
 
@@ -2245,10 +2245,11 @@ _bfd_elf_new_section_hook (bfd *abfd, asection *sec)
       sec->used_by_bfd = sdata;
     }
 
-  /* When we read a file, we don't need section type and flags.
-     They will be overridden in _bfd_elf_make_section_from_shdr
-     anyway.  */
-  if (abfd->direction != read_direction)
+  /* When we read a file, we don't need section type and flags unless
+     it is a linker created section.  They will be overridden in
+     _bfd_elf_make_section_from_shdr anyway.  */
+  if (abfd->direction != read_direction
+      || (sec->flags & SEC_LINKER_CREATED) != 0)
     {
       ssect = _bfd_elf_get_sec_type_attr (abfd, sec->name);
       if (ssect != NULL)
@@ -2499,7 +2500,7 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg)
          struct bfd_link_order *l;
          asection *elt;
 
-         for (l = asect->link_order_head; l != NULL; l = l->next)
+         for (l = asect->map_head.link_order; l != NULL; l = l->next)
            if (l->type == bfd_indirect_link_order
                && (elt = elf_next_in_group (l->u.indirect.section)) != NULL)
              do
@@ -2616,7 +2617,7 @@ elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg)
          struct bfd_link_order *o;
 
          this_hdr->sh_size = 0;
-         for (o = asect->link_order_head; o != NULL; o = o->next)
+         for (o = asect->map_head.link_order; o != NULL; o = o->next)
            if (this_hdr->sh_size < o->offset + o->size)
              this_hdr->sh_size = o->offset + o->size;
          if (this_hdr->sh_size)
@@ -2722,7 +2723,7 @@ bfd_elf_set_group_contents (bfd *abfd, asection *sec, void *failedptrarg)
   /* If this is a relocatable link, then the above did nothing because
      SEC is the output section.  Look through the input sections
      instead.  */
-  for (l = sec->link_order_head; l != NULL; l = l->next)
+  for (l = sec->map_head.link_order; l != NULL; l = l->next)
     if (l->type == bfd_indirect_link_order
        && (elt = elf_next_in_group (l->u.indirect.section)) != NULL)
       do
@@ -2762,14 +2763,11 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info)
   /* SHT_GROUP sections are in relocatable files only.  */
   if (link_info == NULL || link_info->relocatable)
     {
-      asection *n;
-
       /* Put SHT_GROUP sections first.  */
-      for (sec = abfd->sections; sec; sec = n)
+      for (sec = abfd->sections; sec != NULL; sec = sec->next)
        {
          d = elf_section_data (sec);
 
-         n = sec->next;
          if (d->this_hdr.sh_type == SHT_GROUP)
            { 
              if (sec->flags & SEC_LINKER_CREATED)
@@ -2927,7 +2925,7 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info)
 
              /* Find out what the corresponding section in output
                 is.  */
-             for (p = sec->link_order_head; p != NULL; p = p->next)
+             for (p = sec->map_head.link_order; p != NULL; p = p->next)
                {
                  s = p->u.indirect.section;
                  if (p->type == bfd_indirect_link_order
@@ -4298,7 +4296,7 @@ assign_file_positions_for_segments (bfd *abfd, struct bfd_link_info *link_info)
                  struct bfd_link_order *o;
                  bfd_vma tbss_size = 0;
 
-                 for (o = sec->link_order_head; o != NULL; o = o->next)
+                 for (o = sec->map_head.link_order; o != NULL; o = o->next)
                    if (tbss_size < o->offset + o->size)
                      tbss_size = o->offset + o->size;
 
@@ -6685,6 +6683,7 @@ _bfd_elf_close_and_cleanup (bfd *abfd)
     {
       if (elf_shstrtab (abfd) != NULL)
        _bfd_elf_strtab_free (elf_shstrtab (abfd));
+      _bfd_dwarf2_cleanup_debug_info (abfd);
     }
 
   return _bfd_generic_close_and_cleanup (abfd);
This page took 0.026249 seconds and 4 git commands to generate.