Complain about mbind, ifunc, and unique in final_write
authorAlan Modra <amodra@gmail.com>
Wed, 24 Jul 2019 00:13:30 +0000 (09:43 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 24 Jul 2019 06:42:02 +0000 (16:12 +0930)
It's not as good as complaining in gas/config/obj-elf.c since you lose
any reference to the source file.

bfd/
* elf-bfd.h (struct elf_backend_data): Return bfd_boolean from
elf_backend_final_write_processing, don't pass linker arg.
(_bfd_elf_final_write_processing): Update prototype.
* elf.c (_bfd_elf_write_object_contents): Adjust call.
(_bfd_elf_final_write_processing): Return error on incompatible
OSABI and has_gnu_osabi.  Remove linker arg.
* elf-nacl.h (nacl_final_write_processing): Update prototype.
* elf-vxworks.h (elf_vxworks_final_write_processing): Likewise.
* elfxx-mips.h (_bfd_mips_final_write_processing): Likewise.
(_bfd_mips_elf_final_write_processing): Likewise.
* elf-hppa.h (elf_hppa_final_write_processing): Return status
and remove linker arg.
* elf-m10300.c (_bfd_mn10300_elf_final_write_processing): Likewise.
* elf-nacl.c (nacl_final_write_processing): Likewise.
* elf-vxworks.c (elf_vxworks_final_write_processing): Likewise.
* elf32-arc.c (arc_elf_final_write_processing): Likewise.
* elf32-arm.c (arm_final_write_processing): Likewise.
(elf32_arm_final_write_processing): Likewise.
(elf32_arm_nacl_final_write_processing): Likewise.
(elf32_arm_vxworks_final_write_processing): Likewise.
* elf32-avr.c (bfd_elf_avr_final_write_processing): Likewise.
* elf32-bfin.c (elf32_bfin_final_write_processing): Likewise.
* elf32-cr16.c (_bfd_cr16_elf_final_write_processing): Likewise.
* elf32-cris.c (cris_elf_final_write_processing): Likewise.
* elf32-h8300.c (elf32_h8_final_write_processing): Likewise.
* elf32-lm32.c (lm32_elf_final_write_processing): Likewise.
* elf32-m32r.c (m32r_elf_final_write_processing): Likewise.
* elf32-m68k.c (elf_m68k_final_write_processing): Likewise.
* elf32-mips.c (mips_vxworks_final_write_processing): Likewise.
* elf32-msp430.c (bfd_elf_msp430_final_write_processing): Likewise.
* elf32-nds32.c (nds32_elf_final_write_processing): Likewise.
* elf32-or1k.c (or1k_elf_final_write_processing): Likewise.
* elf32-pj.c (pj_elf_final_write_processing): Likewise.
* elf32-ppc.c (ppc_final_write_processing): Likewise.
(ppc_elf_final_write_processing): Likewise.
(ppc_elf_vxworks_final_write_processing): Likewise.
* elf32-sparc.c (sparc_final_write_processing): Likewise.
(elf32_sparc_final_write_processing): Likewise.
(elf32_sparc_vxworks_final_write_processing): Likewise.
* elf32-v850.c (v850_elf_final_write_processing): Likewise.
* elf32-xc16x.c (elf32_xc16x_final_write_processing): Likewise.
* elf32-xtensa.c (elf_xtensa_final_write_processing): Likewise.
* elf64-ia64-vms.c (elf64_vms_final_write_processing): Likewise.
* elfnn-ia64.c (elfNN_ia64_final_write_processing): Likewise.
* elfxx-mips.c (_bfd_mips_final_write_processing): Likewise.
(_bfd_mips_elf_final_write_processing): Likewise.
gas/
* config/obj-elf.c (obj_elf_section, obj_elf_type): Set has_gnu_osabi.
* testsuite/gas/elf/section12a.d: Update xfails.
* testsuite/gas/elf/section12b.d: Likewise.

37 files changed:
bfd/ChangeLog
bfd/elf-bfd.h
bfd/elf-hppa.h
bfd/elf-m10300.c
bfd/elf-nacl.c
bfd/elf-nacl.h
bfd/elf-vxworks.c
bfd/elf-vxworks.h
bfd/elf.c
bfd/elf32-arc.c
bfd/elf32-arm.c
bfd/elf32-avr.c
bfd/elf32-bfin.c
bfd/elf32-cr16.c
bfd/elf32-cris.c
bfd/elf32-h8300.c
bfd/elf32-lm32.c
bfd/elf32-m32r.c
bfd/elf32-m68k.c
bfd/elf32-mips.c
bfd/elf32-msp430.c
bfd/elf32-nds32.c
bfd/elf32-or1k.c
bfd/elf32-pj.c
bfd/elf32-ppc.c
bfd/elf32-sparc.c
bfd/elf32-v850.c
bfd/elf32-xc16x.c
bfd/elf32-xtensa.c
bfd/elf64-ia64-vms.c
bfd/elfnn-ia64.c
bfd/elfxx-mips.c
bfd/elfxx-mips.h
gas/ChangeLog
gas/config/obj-elf.c
gas/testsuite/gas/elf/section12a.d
gas/testsuite/gas/elf/section12b.d

index 1fe3860d9fa77d6fe9099ef48df3e50fa8d613a8..6d7e42510aad2ac2a847175402fd9309da216d23 100644 (file)
@@ -1,3 +1,52 @@
+2019-07-24  Alan Modra  <amodra@gmail.com>
+
+       * elf-bfd.h (struct elf_backend_data): Return bfd_boolean from
+       elf_backend_final_write_processing, don't pass linker arg.
+       (_bfd_elf_final_write_processing): Update prototype.
+       * elf.c (_bfd_elf_write_object_contents): Adjust call.
+       (_bfd_elf_final_write_processing): Return error on incompatible
+       OSABI and has_gnu_osabi.  Remove linker arg.
+       * elf-nacl.h (nacl_final_write_processing): Update prototype.
+       * elf-vxworks.h (elf_vxworks_final_write_processing): Likewise.
+       * elfxx-mips.h (_bfd_mips_final_write_processing): Likewise.
+       (_bfd_mips_elf_final_write_processing): Likewise.
+       * elf-hppa.h (elf_hppa_final_write_processing): Return status
+       and remove linker arg.
+       * elf-m10300.c (_bfd_mn10300_elf_final_write_processing): Likewise.
+       * elf-nacl.c (nacl_final_write_processing): Likewise.
+       * elf-vxworks.c (elf_vxworks_final_write_processing): Likewise.
+       * elf32-arc.c (arc_elf_final_write_processing): Likewise.
+       * elf32-arm.c (arm_final_write_processing): Likewise.
+       (elf32_arm_final_write_processing): Likewise.
+       (elf32_arm_nacl_final_write_processing): Likewise.
+       (elf32_arm_vxworks_final_write_processing): Likewise.
+       * elf32-avr.c (bfd_elf_avr_final_write_processing): Likewise.
+       * elf32-bfin.c (elf32_bfin_final_write_processing): Likewise.
+       * elf32-cr16.c (_bfd_cr16_elf_final_write_processing): Likewise.
+       * elf32-cris.c (cris_elf_final_write_processing): Likewise.
+       * elf32-h8300.c (elf32_h8_final_write_processing): Likewise.
+       * elf32-lm32.c (lm32_elf_final_write_processing): Likewise.
+       * elf32-m32r.c (m32r_elf_final_write_processing): Likewise.
+       * elf32-m68k.c (elf_m68k_final_write_processing): Likewise.
+       * elf32-mips.c (mips_vxworks_final_write_processing): Likewise.
+       * elf32-msp430.c (bfd_elf_msp430_final_write_processing): Likewise.
+       * elf32-nds32.c (nds32_elf_final_write_processing): Likewise.
+       * elf32-or1k.c (or1k_elf_final_write_processing): Likewise.
+       * elf32-pj.c (pj_elf_final_write_processing): Likewise.
+       * elf32-ppc.c (ppc_final_write_processing): Likewise.
+       (ppc_elf_final_write_processing): Likewise.
+       (ppc_elf_vxworks_final_write_processing): Likewise.
+       * elf32-sparc.c (sparc_final_write_processing): Likewise.
+       (elf32_sparc_final_write_processing): Likewise.
+       (elf32_sparc_vxworks_final_write_processing): Likewise.
+       * elf32-v850.c (v850_elf_final_write_processing): Likewise.
+       * elf32-xc16x.c (elf32_xc16x_final_write_processing): Likewise.
+       * elf32-xtensa.c (elf_xtensa_final_write_processing): Likewise.
+       * elf64-ia64-vms.c (elf64_vms_final_write_processing): Likewise.
+       * elfnn-ia64.c (elfNN_ia64_final_write_processing): Likewise.
+       * elfxx-mips.c (_bfd_mips_final_write_processing): Likewise.
+       (_bfd_mips_elf_final_write_processing): Likewise.
+
 2019-07-24  Alan Modra  <amodra@gmail.com>
 
        * elf-vxworks.c (elf_vxworks_final_write_processing): Don't return
index 01beac6757d6c44a4923837f955c6a065991f175..8b87c66d4a1c0a35e7db8500c0010ddf779741c8 100644 (file)
@@ -1141,10 +1141,9 @@ struct elf_backend_data
     (bfd *, struct bfd_link_info *);
 
   /* A function to do any final processing needed for the ELF file
-     before writing it out.  The LINKER argument is TRUE if this BFD
-     was created by the ELF backend linker.  */
-  void (*elf_backend_final_write_processing)
-    (bfd *, bfd_boolean linker);
+     before writing it out.  */
+  bfd_boolean (*elf_backend_final_write_processing)
+    (bfd *);
 
   /* This function is called by get_program_header_size.  It should
      return the number of additional program segments which this BFD
@@ -2335,7 +2334,7 @@ extern struct bfd_link_hash_entry *bfd_elf_define_start_stop
 
 extern void _bfd_elf_post_process_headers (bfd *, struct bfd_link_info *);
 
-extern void _bfd_elf_final_write_processing (bfd *, bfd_boolean);
+extern bfd_boolean _bfd_elf_final_write_processing (bfd *);
 
 extern const bfd_target *bfd_elf32_object_p
   (bfd *);
index 45b432ee62ef1c8451fe7645d398d453ba27aca1..cc98caeeb0b60984278a08bea066f9a9082404fd 100644 (file)
@@ -923,8 +923,8 @@ elf_hppa_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)
   return TRUE;
 }
 
-static void
-elf_hppa_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+elf_hppa_final_write_processing (bfd *abfd)
 {
   int mach = bfd_get_mach (abfd);
 
@@ -947,7 +947,7 @@ elf_hppa_final_write_processing (bfd *abfd, bfd_boolean linker)
                                         a step backwards with the ELF
                                         based toolchains.  */
                                      | EF_PARISC_TRAPNIL);
-  _bfd_elf_final_write_processing (abfd, linker);
+  return _bfd_elf_final_write_processing (abfd);
 }
 
 /* Comparison function for qsort to sort unwind section during a
index e497e02b0dd325642a098881b634ca7372f27c1a..acc3c54258eee10ddd98e7df51a100d6a45061a8 100644 (file)
@@ -4667,8 +4667,8 @@ elf_mn10300_mach (flagword flags)
    file.  This gets the MN10300 architecture right based on the machine
    number.  */
 
-static void
-_bfd_mn10300_elf_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+_bfd_mn10300_elf_final_write_processing (bfd *abfd)
 {
   unsigned long val;
 
@@ -4690,7 +4690,7 @@ _bfd_mn10300_elf_final_write_processing (bfd *abfd, bfd_boolean linker)
 
   elf_elfheader (abfd)->e_flags &= ~ (EF_MN10300_MACH);
   elf_elfheader (abfd)->e_flags |= val;
-  _bfd_elf_final_write_processing (abfd, linker);
+  return _bfd_elf_final_write_processing (abfd);
 }
 
 static bfd_boolean
index 5f808066913668312fc415d3c8892beb0351cb09..58eebf6d75834b17e96f8593eb4b39d1ae924230 100644 (file)
@@ -320,8 +320,8 @@ nacl_modify_program_headers (bfd *abfd, struct bfd_link_info *info)
   return TRUE;
 }
 
-void
-nacl_final_write_processing (bfd *abfd, bfd_boolean linker)
+bfd_boolean
+nacl_final_write_processing (bfd *abfd)
 {
   struct elf_segment_map *seg;
   for (seg = elf_seg_map (abfd); seg != NULL; seg = seg->next)
@@ -354,5 +354,5 @@ nacl_final_write_processing (bfd *abfd, bfd_boolean linker)
 
        free (fill);
       }
-  _bfd_elf_final_write_processing (abfd, linker);
+  return _bfd_elf_final_write_processing (abfd);
 }
index 384e25fa24b44536fe31ddf0173cd5427ddc8b21..ba28c570f9418ff49280b07043e5ea99b2dd8864 100644 (file)
@@ -18,4 +18,4 @@
 
 bfd_boolean nacl_modify_segment_map (bfd *, struct bfd_link_info *);
 bfd_boolean nacl_modify_program_headers (bfd *, struct bfd_link_info *);
-void nacl_final_write_processing (bfd *, bfd_boolean linker);
+bfd_boolean nacl_final_write_processing (bfd *);
index 4447b36511046b96e88b4abb0e2c40a20e4e3f4a..a7f574c2ef722124967b2d5a3f0c7b9704c2bb3b 100644 (file)
@@ -212,8 +212,8 @@ elf_vxworks_emit_relocs (bfd *output_bfd,
 
 /* Set the sh_link and sh_info fields on the static plt relocation secton.  */
 
-void
-elf_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker)
+bfd_boolean
+elf_vxworks_final_write_processing (bfd *abfd)
 {
   asection * sec;
   struct bfd_elf_section_data *d;
@@ -229,7 +229,7 @@ elf_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker)
       if (sec)
        d->this_hdr.sh_info = elf_section_data (sec)->this_idx;
     }
-  _bfd_elf_final_write_processing (abfd, linker);
+  return _bfd_elf_final_write_processing (abfd);
 }
 
 /* Add the dynamic entries required by VxWorks.  These point to the
index c9aa4902823e56d537666084e95c7e95b8ae3ece..762dd8d135dedc84572d95060e2df50c2ee80475 100644 (file)
@@ -28,7 +28,7 @@ bfd_boolean elf_vxworks_link_output_symbol_hook
 bfd_boolean elf_vxworks_emit_relocs
   (bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *,
    struct elf_link_hash_entry **);
-void elf_vxworks_final_write_processing (bfd *, bfd_boolean);
+bfd_boolean elf_vxworks_final_write_processing (bfd *);
 bfd_boolean elf_vxworks_create_dynamic_sections
   (bfd *, struct bfd_link_info *, asection **);
 bfd_boolean elf_vxworks_add_dynamic_entries (bfd *, struct bfd_link_info *);
index 1c77a7917ab77eeb31429bb342def802e98290f1..f47e88b2ac5af875445866452b5b91393f252be2 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -6568,7 +6568,8 @@ _bfd_elf_write_object_contents (bfd *abfd)
          || !_bfd_elf_strtab_emit (abfd, elf_shstrtab (abfd))))
     return FALSE;
 
-  (*bed->elf_backend_final_write_processing) (abfd, elf_linker (abfd));
+  if (!(*bed->elf_backend_final_write_processing) (abfd))
+    return FALSE;
 
   if (!bed->s->write_shdrs_and_ehdr (abfd))
     return FALSE;
@@ -12123,9 +12124,8 @@ _bfd_elf_post_process_headers (bfd *abfd ATTRIBUTE_UNUSED,
 {
 }
 
-void
-_bfd_elf_final_write_processing (bfd *abfd,
-                                bfd_boolean linker ATTRIBUTE_UNUSED)
+bfd_boolean
+_bfd_elf_final_write_processing (bfd *abfd)
 {
   Elf_Internal_Ehdr *i_ehdrp;  /* ELF file header, internal form.  */
 
@@ -12137,9 +12137,24 @@ _bfd_elf_final_write_processing (bfd *abfd,
   /* Set the osabi field to ELFOSABI_GNU if the binary contains
      SHF_GNU_MBIND sections or symbols of STT_GNU_IFUNC type or
      STB_GNU_UNIQUE binding.  */
-  if (i_ehdrp->e_ident[EI_OSABI] == ELFOSABI_NONE
-      && elf_tdata (abfd)->has_gnu_osabi)
-    i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_GNU;
+  if (elf_tdata (abfd)->has_gnu_osabi != 0)
+    {
+      if (i_ehdrp->e_ident[EI_OSABI] == ELFOSABI_NONE)
+       i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_GNU;
+      else if (i_ehdrp->e_ident[EI_OSABI] != ELFOSABI_GNU
+              && i_ehdrp->e_ident[EI_OSABI] != ELFOSABI_FREEBSD)
+       {
+         if (elf_tdata (abfd)->has_gnu_osabi & elf_gnu_osabi_mbind)
+           _bfd_error_handler (_("GNU_MBIND section is unsupported"));
+         if (elf_tdata (abfd)->has_gnu_osabi & elf_gnu_osabi_ifunc)
+           _bfd_error_handler (_("symbol type STT_GNU_IFUNC is unsupported"));
+         if (elf_tdata (abfd)->has_gnu_osabi & elf_gnu_osabi_unique)
+           _bfd_error_handler (_("symbol binding STB_GNU_UNIQUE is unsupported"));
+         bfd_set_error (bfd_error_bad_value);
+         return FALSE;
+       }
+    }
+  return TRUE;
 }
 
 
index fc4c3ae50a526962ab9cf53723c5778426218902..c7ffc6a6f9df1d05fed79eba32ab83867af22ece 100644 (file)
@@ -1016,8 +1016,8 @@ arc_elf_object_p (bfd * abfd)
 /* The final processing done just before writing out an ARC ELF object file.
    This gets the ARC architecture right based on the machine number.  */
 
-static void
-arc_elf_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+arc_elf_final_write_processing (bfd *abfd)
 {
   unsigned long emf;
   int osver = bfd_elf_get_obj_attr_int (abfd, OBJ_ATTR_PROC,
@@ -1043,7 +1043,7 @@ arc_elf_final_write_processing (bfd *abfd, bfd_boolean linker)
     e_flags |= E_ARC_OSABI_V3;
 
   elf_elfheader (abfd)->e_flags |= e_flags;
-  _bfd_elf_final_write_processing (abfd, linker);
+  return _bfd_elf_final_write_processing (abfd);
 }
 
 #ifdef ARC_ENABLE_DEBUG
index 631394916b7f2b2c615c23c4af6d922ca3d12898..15591bee8ad9b47e73ab71abb8ec84e0303c16bf 100644 (file)
@@ -17915,16 +17915,16 @@ elf32_arm_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
 }
 
 static void
-arm_final_write_processing (bfd *abfd, bfd_boolean linker ATTRIBUTE_UNUSED)
+arm_final_write_processing (bfd *abfd)
 {
   bfd_arm_update_notes (abfd, ARM_NOTE_SECTION);
 }
 
-static void
-elf32_arm_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+elf32_arm_final_write_processing (bfd *abfd)
 {
-  arm_final_write_processing (abfd, linker);
-  _bfd_elf_final_write_processing (abfd, linker);
+  arm_final_write_processing (abfd);
+  return _bfd_elf_final_write_processing (abfd);
 }
 
 /* Return TRUE if this is an unwinding table entry.  */
@@ -20600,11 +20600,11 @@ elf32_arm_nacl_modify_segment_map (bfd *abfd, struct bfd_link_info *info)
          && nacl_modify_segment_map (abfd, info));
 }
 
-static void
-elf32_arm_nacl_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+elf32_arm_nacl_final_write_processing (bfd *abfd)
 {
-  arm_final_write_processing (abfd, linker);
-  nacl_final_write_processing (abfd, linker);
+  arm_final_write_processing (abfd);
+  return nacl_final_write_processing (abfd);
 }
 
 static bfd_vma
@@ -20755,11 +20755,11 @@ elf32_arm_vxworks_link_hash_table_create (bfd *abfd)
   return ret;
 }
 
-static void
-elf32_arm_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+elf32_arm_vxworks_final_write_processing (bfd *abfd)
 {
-  arm_final_write_processing (abfd, linker);
-  elf_vxworks_final_write_processing (abfd, linker);
+  arm_final_write_processing (abfd);
+  return elf_vxworks_final_write_processing (abfd);
 }
 
 #undef  elf32_bed
index 135030b3aad8aa09dbb6f132ea2ea96aa1a3cc3e..e75ac9fc1dbb9d56b6b703d57b49af1cee7b1b19 100644 (file)
@@ -1536,8 +1536,8 @@ elf32_avr_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
    file.  This gets the AVR architecture right based on the machine
    number.  */
 
-static void
-bfd_elf_avr_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+bfd_elf_avr_final_write_processing (bfd *abfd)
 {
   unsigned long val;
 
@@ -1620,7 +1620,7 @@ bfd_elf_avr_final_write_processing (bfd *abfd, bfd_boolean linker)
   elf_elfheader (abfd)->e_machine = EM_AVR;
   elf_elfheader (abfd)->e_flags &= ~ EF_AVR_MACH;
   elf_elfheader (abfd)->e_flags |= val;
-  _bfd_elf_final_write_processing (abfd, linker);
+  return _bfd_elf_final_write_processing (abfd);
 }
 
 /* Set the right machine number.  */
index 5b8f5b92642ae942b1b2f035a4a35e891c803b58..d73bfdaee399325858ca7468b80e447ce93d02a8 100644 (file)
@@ -1133,14 +1133,14 @@ bfd_boolean elf32_bfin_code_in_l1 = 0;
 /* Set by ld emulation if --data-in-l1.  */
 bfd_boolean elf32_bfin_data_in_l1 = 0;
 
-static void
-elf32_bfin_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+elf32_bfin_final_write_processing (bfd *abfd)
 {
   if (elf32_bfin_code_in_l1)
     elf_elfheader (abfd)->e_flags |= EF_BFIN_CODE_IN_L1;
   if (elf32_bfin_data_in_l1)
     elf_elfheader (abfd)->e_flags |= EF_BFIN_DATA_IN_L1;
-  _bfd_elf_final_write_processing (abfd, linker);
+  return _bfd_elf_final_write_processing (abfd);
 }
 
 /* Return TRUE if the name is a local label.
index 3569c81e0ab60b072ebbef4a214502301301584e..7d0a0e558f1461db423e3447dd8bac88bbac200a 100644 (file)
@@ -1673,8 +1673,8 @@ elf_cr16_mach (flagword flags)
    file.  This gets the CR16 architecture right based on the machine
    number.  */
 
-static void
-_bfd_cr16_elf_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+_bfd_cr16_elf_final_write_processing (bfd *abfd)
 {
   unsigned long val;
   switch (bfd_get_mach (abfd))
@@ -1684,8 +1684,8 @@ _bfd_cr16_elf_final_write_processing (bfd *abfd, bfd_boolean linker)
        val = EM_CR16;
        break;
     }
- elf_elfheader (abfd)->e_flags |= val;
-  _bfd_elf_final_write_processing (abfd, linker);
 elf_elfheader (abfd)->e_flags |= val;
+  return _bfd_elf_final_write_processing (abfd);
 }
 
 
index 0fc1eb38cecb5e87c112ec283f6cc73cabc9c63b..5d230562a5cefe39da657f4193b9f036b1ec2e4a 100644 (file)
@@ -3829,8 +3829,8 @@ cris_elf_object_p (bfd *abfd)
 /* Mark presence or absence of leading underscore.  Set machine type
    flags from mach type.  */
 
-static void
-cris_elf_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+cris_elf_final_write_processing (bfd *abfd)
 {
   unsigned long e_flags = elf_elfheader (abfd)->e_flags;
 
@@ -3858,7 +3858,7 @@ cris_elf_final_write_processing (bfd *abfd, bfd_boolean linker)
     }
 
   elf_elfheader (abfd)->e_flags = e_flags;
-  _bfd_elf_final_write_processing (abfd, linker);
+  return _bfd_elf_final_write_processing (abfd);
 }
 
 /* Set the mach type from e_flags value.  */
index 40680fa3f59efdf5b212b4d1b393babe86ca351f..a2f06d5a9285f8b3bfdeb45fc23c8878c463e5ef 100644 (file)
@@ -583,8 +583,8 @@ elf32_h8_mach (flagword flags)
    file.  We use this opportunity to encode the BFD machine type
    into the flags field in the object file.  */
 
-static void
-elf32_h8_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+elf32_h8_final_write_processing (bfd *abfd)
 {
   unsigned long val;
 
@@ -622,7 +622,7 @@ elf32_h8_final_write_processing (bfd *abfd, bfd_boolean linker)
 
   elf_elfheader (abfd)->e_flags &= ~ (EF_H8_MACH);
   elf_elfheader (abfd)->e_flags |= val;
-  _bfd_elf_final_write_processing (abfd, linker);
+  return _bfd_elf_final_write_processing (abfd);
 }
 
 /* Return nonzero if ABFD represents a valid H8 ELF object file; also
index 255dc4e2c0cd45dff92e63b93ed50858839e9b85..5233dbbb67c94cb000ca0368e75598349e08a493 100644 (file)
@@ -555,8 +555,8 @@ lm32_elf_object_p (bfd *abfd)
 
 /* Set machine type flags just before file is written out. */
 
-static void
-lm32_elf_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+lm32_elf_final_write_processing (bfd *abfd)
 {
   elf_elfheader (abfd)->e_machine = EM_LATTICEMICO32;
   elf_elfheader (abfd)->e_flags &=~ EF_LM32_MACH;
@@ -568,7 +568,7 @@ lm32_elf_final_write_processing (bfd *abfd, bfd_boolean linker)
       default:
        abort ();
     }
-  _bfd_elf_final_write_processing (abfd, linker);
+  return _bfd_elf_final_write_processing (abfd);
 }
 
 /* Set the GP value for OUTPUT_BFD.  Returns FALSE if this is a
index 3fcde4a6141565d85ef318c1ba4fbc7517eb0946..2f182e782d266e22bbb4c55fe1cd49e320728fa8 100644 (file)
@@ -3403,8 +3403,8 @@ m32r_elf_object_p (bfd *abfd)
 
 /* Store the machine number in the flags field.  */
 
-static void
-m32r_elf_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+m32r_elf_final_write_processing (bfd *abfd)
 {
   unsigned long val;
 
@@ -3418,7 +3418,7 @@ m32r_elf_final_write_processing (bfd *abfd, bfd_boolean linker)
 
   elf_elfheader (abfd)->e_flags &=~ EF_M32R_ARCH;
   elf_elfheader (abfd)->e_flags |= val;
-  _bfd_elf_final_write_processing (abfd, linker);
+  return _bfd_elf_final_write_processing (abfd);
 }
 
 /* Function to keep M32R specific file flags.  */
index 3840b136de4bac7b1457609ba637f015847118f8..177be5d1d39bbfa78036f5d694fe134dfb0c752d 100644 (file)
@@ -1053,8 +1053,8 @@ elf32_m68k_object_p (bfd *abfd)
 /* Somewhat reverse of elf32_m68k_object_p, this sets the e_flag
    field based on the machine number.  */
 
-static void
-elf_m68k_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+elf_m68k_final_write_processing (bfd *abfd)
 {
   int mach = bfd_get_mach (abfd);
   unsigned long e_flags = elf_elfheader (abfd)->e_flags;
@@ -1107,7 +1107,7 @@ elf_m68k_final_write_processing (bfd *abfd, bfd_boolean linker)
        }
       elf_elfheader (abfd)->e_flags = e_flags;
     }
-  _bfd_elf_final_write_processing (abfd, linker);
+  return _bfd_elf_final_write_processing (abfd);
 }
 
 /* Keep m68k-specific flags in the ELF header.  */
index 370dc90914f8e3bc721e6c4e955f482a059224da..9f8f2bdc260d3131b85bbfeb97cc03cc6ff79066 100644 (file)
@@ -2643,11 +2643,11 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
 #include "elf32-target.h"
 /* Implement elf_backend_final_write_processing for VxWorks.  */
 
-static void
-mips_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+mips_vxworks_final_write_processing (bfd *abfd)
 {
-  _bfd_mips_final_write_processing (abfd, linker);
-  elf_vxworks_final_write_processing (abfd, linker);
+  _bfd_mips_final_write_processing (abfd);
+  return elf_vxworks_final_write_processing (abfd);
 }
 
 #undef TARGET_LITTLE_SYM
index aecc122c004b57b519f079b12c79425251c490c6..fe5fd8ff8c109467be5e8b385a89089a4f2faa3b 100644 (file)
@@ -1385,8 +1385,8 @@ elf32_msp430_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED,
    file.  This gets the MSP430 architecture right based on the machine
    number.  */
 
-static void
-bfd_elf_msp430_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+bfd_elf_msp430_final_write_processing (bfd *abfd)
 {
   unsigned long val;
 
@@ -1421,7 +1421,7 @@ bfd_elf_msp430_final_write_processing (bfd *abfd, bfd_boolean linker)
   elf_elfheader (abfd)->e_machine = EM_MSP430;
   elf_elfheader (abfd)->e_flags &= ~EF_MSP430_MACH;
   elf_elfheader (abfd)->e_flags |= val;
-  _bfd_elf_final_write_processing (abfd, linker);
+  return _bfd_elf_final_write_processing (abfd);
 }
 
 /* Set the right machine number.  */
index 9959cbe5e7a462b3ab96ca5bb1d00d7829aca8b4..27ffea2e69284b12c63725cdb6ac77dcb8ab5d4e 100644 (file)
@@ -6672,8 +6672,8 @@ nds32_elf_object_p (bfd *abfd)
 
 /* Store the machine number in the flags field.  */
 
-static void
-nds32_elf_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+nds32_elf_final_write_processing (bfd *abfd)
 {
   unsigned long val;
   static unsigned int cur_mach = 0;
@@ -6710,7 +6710,7 @@ nds32_elf_final_write_processing (bfd *abfd, bfd_boolean linker)
 
   elf_elfheader (abfd)->e_flags &= ~EF_NDS_ARCH;
   elf_elfheader (abfd)->e_flags |= val;
-  _bfd_elf_final_write_processing (abfd, linker);
+  return _bfd_elf_final_write_processing (abfd);
 }
 
 /* Function to keep NDS32 specific file flags.  */
index 9b795fb06ed30b56ca8a1a06eb8a952db6ac76c9..c2069a3180ea5fab4bad8c66dc74ed4559ed06aa 100644 (file)
@@ -3156,8 +3156,8 @@ or1k_elf_object_p (bfd *abfd)
 
 /* Store the machine number in the flags field.  */
 
-static void
-or1k_elf_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+or1k_elf_final_write_processing (bfd *abfd)
 {
   switch (bfd_get_mach (abfd))
     {
@@ -3168,7 +3168,7 @@ or1k_elf_final_write_processing (bfd *abfd, bfd_boolean linker)
       elf_elfheader (abfd)->e_flags |= EF_OR1K_NODELAY;
       break;
     }
-  _bfd_elf_final_write_processing (abfd, linker);
+  return _bfd_elf_final_write_processing (abfd);
 }
 
 static bfd_boolean
index d4fcebc0f2293aa6dc8fdd07b268c6ba3e8515e8..14ccf5f7267cabc5e6f02333a66fbaeac0757f98 100644 (file)
@@ -336,12 +336,12 @@ pj_elf_info_to_howto (bfd *abfd,
 /* Take this moment to fill in the special picoJava bits in the
    e_flags field.  */
 
-static void
-pj_elf_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+pj_elf_final_write_processing (bfd *abfd)
 {
   elf_elfheader (abfd)->e_flags |= EF_PICOJAVA_ARCH;
   elf_elfheader (abfd)->e_flags |= EF_PICOJAVA_GNUCALLS;
-  _bfd_elf_final_write_processing (abfd, linker);
+  return _bfd_elf_final_write_processing (abfd);
 }
 
 #define TARGET_BIG_SYM         pj_elf32_vec
index b1ae0de4e5bb1a7c6e867b7ddc6cfeab5c7a2ad4..e683590f417801cb6ea6d60aca4beb07e41e7b0e 100644 (file)
@@ -1705,7 +1705,7 @@ ppc_elf_write_section (bfd *abfd ATTRIBUTE_UNUSED,
 /* Finally we can generate the output section.  */
 
 static void
-ppc_final_write_processing (bfd *abfd, bfd_boolean linker ATTRIBUTE_UNUSED)
+ppc_final_write_processing (bfd *abfd)
 {
   bfd_byte *buffer;
   asection *asec;
@@ -1757,11 +1757,11 @@ ppc_final_write_processing (bfd *abfd, bfd_boolean linker ATTRIBUTE_UNUSED)
   apuinfo_list_finish ();
 }
 
-static void
-ppc_elf_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+ppc_elf_final_write_processing (bfd *abfd)
 {
-  ppc_final_write_processing (abfd, linker);
-  _bfd_elf_final_write_processing (abfd, linker);
+  ppc_final_write_processing (abfd);
+  return _bfd_elf_final_write_processing (abfd);
 }
 \f
 static bfd_boolean
@@ -10494,11 +10494,11 @@ ppc_elf_vxworks_add_symbol_hook (bfd *abfd,
   return ppc_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp);
 }
 
-static void
-ppc_elf_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+ppc_elf_vxworks_final_write_processing (bfd *abfd)
 {
-  ppc_final_write_processing (abfd, linker);
-  elf_vxworks_final_write_processing (abfd, linker);
+  ppc_final_write_processing (abfd);
+  return elf_vxworks_final_write_processing (abfd);
 }
 
 /* On VxWorks, we emit relocations against _PROCEDURE_LINKAGE_TABLE_, so
index e6d18d377c715feb17b35fdc7e714b4ff5846304..3304ec9fc16ffad08a13efa63242a5b4c4b8cae2 100644 (file)
@@ -117,7 +117,7 @@ elf32_sparc_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
    We need to set the e_machine field appropriately.  */
 
 static void
-sparc_final_write_processing (bfd *abfd, bfd_boolean linker ATTRIBUTE_UNUSED)
+sparc_final_write_processing (bfd *abfd)
 {
   switch (bfd_get_mach (abfd))
     {
@@ -156,11 +156,11 @@ sparc_final_write_processing (bfd *abfd, bfd_boolean linker ATTRIBUTE_UNUSED)
     }
 }
 
-static void
-elf32_sparc_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+elf32_sparc_final_write_processing (bfd *abfd)
 {
-  sparc_final_write_processing (abfd, linker);
-  _bfd_elf_final_write_processing (abfd, linker);
+  sparc_final_write_processing (abfd);
+  return _bfd_elf_final_write_processing (abfd);
 }
 
 /* Used to decide how to sort relocs in an optimal manner for the
@@ -327,11 +327,11 @@ elf32_sparc_vxworks_link_hash_table_create (bfd *abfd)
 /* A final_write_processing hook that does both the SPARC- and VxWorks-
    specific handling.  */
 
-static void
-elf32_sparc_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+elf32_sparc_vxworks_final_write_processing (bfd *abfd)
 {
-  sparc_final_write_processing (abfd, linker);
-  elf_vxworks_final_write_processing (abfd, linker);
+  sparc_final_write_processing (abfd);
+  return elf_vxworks_final_write_processing (abfd);
 }
 
 #undef  TARGET_BIG_SYM
index 14bffc27aa20ed1108bc00a7ed1eda6c03092479..74e15463212b9d4c1842ab7cd6cda70bc34e3af6 100644 (file)
@@ -2718,8 +2718,8 @@ v850_elf_object_p (bfd *abfd)
 
 /* Store the machine number in the flags field.  */
 
-static void
-v850_elf_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+v850_elf_final_write_processing (bfd *abfd)
 {
   unsigned long val;
 
@@ -2749,7 +2749,7 @@ v850_elf_final_write_processing (bfd *abfd, bfd_boolean linker)
     default:
       break;
     }
-  _bfd_elf_final_write_processing (abfd, linker);
+  return _bfd_elf_final_write_processing (abfd);
 }
 
 /* Function to keep V850 specific file flags.  */
index ef2a5feba2afa94b18083e1938abe78ab7a2ee35..d000fd56c8544f62ec4e8f9e859ff05119b10070 100644 (file)
@@ -416,8 +416,8 @@ elf32_xc16x_relocate_section (bfd *output_bfd,
 }
 
 
-static void
-elf32_xc16x_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+elf32_xc16x_final_write_processing (bfd *abfd)
 {
   unsigned long val;
 
@@ -438,7 +438,7 @@ elf32_xc16x_final_write_processing (bfd *abfd, bfd_boolean linker)
     }
 
   elf_elfheader (abfd)->e_flags |= val;
-  _bfd_elf_final_write_processing (abfd, linker);
+  return _bfd_elf_final_write_processing (abfd);
 }
 
 static unsigned long
index 40edb467e5ed335c358412b5e5ef0c6ab8b587db..93394547ce4a311c43ed3c06f4645a5c5444b06e 100644 (file)
@@ -3462,8 +3462,8 @@ elf_xtensa_object_p (bfd *abfd)
    file.  This gets the Xtensa architecture right based on the machine
    number.  */
 
-static void
-elf_xtensa_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+elf_xtensa_final_write_processing (bfd *abfd)
 {
   int mach;
   unsigned long val = elf_elfheader (abfd)->e_flags & EF_XTENSA_MACH;
@@ -3479,7 +3479,7 @@ elf_xtensa_final_write_processing (bfd *abfd, bfd_boolean linker)
 
   elf_elfheader (abfd)->e_flags &= ~EF_XTENSA_MACH;
   elf_elfheader (abfd)->e_flags |= val;
-  _bfd_elf_final_write_processing (abfd, linker);
+  return _bfd_elf_final_write_processing (abfd);
 }
 
 
index 0c7144a6f765e641c7ecfa0f84150a29af2d41ad..0ae9f353f48b0be1dc64fc0688143c9cc635e311 100644 (file)
@@ -4659,8 +4659,8 @@ elf64_vms_section_processing (bfd *abfd ATTRIBUTE_UNUSED,
 /* The final processing done just before writing out a VMS IA-64 ELF
    object file.  */
 
-static void
-elf64_vms_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+elf64_vms_final_write_processing (bfd *abfd)
 {
   Elf_Internal_Shdr *hdr;
   asection *s;
@@ -4695,7 +4695,7 @@ elf64_vms_final_write_processing (bfd *abfd, bfd_boolean linker)
       elf_elfheader (abfd)->e_flags = flags;
       elf_flags_init (abfd) = TRUE;
     }
-  _bfd_elf_final_write_processing (abfd, linker);
+  return _bfd_elf_final_write_processing (abfd);
 }
 
 static bfd_boolean
index 1c9a9042072c9bc30b89a6ba19e6784e10ee60c9..65471dd4a49bd046a83b9c6029052a1f257b2066 100644 (file)
@@ -1002,8 +1002,8 @@ elfNN_ia64_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr,
 /* The final processing done just before writing out an IA-64 ELF
    object file.  */
 
-static void
-elfNN_ia64_final_write_processing (bfd *abfd, bfd_boolean linker)
+static bfd_boolean
+elfNN_ia64_final_write_processing (bfd *abfd)
 {
   Elf_Internal_Shdr *hdr;
   asection *s;
@@ -1035,7 +1035,7 @@ elfNN_ia64_final_write_processing (bfd *abfd, bfd_boolean linker)
       elf_elfheader(abfd)->e_flags = flags;
       elf_flags_init (abfd) = TRUE;
     }
-  _bfd_elf_final_write_processing (abfd, linker);
+  return _bfd_elf_final_write_processing (abfd);
 }
 
 /* Hook called by the linker routine which adds symbols from an object
index f0c092c0f900fa9ce759b16c630dac0ce35542ab..29ae4559266d8d43e7f99b98a5e02dafd0219e1b 100644 (file)
@@ -12358,8 +12358,7 @@ _bfd_mips_elf_sort_relocs_p (asection *sec)
    number.  This is used by both the 32-bit and the 64-bit ABI.  */
 
 void
-_bfd_mips_final_write_processing (bfd *abfd,
-                                 bfd_boolean linker ATTRIBUTE_UNUSED)
+_bfd_mips_final_write_processing (bfd *abfd)
 {
   unsigned int i;
   Elf_Internal_Shdr **hdrpp;
@@ -12439,11 +12438,11 @@ _bfd_mips_final_write_processing (bfd *abfd,
     }
 }
 
-void
-_bfd_mips_elf_final_write_processing (bfd *abfd, bfd_boolean linker)
+bfd_boolean
+_bfd_mips_elf_final_write_processing (bfd *abfd)
 {
-  _bfd_mips_final_write_processing (abfd, linker);
-  _bfd_elf_final_write_processing (abfd, linker);
+  _bfd_mips_final_write_processing (abfd);
+  return _bfd_elf_final_write_processing (abfd);
 }
 \f
 /* When creating an IRIX5 executable, we need REGINFO and RTPROC
index a76680a917db26c907f8fb17ed8a4b854dacd4a1..0a901c6208a48275292894c354f60f73508bcd7e 100644 (file)
@@ -70,9 +70,9 @@ extern bfd_boolean _bfd_mips_elf_finish_dynamic_sections
 extern bfd_boolean _bfd_mips_elf_sort_relocs_p
   (asection *);
 extern void _bfd_mips_final_write_processing
-  (bfd *, bfd_boolean);
-extern void _bfd_mips_elf_final_write_processing
-  (bfd *, bfd_boolean);
+  (bfd *);
+extern bfd_boolean _bfd_mips_elf_final_write_processing
+  (bfd *);
 extern int _bfd_mips_elf_additional_program_headers
   (bfd *, struct bfd_link_info *);
 extern bfd_boolean _bfd_mips_elf_modify_segment_map
index fcde8b080ac13715a534b0e76369e22e9ae9275b..c08ccbc9b60ecbb8bba6e58c22f139ca97dbb26a 100644 (file)
@@ -1,3 +1,9 @@
+2019-07-24  Alan Modra  <amodra@gmail.com>
+
+       * config/obj-elf.c (obj_elf_section, obj_elf_type): Set has_gnu_osabi.
+       * testsuite/gas/elf/section12a.d: Update xfails.
+       * testsuite/gas/elf/section12b.d: Likewise.
+
 2019-07-24  Alan Modra  <amodra@gmail.com>
 
        * testsuite/gas/elf/section12a.d: xfail visium and cloudabi.
index fd2c943771fdb8bce67ef9e63bcc09596acea43d..bdf3da811999b18279b7d866b2e395cef7e3a565 100644 (file)
@@ -1242,6 +1242,7 @@ done:
               && bed->elf_osabi != ELFOSABI_FREEBSD)
        as_bad (_("GNU_MBIND section is supported only by GNU "
                  "and FreeBSD targets"));
+      elf_tdata (stdoutput)->has_gnu_osabi |= elf_gnu_osabi_mbind;
     }
   elf_section_flags (now_seg) |= gnu_attr;
 
@@ -2060,6 +2061,7 @@ obj_elf_type (int ignore ATTRIBUTE_UNUSED)
               && bed->elf_osabi != ELFOSABI_FREEBSD)
        as_bad (_("symbol type \"%s\" is supported only by GNU "
                  "and FreeBSD targets"), type_name);
+      elf_tdata (stdoutput)->has_gnu_osabi |= elf_gnu_osabi_ifunc;
       type = BSF_FUNCTION | BSF_GNU_INDIRECT_FUNCTION;
     }
   else if (strcmp (type_name, "gnu_unique_object") == 0)
@@ -2072,6 +2074,7 @@ obj_elf_type (int ignore ATTRIBUTE_UNUSED)
       else if (bed->elf_osabi != ELFOSABI_GNU)
        as_bad (_("symbol type \"%s\" is supported only by GNU targets"),
                type_name);
+      elf_tdata (stdoutput)->has_gnu_osabi |= elf_gnu_osabi_unique;
       type = BSF_OBJECT | BSF_GNU_UNIQUE;
     }
 #ifdef md_elf_symbol_type
index 5b764afbe26677d277cedef8d2cdeb2885bf7c62..84c032f90e05cb12ebe632bff4959426c9364d35 100644 (file)
@@ -3,7 +3,7 @@
 #readelf: -Sg --wide
 #name: mbind sections
 # A number of targets do not support SHF_GNU_MBIND
-#xfail: msp430-*-* visium-*-*
+#xfail: arm*-*-netbsdelf* arm*-*-nto* msp430-*-* visium-*-*
 #xfail: *-*-hpux* *-*-cloudabi
 
 #...
index a8406c30576c56ad5ff98187a36ceae53ec8af3d..847f9a8a18c79313fc1d721d8c7fadc910453118 100644 (file)
@@ -6,7 +6,7 @@
 # expected below.
 #xfail: rx-*-*
 # A number of targets do not support SHF_GNU_MBIND
-#xfail: msp430-*-* visium-*-*
+#xfail: arm*-*-netbsdelf* arm*-*-nto* msp430-*-* visium-*-*
 #xfail: *-*-hpux* *-*-cloudabi
 
 #...
This page took 0.062621 seconds and 4 git commands to generate.