*** empty log message ***
[deliverable/binutils-gdb.git] / bfd / sunos.c
index bcdb075b7d1f698a44657890de45edcdf92eae8a..a9117f4771816c6037d6b51bbb12dde4087d08f5 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD backend for SunOS binaries.
    Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
 /* BFD backend for SunOS binaries.
    Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+   2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
    Written by Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
    Written by Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -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
 
    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 02110-1301, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 #define TARGETNAME "a.out-sunos-big"
 
 
 #define TARGETNAME "a.out-sunos-big"
 
@@ -679,8 +679,9 @@ sunos_link_hash_table_create (bfd *abfd)
   ret = bfd_malloc (amt);
   if (ret ==  NULL)
     return NULL;
   ret = bfd_malloc (amt);
   if (ret ==  NULL)
     return NULL;
-  if (! NAME (aout, link_hash_table_init) (&ret->root, abfd,
-                                          sunos_link_hash_newfunc))
+  if (!NAME (aout, link_hash_table_init) (&ret->root, abfd,
+                                         sunos_link_hash_newfunc,
+                                         sizeof (struct sunos_link_hash_entry)))
     {
       free (ret);
       return NULL;
     {
       free (ret);
       return NULL;
@@ -744,57 +745,50 @@ sunos_create_dynamic_sections (bfd *abfd,
       /* The .dynamic section holds the basic dynamic information: the
         sun4_dynamic structure, the dynamic debugger information, and
         the sun4_dynamic_link structure.  */
       /* The .dynamic section holds the basic dynamic information: the
         sun4_dynamic structure, the dynamic debugger information, and
         the sun4_dynamic_link structure.  */
-      s = bfd_make_section (abfd, ".dynamic");
+      s = bfd_make_section_with_flags (abfd, ".dynamic", flags);
       if (s == NULL
       if (s == NULL
-         || ! bfd_set_section_flags (abfd, s, flags)
          || ! bfd_set_section_alignment (abfd, s, 2))
        return FALSE;
 
       /* The .got section holds the global offset table.  The address
         is put in the ld_got field.  */
          || ! bfd_set_section_alignment (abfd, s, 2))
        return FALSE;
 
       /* The .got section holds the global offset table.  The address
         is put in the ld_got field.  */
-      s = bfd_make_section (abfd, ".got");
+      s = bfd_make_section_with_flags (abfd, ".got", flags);
       if (s == NULL
       if (s == NULL
-         || ! bfd_set_section_flags (abfd, s, flags)
          || ! bfd_set_section_alignment (abfd, s, 2))
        return FALSE;
 
       /* The .plt section holds the procedure linkage table.  The
         address is put in the ld_plt field.  */
          || ! bfd_set_section_alignment (abfd, s, 2))
        return FALSE;
 
       /* The .plt section holds the procedure linkage table.  The
         address is put in the ld_plt field.  */
-      s = bfd_make_section (abfd, ".plt");
+      s = bfd_make_section_with_flags (abfd, ".plt", flags | SEC_CODE);
       if (s == NULL
       if (s == NULL
-         || ! bfd_set_section_flags (abfd, s, flags | SEC_CODE)
          || ! bfd_set_section_alignment (abfd, s, 2))
        return FALSE;
 
       /* The .dynrel section holds the dynamic relocs.  The address is
         put in the ld_rel field.  */
          || ! bfd_set_section_alignment (abfd, s, 2))
        return FALSE;
 
       /* The .dynrel section holds the dynamic relocs.  The address is
         put in the ld_rel field.  */
-      s = bfd_make_section (abfd, ".dynrel");
+      s = bfd_make_section_with_flags (abfd, ".dynrel", flags | SEC_READONLY);
       if (s == NULL
       if (s == NULL
-         || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
          || ! bfd_set_section_alignment (abfd, s, 2))
        return FALSE;
 
       /* The .hash section holds the dynamic hash table.  The address
         is put in the ld_hash field.  */
          || ! bfd_set_section_alignment (abfd, s, 2))
        return FALSE;
 
       /* The .hash section holds the dynamic hash table.  The address
         is put in the ld_hash field.  */
-      s = bfd_make_section (abfd, ".hash");
+      s = bfd_make_section_with_flags (abfd, ".hash", flags | SEC_READONLY);
       if (s == NULL
       if (s == NULL
-         || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
          || ! bfd_set_section_alignment (abfd, s, 2))
        return FALSE;
 
       /* The .dynsym section holds the dynamic symbols.  The address
         is put in the ld_stab field.  */
          || ! bfd_set_section_alignment (abfd, s, 2))
        return FALSE;
 
       /* The .dynsym section holds the dynamic symbols.  The address
         is put in the ld_stab field.  */
-      s = bfd_make_section (abfd, ".dynsym");
+      s = bfd_make_section_with_flags (abfd, ".dynsym", flags | SEC_READONLY);
       if (s == NULL
       if (s == NULL
-         || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
          || ! bfd_set_section_alignment (abfd, s, 2))
        return FALSE;
 
       /* The .dynstr section holds the dynamic symbol string table.
         The address is put in the ld_symbols field.  */
          || ! bfd_set_section_alignment (abfd, s, 2))
        return FALSE;
 
       /* The .dynstr section holds the dynamic symbol string table.
         The address is put in the ld_symbols field.  */
-      s = bfd_make_section (abfd, ".dynstr");
+      s = bfd_make_section_with_flags (abfd, ".dynstr", flags | SEC_READONLY);
       if (s == NULL
       if (s == NULL
-         || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
          || ! bfd_set_section_alignment (abfd, s, 2))
        return FALSE;
 
          || ! bfd_set_section_alignment (abfd, s, 2))
        return FALSE;
 
@@ -889,14 +883,10 @@ sunos_add_dynamic_symbols (bfd *abfd,
       /* The .need section holds the list of names of shared objets
         which must be included at runtime.  The address of this
         section is put in the ld_need field.  */
       /* The .need section holds the list of names of shared objets
         which must be included at runtime.  The address of this
         section is put in the ld_need field.  */
-      asection *s = bfd_make_section (dynobj, ".need");
+      flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+                       | SEC_IN_MEMORY | SEC_READONLY);
+      asection *s = bfd_make_section_with_flags (dynobj, ".need", flags);
       if (s == NULL
       if (s == NULL
-         || ! bfd_set_section_flags (dynobj, s,
-                                     (SEC_ALLOC
-                                      | SEC_LOAD
-                                      | SEC_HAS_CONTENTS
-                                      | SEC_IN_MEMORY
-                                      | SEC_READONLY))
          || ! bfd_set_section_alignment (dynobj, s, 2))
        return FALSE;
     }
          || ! bfd_set_section_alignment (dynobj, s, 2))
        return FALSE;
     }
@@ -906,14 +896,10 @@ sunos_add_dynamic_symbols (bfd *abfd,
       /* The .rules section holds the path to search for shared
         objects.  The address of this section is put in the ld_rules
         field.  */
       /* The .rules section holds the path to search for shared
         objects.  The address of this section is put in the ld_rules
         field.  */
-      asection *s = bfd_make_section (dynobj, ".rules");
+      flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+                       | SEC_IN_MEMORY | SEC_READONLY);
+      asection *s = bfd_make_section_with_flags (dynobj, ".rules", flags);
       if (s == NULL
       if (s == NULL
-         || ! bfd_set_section_flags (dynobj, s,
-                                     (SEC_ALLOC
-                                      | SEC_LOAD
-                                      | SEC_HAS_CONTENTS
-                                      | SEC_IN_MEMORY
-                                      | SEC_READONLY))
          || ! bfd_set_section_alignment (dynobj, s, 2))
        return FALSE;
     }
          || ! bfd_set_section_alignment (dynobj, s, 2))
        return FALSE;
     }
This page took 0.026105 seconds and 4 git commands to generate.