* dwarf2.c: Formatting.
[deliverable/binutils-gdb.git] / bfd / elf-eh-frame.c
index 389f6f30933996dba2318ed0ebac9b1dd50e9c6d..4f9ed4a99a9f12a1496e84038978a183fbde66a2 100644 (file)
@@ -1,5 +1,5 @@
 /* .eh_frame section optimization.
-   Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
    Written by Jakub Jelinek <jakub@redhat.com>.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -16,7 +16,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.  */
 
 #include "bfd.h"
 #include "sysdep.h"
@@ -390,8 +390,7 @@ _bfd_elf_discard_section_eh_frame
       return FALSE;
     }
 
-  if ((sec->output_section != NULL
-       && bfd_is_abs_section (sec->output_section)))
+  if (bfd_is_abs_section (sec->output_section))
     {
       /* At least one of the sections is being discarded from the
         link, so we should just ignore them.  */
@@ -453,7 +452,7 @@ _bfd_elf_discard_section_eh_frame
 
   for (;;)
     {
-      unsigned char *aug;
+      char *aug;
       bfd_byte *start, *end, *insns;
       bfd_size_type length;
 
@@ -482,6 +481,7 @@ _bfd_elf_discard_section_eh_frame
         on whether to output or discard last encountered CIE (if any).  */
       if ((bfd_size_type) (buf - ehbuf) == sec->size)
        {
+         hdr.length = 0;
          hdr.id = (unsigned int) -1;
          end = buf;
        }
@@ -562,10 +562,10 @@ _bfd_elf_discard_section_eh_frame
 
          /* Cannot handle unknown versions.  */
          REQUIRE (cie.version == 1 || cie.version == 3);
-         REQUIRE (strlen (buf) < sizeof (cie.augmentation));
+         REQUIRE (strlen ((char *) buf) < sizeof (cie.augmentation));
 
-         strcpy (cie.augmentation, buf);
-         buf = strchr (buf, '\0') + 1;
+         strcpy (cie.augmentation, (char *) buf);
+         buf = (bfd_byte *) strchr ((char *) buf, '\0') + 1;
          ENSURE_NO_RELOCS (buf);
          if (buf[0] == 'e' && buf[1] == 'h')
            {
@@ -612,6 +612,8 @@ _bfd_elf_discard_section_eh_frame
                    ENSURE_NO_RELOCS (buf);
                    REQUIRE (get_DW_EH_PE_width (cie.fde_encoding, ptr_size));
                    break;
+                 case 'S':
+                   break;
                  case 'P':
                    {
                      int per_width;
@@ -852,8 +854,8 @@ _bfd_elf_discard_section_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info)
 
 /* This function is called from size_dynamic_sections.
    It needs to decide whether .eh_frame_hdr should be output or not,
-   because later on it is too late for calling _bfd_strip_section_from_output,
-   since dynamic symbol table has been sized.  */
+   because when the dynamic symbol table has been sized it is too late
+   to strip sections.  */
 
 bfd_boolean
 _bfd_elf_maybe_strip_eh_frame_hdr (struct bfd_link_info *info)
@@ -887,7 +889,7 @@ _bfd_elf_maybe_strip_eh_frame_hdr (struct bfd_link_info *info)
 
   if (abfd == NULL)
     {
-      _bfd_strip_section_from_output (info, hdr_info->hdr_sec);
+      hdr_info->hdr_sec->flags |= SEC_EXCLUDE;
       hdr_info->hdr_sec = NULL;
       return TRUE;
     }
@@ -1087,7 +1089,7 @@ _bfd_elf_write_section_eh_frame (bfd *abfd,
              || ent->need_lsda_relative
              || ent->per_encoding_relative)
            {
-             unsigned char *aug;
+             char *aug;
              unsigned int action, extra_string, extra_data;
              unsigned int per_width, per_encoding;
 
@@ -1101,8 +1103,8 @@ _bfd_elf_write_section_eh_frame (bfd *abfd,
 
              /* Skip length, id and version.  */
              buf += 9;
-             aug = buf;
-             buf = strchr (buf, '\0') + 1;
+             aug = (char *) buf;
+             buf += strlen (aug) + 1;
              skip_leb128 (&buf, end);
              skip_leb128 (&buf, end);
              skip_leb128 (&buf, end);
@@ -1116,7 +1118,7 @@ _bfd_elf_write_section_eh_frame (bfd *abfd,
 
              /* Make room for the new augmentation string and data bytes.  */
              memmove (buf + extra_string + extra_data, buf, end - buf);
-             memmove (aug + extra_string, aug, buf - aug);
+             memmove (aug + extra_string, aug, buf - (bfd_byte *) aug);
              buf += extra_string;
              end += extra_string + extra_data;
 
@@ -1177,6 +1179,8 @@ _bfd_elf_write_section_eh_frame (bfd *abfd,
                      }
                    buf++;
                    break;
+                 case 'S':
+                   break;
                  default:
                    BFD_FAIL ();
                  }
This page took 0.027344 seconds and 4 git commands to generate.