From 123ae61a418614cf00f3cfb46d0a01df42309dea Mon Sep 17 00:00:00 2001 From: Libor Bukata Date: Mon, 1 Mar 2021 12:08:31 +0100 Subject: [PATCH] GNU strip fails to set sh_link and sh_info on Solaris SPARC64 The patch adds a missing elf64_sparc_copy_solaris_special_section_fields function that enables to fill sh_link and sh_info fields in .SUNW_* sections. Note that elf64_sparc_copy_solaris_special_section_fields is empty since the default handling is currently sufficient for GNU strip command. This is a followup patch of the following upstream commits: commit 5522f910cb539905d6adfdceab208ddfa5e84557 Author: Nick Clifton Date: Fri Apr 29 09:24:42 2016 +0100 Enhance support for copying and stripping Solaris and ARM binaries. commit 84865015459b4e9e8ac67f9b91617fbd856d5119 Author: Nick Clifton Date: Thu Apr 14 12:04:09 2016 +0100 Fix copying Solaris binaries with objcopy. gdb/ChangeLog: 2021-03-01 Libor Bukata * bfd/elf64-sparc.c: Fix GNU strip on Solaris SPARC64. --- bfd/elf64-sparc.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index e162f0d53d1..1d4521dfcae 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -1004,4 +1004,24 @@ const struct elf_size_info elf64_sparc_size_info = #undef elf_backend_static_tls_alignment #define elf_backend_static_tls_alignment 16 +#undef elf_backend_strtab_flags +#define elf_backend_strtab_flags SHF_STRINGS + +static bfd_boolean +elf64_sparc_copy_solaris_special_section_fields (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_copy_special_section_fields +#define elf_backend_copy_special_section_fields elf64_sparc_copy_solaris_special_section_fields + #include "elf64-target.h" + +#undef elf_backend_strtab_flags +#undef elf_backend_copy_special_section_fields -- 2.26.2