This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Small tidy


Consolidate make_section and set_section_flags calls.

binutils/
	* 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.
ld/
	* emultempl/armelf.em (elf32_arm_add_stub_section): Use
	bfd_make_section_with_flags.
	* emultempl/avrelf.em (avr_elf_create_output_section_statements):
	Likewise.
	* emultempl/hppaelf.em (hppaelf_add_stub_section): Likewise.
	* emultempl/m68hc1xelf.em (m68hc11elf_add_stub_section): Likewise.
	* emultempl/m68kcoff.em (gld${EMULATION_NAME}_after_open): Likewise.
	* emultempl/m68kelf.em (m68k_elf_after_open): Likewise.
	* emultempl/ppc64elf.em (ppc_add_stub_section): Likewise.
	* emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation):
	Likewise.

Index: binutils/ieee.c
===================================================================
RCS file: /cvs/src/src/binutils/ieee.c,v
retrieving revision 1.20
diff -u -p -r1.20 ieee.c
--- binutils/ieee.c	5 Jul 2007 16:54:45 -0000	1.20
+++ binutils/ieee.c	2 Jul 2008 09:25:25 -0000
@@ -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,16 +4676,12 @@ write_ieee_debugging_info (bfd *abfd, vo
       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;
 
       size = 0;
Index: binutils/nlmconv.c
===================================================================
RCS file: /cvs/src/src/binutils/nlmconv.c,v
retrieving revision 1.32
diff -u -p -r1.32 nlmconv.c
--- binutils/nlmconv.c	5 Jul 2007 16:54:45 -0000	1.32
+++ binutils/nlmconv.c	2 Jul 2008 09:25:26 -0000
@@ -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 *ou
 
   /* 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 *ou
   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: binutils/rescoff.c
===================================================================
RCS file: /cvs/src/src/binutils/rescoff.c,v
retrieving revision 1.10
diff -u -p -r1.10 rescoff.c
--- binutils/rescoff.c	5 Jul 2007 16:54:45 -0000	1.10
+++ binutils/rescoff.c	2 Jul 2008 09:25:29 -0000
@@ -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, c
   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: binutils/resres.c
===================================================================
RCS file: /cvs/src/src/binutils/resres.c,v
retrieving revision 1.11
diff -u -p -r1.11 resres.c
--- binutils/resres.c	5 Jul 2007 16:54:45 -0000	1.11
+++ binutils/resres.c	2 Jul 2008 09:25:29 -0000
@@ -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_
   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: binutils/windmc.c
===================================================================
RCS file: /cvs/src/src/binutils/windmc.c,v
retrieving revision 1.3
diff -u -p -r1.3 windmc.c
--- binutils/windmc.c	9 Jan 2008 10:40:32 -0000	1.3
+++ binutils/windmc.c	2 Jul 2008 09:25:30 -0000
@@ -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, 
   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;
 
Index: ld/emultempl/armelf.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/armelf.em,v
retrieving revision 1.63
diff -u -p -r1.63 armelf.em
--- ld/emultempl/armelf.em	28 May 2008 15:38:36 -0000	1.63
+++ ld/emultempl/armelf.em	2 Jul 2008 09:25:46 -0000
@@ -276,13 +276,11 @@ elf32_arm_add_stub_section (const char *
   lang_output_section_statement_type *os;
   struct hook_stub_info info;
 
-  stub_sec = bfd_make_section_anyway (stub_file->the_bfd, stub_sec_name);
-  if (stub_sec == NULL)
-    goto err_ret;
-
   flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE
 	   | SEC_HAS_CONTENTS | SEC_RELOC | SEC_IN_MEMORY | SEC_KEEP);
-  if (!bfd_set_section_flags (stub_file->the_bfd, stub_sec, flags))
+  stub_sec = bfd_make_section_anyway_with_flags (stub_file->the_bfd,
+						 stub_sec_name, flags);
+  if (stub_sec == NULL)
     goto err_ret;
 
   bfd_set_section_alignment (stub_file->the_bfd, stub_sec, 3);
Index: ld/emultempl/avrelf.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/avrelf.em,v
retrieving revision 1.6
diff -u -p -r1.6 avrelf.em
--- ld/emultempl/avrelf.em	15 Feb 2008 03:35:53 -0000	1.6
+++ ld/emultempl/avrelf.em	2 Jul 2008 09:25:46 -0000
@@ -122,14 +122,12 @@ avr_elf_create_output_section_statements
 
   /* Now we add the stub section.  */
 
-  avr_stub_section = bfd_make_section_anyway (stub_file->the_bfd,
-                                              ".trampolines");
-  if (avr_stub_section == NULL)
-    goto err_ret;
-
   flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE
            | SEC_HAS_CONTENTS | SEC_RELOC | SEC_IN_MEMORY | SEC_KEEP);
-  if (!bfd_set_section_flags (stub_file->the_bfd, avr_stub_section, flags))
+  avr_stub_section = bfd_make_section_anyway_with_flags (stub_file->the_bfd,
+							 ".trampolines",
+							 flags);
+  if (avr_stub_section == NULL)
     goto err_ret;
 
   avr_stub_section->alignment_power = 1;
Index: ld/emultempl/hppaelf.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/hppaelf.em,v
retrieving revision 1.51
diff -u -p -r1.51 hppaelf.em
--- ld/emultempl/hppaelf.em	15 Feb 2008 09:03:02 -0000	1.51
+++ ld/emultempl/hppaelf.em	2 Jul 2008 09:25:46 -0000
@@ -179,13 +179,11 @@ hppaelf_add_stub_section (const char *st
   lang_output_section_statement_type *os;
   struct hook_stub_info info;
 
-  stub_sec = bfd_make_section_anyway (stub_file->the_bfd, stub_sec_name);
-  if (stub_sec == NULL)
-    goto err_ret;
-
   flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE
 	   | SEC_HAS_CONTENTS | SEC_RELOC | SEC_IN_MEMORY | SEC_KEEP);
-  if (!bfd_set_section_flags (stub_file->the_bfd, stub_sec, flags))
+  stub_sec = bfd_make_section_anyway_with_flags (stub_file->the_bfd,
+						 stub_sec_name, flags);
+  if (stub_sec == NULL)
     goto err_ret;
 
   output_section = input_section->output_section;
Index: ld/emultempl/m68hc1xelf.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/m68hc1xelf.em,v
retrieving revision 1.11
diff -u -p -r1.11 m68hc1xelf.em
--- ld/emultempl/m68hc1xelf.em	15 Feb 2008 03:35:53 -0000	1.11
+++ ld/emultempl/m68hc1xelf.em	2 Jul 2008 09:25:46 -0000
@@ -254,13 +254,11 @@ m68hc11elf_add_stub_section (const char 
   lang_output_section_statement_type *os;
   struct hook_stub_info info;
 
-  stub_sec = bfd_make_section_anyway (stub_file->the_bfd, stub_sec_name);
-  if (stub_sec == NULL)
-    goto err_ret;
-
   flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE
 	   | SEC_HAS_CONTENTS | SEC_RELOC | SEC_IN_MEMORY | SEC_KEEP);
-  if (!bfd_set_section_flags (stub_file->the_bfd, stub_sec, flags))
+  stub_sec = bfd_make_section_anyway_with_flags (stub_file->the_bfd,
+						 stub_sec_name, flags);
+  if (stub_sec == NULL)
     goto err_ret;
 
   output_section = tramp_section->output_section;
Index: ld/emultempl/m68kcoff.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/m68kcoff.em,v
retrieving revision 1.19
diff -u -p -r1.19 m68kcoff.em
--- ld/emultempl/m68kcoff.em	19 Jul 2007 19:56:10 -0000	1.19
+++ ld/emultempl/m68kcoff.em	2 Jul 2008 09:25:46 -0000
@@ -4,7 +4,7 @@ fragment <<EOF
 /* This file is is generated by a shell script.  DO NOT EDIT! */
 
 /* Handle embedded relocs for m68k.
-   Copyright 2000, 2002, 2003, 2004, 2005, 2007
+   Copyright 2000, 2002, 2003, 2004, 2005, 2007, 2008
    Free Software Foundation, Inc.
    Written by Michael Sokolov <msokolov@ivan.Harhan.ORG>, based on generic.em
    by Steve Chamberlain <steve@cygnus.com>, embedded relocs code based on
@@ -88,13 +88,12 @@ gld${EMULATION_NAME}_after_open (void)
 	{
 	  asection *relsec;
 
-	  relsec = bfd_make_section (abfd, ".emreloc");
+	  relsec = bfd_make_section_with_flags (abfd, ".emreloc",
+						(SEC_ALLOC
+						 | SEC_LOAD
+						 | SEC_HAS_CONTENTS
+						 | SEC_IN_MEMORY));
 	  if (relsec == NULL
-	      || ! bfd_set_section_flags (abfd, relsec,
-					  (SEC_ALLOC
-					   | SEC_LOAD
-					   | SEC_HAS_CONTENTS
-					   | SEC_IN_MEMORY))
 	      || ! bfd_set_section_alignment (abfd, relsec, 2)
 	      || ! bfd_set_section_size (abfd, relsec,
 					 datasec->reloc_count * 12))
Index: ld/emultempl/m68kelf.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/m68kelf.em,v
retrieving revision 1.11
diff -u -p -r1.11 m68kelf.em
--- ld/emultempl/m68kelf.em	21 May 2008 12:01:35 -0000	1.11
+++ ld/emultempl/m68kelf.em	2 Jul 2008 09:25:46 -0000
@@ -100,13 +100,12 @@ m68k_elf_after_open (void)
 	    {
 	      asection *relsec;
 
-	      relsec = bfd_make_section (abfd, ".emreloc");
+	      relsec = bfd_make_section_with_flags (abfd, ".emreloc",
+						    (SEC_ALLOC
+						    | SEC_LOAD
+						    | SEC_HAS_CONTENTS
+						    | SEC_IN_MEMORY));
 	      if (relsec == NULL
-		  || ! bfd_set_section_flags (abfd, relsec,
-					      (SEC_ALLOC
-					       | SEC_LOAD
-					       | SEC_HAS_CONTENTS
-					       | SEC_IN_MEMORY))
 		  || ! bfd_set_section_alignment (abfd, relsec, 2)
 		  || ! bfd_set_section_size (abfd, relsec,
 					     datasec->reloc_count * 12))
Index: ld/emultempl/ppc64elf.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/ppc64elf.em,v
retrieving revision 1.59
diff -u -p -r1.59 ppc64elf.em
--- ld/emultempl/ppc64elf.em	15 Feb 2008 09:03:02 -0000	1.59
+++ ld/emultempl/ppc64elf.em	2 Jul 2008 09:25:46 -0000
@@ -221,13 +221,11 @@ ppc_add_stub_section (const char *stub_s
   lang_output_section_statement_type *os;
   struct hook_stub_info info;
 
-  stub_sec = bfd_make_section_anyway (stub_file->the_bfd, stub_sec_name);
-  if (stub_sec == NULL)
-    goto err_ret;
-
   flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE
 	   | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_KEEP);
-  if (!bfd_set_section_flags (stub_file->the_bfd, stub_sec, flags))
+  stub_sec = bfd_make_section_anyway_with_flags (stub_file->the_bfd,
+						 stub_sec_name, flags);
+  if (stub_sec == NULL)
     goto err_ret;
 
   output_section = input_section->output_section;
Index: ld/emultempl/sh64elf.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/sh64elf.em,v
retrieving revision 1.13
diff -u -p -r1.13 sh64elf.em
--- ld/emultempl/sh64elf.em	15 Feb 2008 03:35:53 -0000	1.13
+++ ld/emultempl/sh64elf.em	2 Jul 2008 09:25:46 -0000
@@ -203,15 +203,13 @@ sh64_elf_${EMULATION_NAME}_before_alloca
 			       sh64_elf_section_data; no need to set it
 			       specifically here.  */
 			    cranges
-			      = bfd_make_section (link_info.output_bfd,
-						  SH64_CRANGES_SECTION_NAME);
-			    if (cranges == NULL
-				|| !bfd_set_section_flags (link_info.output_bfd,
-							   cranges,
-							   SEC_LINKER_CREATED
-							   | SEC_KEEP
-							   | SEC_HAS_CONTENTS
-							   | SEC_DEBUGGING))
+			      = bfd_make_section_with_flags (link_info.output_bfd,
+							     SH64_CRANGES_SECTION_NAME,
+							     SEC_LINKER_CREATED
+							     | SEC_KEEP
+							     | SEC_HAS_CONTENTS
+							     | SEC_DEBUGGING);
+			    if (cranges == NULL)
 			      einfo
 				(_("%P%E%F: Can't make .cranges section\n"));
 			  }

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]