* emultempl/armelf.em (elf32_arm_add_stub_section): Use
authorAlan Modra <amodra@gmail.com>
Mon, 7 Jul 2008 00:46:51 +0000 (00:46 +0000)
committerAlan Modra <amodra@gmail.com>
Mon, 7 Jul 2008 00:46:51 +0000 (00:46 +0000)
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.

ld/ChangeLog
ld/emultempl/armelf.em
ld/emultempl/avrelf.em
ld/emultempl/hppaelf.em
ld/emultempl/m68hc1xelf.em
ld/emultempl/m68kcoff.em
ld/emultempl/m68kelf.em
ld/emultempl/ppc64elf.em
ld/emultempl/sh64elf.em

index 8ad99bc0f3c08955ed75a1d8ac557988d792b2a7..9a3620525b365e855fb020ed6839d3bac15fd685 100644 (file)
@@ -1,3 +1,17 @@
+2008-07-07  Alan Modra  <amodra@bigpond.net.au>
+
+       * 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.
+
 2008-07-06  Nathan Sidwell  <nathan@codesourcery.com>
 
        * ld.texinfo (File Commands): Document that INCLUDE can be used in
index 6ebb30e96774d6fb495d3cf3a751b6a3ca915653..d142961c3f7dd1a59e05e0572bab861eedab9403 100644 (file)
@@ -276,13 +276,11 @@ elf32_arm_add_stub_section (const char *stub_sec_name,
   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 14b9ac2f17a8b710298d5a0c98f236db5534e7fe..1bd7bb3cae4873a40414667e22948e1b49ad842f 100644 (file)
@@ -122,14 +122,12 @@ avr_elf_create_output_section_statements (void)
 
   /* 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 182ab5307bb6b01800b1629c40f984d4fa29c668..6186cb97213e36e68fe0bc79031d1472d3a61642 100644 (file)
@@ -179,13 +179,11 @@ hppaelf_add_stub_section (const char *stub_sec_name, asection *input_section)
   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 c54eacd5e517157662e089350975746cc8d0efd3..0c1305b62d18fae8d44b17a9efc3f8bb9dc6ed93 100644 (file)
@@ -254,13 +254,11 @@ m68hc11elf_add_stub_section (const char *stub_sec_name,
   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 a79eb2c1a17757d2fbacec95b2a4096927b5db2f..276c3b258aa0d6bf429d585fcaae900faf9c2753 100644 (file)
@@ -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 57a8f1d224716e9cb21de359bf2036fba1787165..441b4897fc8868116cdcd5715ee2d2ba5d2e9e46 100644 (file)
@@ -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 51623b18a4353c498eff3f114ddb638af76e2ef4..9a49fa5a34174cc1f92babbdc832e2da303c3bdf 100644 (file)
@@ -221,13 +221,11 @@ ppc_add_stub_section (const char *stub_sec_name, asection *input_section)
   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 d8cce232307d57e6a6a3975b7b976e7a1e68ef46..5c588ce2c128d380cf07c85eab628a4c7bce31de 100644 (file)
@@ -203,15 +203,13 @@ sh64_elf_${EMULATION_NAME}_before_allocation (void)
                               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"));
                          }