* ieee.c (write_ieee_debugging_info): Use bfd_make_section_with_flags.
authorAlan Modra <amodra@gmail.com>
Mon, 7 Jul 2008 00:44:41 +0000 (00:44 +0000)
committerAlan Modra <amodra@gmail.com>
Mon, 7 Jul 2008 00:44:41 +0000 (00:44 +0000)
* nlmconv.c (main, powerpc_build_stubs): Likewise.
* rescoff.c (write_coff_file): Likewise.
* resres.c (write_res_file): Likewise.
* windmc.c (windmc_write_bin): Likewise.

binutils/ChangeLog
binutils/ieee.c
binutils/nlmconv.c
binutils/rescoff.c
binutils/resres.c
binutils/windmc.c

index 22ed7f0b2ac8a1f37502e994d747f47e17fd9f22..ce2fa3bf25013acd96b9cb33eca7e6ffb5d10ea8 100644 (file)
@@ -1,3 +1,11 @@
+2008-07-07  Alan Modra  <amodra@bigpond.net.au>
+
+       * ieee.c (write_ieee_debugging_info): Use bfd_make_section_with_flags.
+       * nlmconv.c (main, powerpc_build_stubs): Likewise.
+       * rescoff.c (write_coff_file): Likewise.
+       * resres.c (write_res_file): Likewise.
+       * windmc.c (windmc_write_bin): Likewise.
+
 2008-06-18  M R Swami Reddy <MR.Swami.Reddy@nsc.com>
 
        * readelf.c (guess_is_rela): Add EM_CR16_OLD.
index 0645db937810172983def62fe907287aaa974655..9a61132bfa20fc56e2ec4284b2a490b53218daf8 100644 (file)
@@ -1,5 +1,5 @@
 /* ieee.c -- Read and write IEEE-695 debugging information.
-   Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2006, 2007
+   Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2006, 2007, 2008
    Free Software Foundation, Inc.
    Written by Ian Lance Taylor <ian@cygnus.com>.
 
@@ -4676,14 +4676,10 @@ write_ieee_debugging_info (bfd *abfd, void *dhandle)
       return TRUE;
     }
   err = NULL;
-  s = bfd_make_section (abfd, ".debug");
+  s = bfd_make_section_with_flags (abfd, ".debug",
+                                  SEC_DEBUGGING | SEC_HAS_CONTENTS);
   if (s == NULL)
     err = "bfd_make_section";
-  if (err == NULL)
-    {
-      if (! bfd_set_section_flags (abfd, s, SEC_DEBUGGING | SEC_HAS_CONTENTS))
-       err = "bfd_set_section_flags";
-    }
   if (err == NULL)
     {
       bfd_size_type size;
index 2fb74bfe0e85057b09c8e055cb9b87646a8f2333..f8fec73158572029028712da7e2779ca703c09ea 100644 (file)
@@ -1,6 +1,6 @@
 /* nlmconv.c -- NLM conversion program
    Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-   2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+   2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
 
@@ -395,9 +395,10 @@ main (int argc, char **argv)
   bss_sec = bfd_get_section_by_name (outbfd, NLM_UNINITIALIZED_DATA_NAME);
   if (bss_sec == NULL)
     {
-      bss_sec = bfd_make_section (outbfd, NLM_UNINITIALIZED_DATA_NAME);
+      bss_sec = bfd_make_section_with_flags (outbfd,
+                                            NLM_UNINITIALIZED_DATA_NAME,
+                                            SEC_ALLOC);
       if (bss_sec == NULL
-         || ! bfd_set_section_flags (outbfd, bss_sec, SEC_ALLOC)
          || ! bfd_set_section_alignment (outbfd, bss_sec, 1))
        bfd_fatal (_("make .bss section"));
     }
@@ -406,11 +407,10 @@ main (int argc, char **argv)
      so that programs which understand it can resurrect the original
      sections from the NLM.  We will put a pointer to .nlmsections in
      the NLM header area.  */
-  secsec = bfd_make_section (outbfd, ".nlmsections");
+  secsec = bfd_make_section_with_flags (outbfd, ".nlmsections",
+                                       SEC_HAS_CONTENTS);
   if (secsec == NULL)
     bfd_fatal (_("make .nlmsections section"));
-  if (! bfd_set_section_flags (outbfd, secsec, SEC_HAS_CONTENTS))
-    bfd_fatal (_("set .nlmsections flags"));
 
 #ifdef NLMCONV_POWERPC
   /* For PowerPC NetWare we need to build stubs for calls to undefined
@@ -714,11 +714,10 @@ main (int argc, char **argv)
       else
        {
          custom_size = st.st_size;
-         custom_section = bfd_make_section (outbfd, ".nlmcustom");
+         custom_section = bfd_make_section_with_flags (outbfd, ".nlmcustom",
+                                                       SEC_HAS_CONTENTS);
          if (custom_section == NULL
-             || ! bfd_set_section_size (outbfd, custom_section, custom_size)
-             || ! bfd_set_section_flags (outbfd, custom_section,
-                                         SEC_HAS_CONTENTS))
+             || ! bfd_set_section_size (outbfd, custom_section, custom_size))
            bfd_fatal (_("custom section"));
        }
     }
@@ -735,11 +734,10 @@ main (int argc, char **argv)
       else
        {
          help_size = st.st_size;
-         help_section = bfd_make_section (outbfd, ".nlmhelp");
+         help_section = bfd_make_section_with_flags (outbfd, ".nlmhelp",
+                                                     SEC_HAS_CONTENTS);
          if (help_section == NULL
-             || ! bfd_set_section_size (outbfd, help_section, help_size)
-             || ! bfd_set_section_flags (outbfd, help_section,
-                                         SEC_HAS_CONTENTS))
+             || ! bfd_set_section_size (outbfd, help_section, help_size))
            bfd_fatal (_("help section"));
          LITMEMCPY (nlm_extended_header (outbfd)->stamp, "MeSsAgEs");
        }
@@ -757,11 +755,11 @@ main (int argc, char **argv)
       else
        {
          message_size = st.st_size;
-         message_section = bfd_make_section (outbfd, ".nlmmessages");
+         message_section = bfd_make_section_with_flags (outbfd,
+                                                        ".nlmmessages",
+                                                        SEC_HAS_CONTENTS);
          if (message_section == NULL
-             || ! bfd_set_section_size (outbfd, message_section, message_size)
-             || ! bfd_set_section_flags (outbfd, message_section,
-                                         SEC_HAS_CONTENTS))
+             || ! bfd_set_section_size (outbfd, message_section, message_size))
            bfd_fatal (_("message section"));
          LITMEMCPY (nlm_extended_header (outbfd)->stamp, "MeSsAgEs");
        }
@@ -773,11 +771,10 @@ main (int argc, char **argv)
       module_size = 0;
       for (l = modules; l != NULL; l = l->next)
        module_size += strlen (l->string) + 1;
-      module_section = bfd_make_section (outbfd, ".nlmmodules");
+      module_section = bfd_make_section_with_flags (outbfd, ".nlmmodules",
+                                                   SEC_HAS_CONTENTS);
       if (module_section == NULL
-         || ! bfd_set_section_size (outbfd, module_section, module_size)
-         || ! bfd_set_section_flags (outbfd, module_section,
-                                     SEC_HAS_CONTENTS))
+         || ! bfd_set_section_size (outbfd, module_section, module_size))
        bfd_fatal (_("module section"));
     }
   if (rpc_file != NULL)
@@ -793,11 +790,10 @@ main (int argc, char **argv)
       else
        {
          rpc_size = st.st_size;
-         rpc_section = bfd_make_section (outbfd, ".nlmrpc");
+         rpc_section = bfd_make_section_with_flags (outbfd, ".nlmrpc",
+                                                    SEC_HAS_CONTENTS);
          if (rpc_section == NULL
-             || ! bfd_set_section_size (outbfd, rpc_section, rpc_size)
-             || ! bfd_set_section_flags (outbfd, rpc_section,
-                                         SEC_HAS_CONTENTS))
+             || ! bfd_set_section_size (outbfd, rpc_section, rpc_size))
            bfd_fatal (_("rpc section"));
          LITMEMCPY (nlm_extended_header (outbfd)->stamp, "MeSsAgEs");
        }
@@ -849,12 +845,12 @@ main (int argc, char **argv)
              if (shared_offset > (size_t) sharedhdr.publicsOffset)
                shared_offset = sharedhdr.publicsOffset;
              shared_size = st.st_size - shared_offset;
-             shared_section = bfd_make_section (outbfd, ".nlmshared");
+             shared_section = bfd_make_section_with_flags (outbfd,
+                                                           ".nlmshared",
+                                                           SEC_HAS_CONTENTS);
              if (shared_section == NULL
                  || ! bfd_set_section_size (outbfd, shared_section,
-                                            shared_size)
-                 || ! bfd_set_section_flags (outbfd, shared_section,
-                                             SEC_HAS_CONTENTS))
+                                            shared_size))
                bfd_fatal (_("shared section"));
              LITMEMCPY (nlm_extended_header (outbfd)->stamp, "MeSsAgEs");
            }
@@ -1701,13 +1697,12 @@ powerpc_build_stubs (bfd *inbfd, bfd *outbfd ATTRIBUTE_UNUSED,
 
   /* Make a section to hold stubs.  We don't set SEC_HAS_CONTENTS for
      the section to prevent copy_sections from reading from it.  */
-  stub_sec = bfd_make_section (inbfd, ".stubs");
+  stub_sec = bfd_make_section_with_flags (inbfd, ".stubs",
+                                         (SEC_CODE
+                                          | SEC_RELOC
+                                          | SEC_ALLOC
+                                          | SEC_LOAD));
   if (stub_sec == (asection *) NULL
-      || ! bfd_set_section_flags (inbfd, stub_sec,
-                                 (SEC_CODE
-                                  | SEC_RELOC
-                                  | SEC_ALLOC
-                                  | SEC_LOAD))
       || ! bfd_set_section_alignment (inbfd, stub_sec, 2))
     bfd_fatal (".stubs");
 
@@ -1715,14 +1710,13 @@ powerpc_build_stubs (bfd *inbfd, bfd *outbfd ATTRIBUTE_UNUSED,
   got_sec = bfd_get_section_by_name (inbfd, ".got");
   if (got_sec == (asection *) NULL)
     {
-      got_sec = bfd_make_section (inbfd, ".got");
+      got_sec = bfd_make_section_with_flags (inbfd, ".got",
+                                            (SEC_DATA
+                                             | SEC_RELOC
+                                             | SEC_ALLOC
+                                             | SEC_LOAD
+                                             | SEC_HAS_CONTENTS));
       if (got_sec == (asection *) NULL
-         || ! bfd_set_section_flags (inbfd, got_sec,
-                                     (SEC_DATA
-                                      | SEC_RELOC
-                                      | SEC_ALLOC
-                                      | SEC_LOAD
-                                      | SEC_HAS_CONTENTS))
          || ! bfd_set_section_alignment (inbfd, got_sec, 2))
        bfd_fatal (".got");
     }
index e19f58a20c529e5439ee499b38a78159df1d5b49..6fc63dc84a03c7493befff2b3f6d9f704c7d2283 100644 (file)
@@ -1,5 +1,5 @@
 /* rescoff.c -- read and write resources in Windows COFF files.
-   Copyright 1997, 1998, 1999, 2000, 2003, 2007
+   Copyright 1997, 1998, 1999, 2000, 2003, 2007, 2008
    Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
    Rewritten by Kai Tietz, Onevision.
@@ -455,15 +455,12 @@ write_coff_file (const char *filename, const char *target,
   if (! bfd_set_file_flags (abfd, HAS_SYMS | HAS_RELOC))
     bfd_fatal ("bfd_set_file_flags");
 
-  sec = bfd_make_section (abfd, ".rsrc");
+  sec = bfd_make_section_with_flags (abfd, ".rsrc",
+                                    (SEC_HAS_CONTENTS | SEC_ALLOC
+                                     | SEC_LOAD | SEC_DATA));
   if (sec == NULL)
     bfd_fatal ("bfd_make_section");
 
-  if (! bfd_set_section_flags (abfd, sec,
-                              (SEC_HAS_CONTENTS | SEC_ALLOC
-                               | SEC_LOAD | SEC_DATA)))
-    bfd_fatal ("bfd_set_section_flags");
-
   if (! bfd_set_symtab (abfd, sec->symbol_ptr_ptr, 1))
     bfd_fatal ("bfd_set_symtab");
 
index 49fb3fd14a9e789245bc93df202840b45ffc900f..0ae5694a871fab0c99009904d4a929b3bf57d26b 100644 (file)
@@ -1,5 +1,5 @@
 /* resres.c: read_res_file and write_res_file implementation for windres.
-   Copyright 1998, 1999, 2001, 2002, 2007
+   Copyright 1998, 1999, 2001, 2002, 2007, 2008
    Free Software Foundation, Inc.
    Written by Anders Norlander <anorland@hem2.passagen.se>.
    Rewritten by Kai Tietz, Onevision.
@@ -128,13 +128,11 @@ write_res_file (const char *fn,const rc_res_directory *resdir)
   filename = fn;
 
   abfd = windres_open_as_binary (filename, 0);
-  sec = bfd_make_section (abfd, ".data");
+  sec = bfd_make_section_with_flags (abfd, ".data",
+                                    (SEC_HAS_CONTENTS | SEC_ALLOC
+                                     | SEC_LOAD | SEC_DATA));
   if (sec == NULL)
     bfd_fatal ("bfd_make_section");
-  if (! bfd_set_section_flags (abfd, sec,
-                              (SEC_HAS_CONTENTS | SEC_ALLOC
-                               | SEC_LOAD | SEC_DATA)))
-    bfd_fatal ("bfd_set_section_flags");
   /* Requiring this is probably a bug in BFD.  */
   sec->output_section = sec;
 
index 2c6da4283dbc18c057b7dab0f28389b9586ae1fc..70c9160aba95a1f0adb8d4bc581f136b7f0ea0d5 100644 (file)
@@ -1,5 +1,5 @@
 /* windmc.c -- a program to compile Windows message files.
-   Copyright 2007
+   Copyright 2007, 2008
    Free Software Foundation, Inc.
    Written by Kai Tietz, Onevision.
 
@@ -707,13 +707,11 @@ windmc_write_bin (const char *filename, mc_node_lang **nl, int elems)
   if (elems <= 0)
     return;
   mc_bfd.abfd = windmc_open_as_binary (filename);
-  mc_bfd.sec = bfd_make_section (mc_bfd.abfd, ".data");
+  mc_bfd.sec = bfd_make_section_with_flags (mc_bfd.abfd, ".data",
+                                           (SEC_HAS_CONTENTS | SEC_ALLOC
+                                            | SEC_LOAD | SEC_DATA));
   if (mc_bfd.sec == NULL)
     bfd_fatal ("bfd_make_section");
-  if (! bfd_set_section_flags (mc_bfd.abfd, mc_bfd.sec,
-                              (SEC_HAS_CONTENTS | SEC_ALLOC
-                               | SEC_LOAD | SEC_DATA)))
-    bfd_fatal ("bfd_set_section_flags");
   /* Requiring this is probably a bug in BFD.  */
   mc_bfd.sec->output_section = mc_bfd.sec;
 
This page took 0.034269 seconds and 4 git commands to generate.