summaryrefslogtreecommitdiff
path: root/bfd/elf32-sparc.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2016-04-14 12:04:09 +0100
committerNick Clifton <nickc@redhat.com>2016-04-14 12:04:09 +0100
commit84865015459b4e9e8ac67f9b91617fbd856d5119 (patch)
tree744eddbeb143af1555bb6e24a2962536f9319c38 /bfd/elf32-sparc.c
parent8dc483a0b6cf73204ce438f4abf2efd323d97e40 (diff)
downloadbinutils-gdb-84865015459b4e9e8ac67f9b91617fbd856d5119.tar.gz
Fix copying Solaris binaries with objcopy.
PR target/19938 bfd * elf-bbfd.h (struct elf_backend_data): New field: elf_strtab_flags. New field: elf_backend_set_special_section_info_and_link * elfxx-target.h (elf_backend_strtab_flags): Define if not already defined. (elf_backend_set_special_section_info_and_link): Define if not already defined. (elfNN_bed): Use elf_backend_set_special_section_info_and_link and elf_backend_strtab_flags macros to initialise fields in structure. * elf.c (_bfd_elf_make_section_from_shdr): Check for SHF_STRINGS being set even if SHF_MERGE is not set. (elf_fake_sections): Likewise. (section_match): New function. Matches two ELF sections based upon fixed characteristics. (find_link): New function. Locates a section in a BFD that matches a section in a different BFD. (_bfd_elf_copy_private_bfd_data): Copy the sh_info and sh_link fields of reserved sections. (bfd_elf_compute_section_file_positions): Set the flags for the .shstrtab section based upon the elf_strtab_flags field in the elf_backend_data structure. (swap_out_syms): Likewise for the .strtab section. * elflink.c (bfd_elf_final_link): Set the flags for the .strtab section based upon the elf_strtab_flags field in the elf_backend_data structure. * elf32-i386.c (elf32_i386_set_special_info_link): New function. (elf_backend_strtab_flags): Set to SHF_STRINGS for Solaris targets. (elf_backend_set_special_section_info_and_link): Define for Solaris targets. * elf32-sparc.c: Likewise. * elf64-x86-64.c: Likewise. binutils* testsuite/binutils-all/i386/compressed-1b.d: Allow for the string sections possibly having the SHF_STRINGS flag bit set. * testsuite/binutils-all/i386/compressed-1c.d: Likewise. * testsuite/binutils-all/readelf.s: Likewise. * testsuite/binutils-all/readelf.s-64: Likewise. * testsuite/binutils-all/x86-64/compressed-1b.d: Likewise. * testsuite/binutils-all/x86-64/compressed-1c.d: Likewise. gas * testsuite/gas/i386/ilp32/x86-64-unwind.d: Allow for the string sections possibly having the SHF_STRINGS flag bit set. * testsuite/gas/i386/x86-64-unwind.d: Likewise.
Diffstat (limited to 'bfd/elf32-sparc.c')
-rw-r--r--bfd/elf32-sparc.c45
1 files changed, 32 insertions, 13 deletions
diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c
index 213d20a1382..c045854f89a 100644
--- a/bfd/elf32-sparc.c
+++ b/bfd/elf32-sparc.c
@@ -258,9 +258,26 @@ elf32_sparc_add_symbol_hook (bfd * abfd,
/* The 32-bit static TLS arena size is rounded to the nearest 8-byte
boundary. */
-#undef elf_backend_static_tls_alignment
+#undef elf_backend_static_tls_alignment
#define elf_backend_static_tls_alignment 8
+#undef elf_backend_strtab_flags
+#define elf_backend_strtab_flags SHF_STRINGS
+
+static bfd_boolean
+elf32_sparc_set_special_info_link (const bfd *ibfd ATTRIBUTE_UNUSED,
+ bfd *obfd ATTRIBUTE_UNUSED,
+ const Elf_Internal_Shdr *isection ATTRIBUTE_UNUSED,
+ Elf_Internal_Shdr *osection ATTRIBUTE_UNUSED)
+{
+ /* PR 19938: FIXME: Need to add code for setting the sh_info
+ and sh_link fields of Solaris specific section types. */
+ return FALSE;
+}
+
+#undef elf_backend_set_special_section_info_and_link
+#define elf_backend_set_special_section_info_and_link elf32_sparc_set_special_info_link
+
#include "elf32-target.h"
/* A wrapper around _bfd_sparc_elf_link_hash_table_create that identifies
@@ -292,39 +309,41 @@ elf32_sparc_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker)
elf_vxworks_final_write_processing (abfd, linker);
}
-#undef TARGET_BIG_SYM
+#undef TARGET_BIG_SYM
#define TARGET_BIG_SYM sparc_elf32_vxworks_vec
-#undef TARGET_BIG_NAME
+#undef TARGET_BIG_NAME
#define TARGET_BIG_NAME "elf32-sparc-vxworks"
-#undef ELF_MINPAGESIZE
+#undef ELF_MINPAGESIZE
#define ELF_MINPAGESIZE 0x1000
#undef bfd_elf32_bfd_link_hash_table_create
#define bfd_elf32_bfd_link_hash_table_create \
elf32_sparc_vxworks_link_hash_table_create
-#undef elf_backend_want_got_plt
+#undef elf_backend_want_got_plt
#define elf_backend_want_got_plt 1
-#undef elf_backend_plt_readonly
+#undef elf_backend_plt_readonly
#define elf_backend_plt_readonly 1
-#undef elf_backend_got_header_size
+#undef elf_backend_got_header_size
#define elf_backend_got_header_size 12
-#undef elf_backend_add_symbol_hook
+#undef elf_backend_add_symbol_hook
#define elf_backend_add_symbol_hook \
elf_vxworks_add_symbol_hook
-#undef elf_backend_link_output_symbol_hook
+#undef elf_backend_link_output_symbol_hook
#define elf_backend_link_output_symbol_hook \
elf_vxworks_link_output_symbol_hook
-#undef elf_backend_emit_relocs
+#undef elf_backend_emit_relocs
#define elf_backend_emit_relocs \
elf_vxworks_emit_relocs
-#undef elf_backend_final_write_processing
+#undef elf_backend_final_write_processing
#define elf_backend_final_write_processing \
elf32_sparc_vxworks_final_write_processing
-#undef elf_backend_static_tls_alignment
+#undef elf_backend_static_tls_alignment
+#undef elf_backend_strtab_flags
+#undef elf_backend_set_special_section_info_and_link
-#undef elf32_bed
+#undef elf32_bed
#define elf32_bed sparc_elf_vxworks_bed
#include "elf32-target.h"