From bf57746745ac0c0d2922de5af5f0d8527d7a585a Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 2 Mar 2020 10:16:39 +1030 Subject: ELF SEC_SMALL_DATA For those ELF targets that have .sdata or .sbss sections, or similar sections, arrange to mark the sections with the SEC_SMALL_DATA flag. This fixes regressions in nm symbol type caused by removing .sdata and .sbss from coff_section_type with commit 49d9fd42ac. * elf32-m32r.c (m32r_elf_section_flags): New function. (elf_backend_section_flags): Define. * elf32-nds32.c (nds32_elf_section_flags): New function. (elf_backend_section_flags): Define. * elf32-ppc.c (ppc_elf_section_from_shdr): Set SEC_SMALL_DATA for .sbss and .sdata sections. * elf32-v850.c (v850_elf_section_from_shdr): Set SEC_SMALL_DATA for SHF_V850_GPREL sections. * elf64-alpha.c (elf64_alpha_section_from_shdr): Delete outdated FIXME. * elf64-hppa.c (elf64_hppa_section_from_shdr): Set SEC_SMALL_DATA for SHF_PARISC_SHORT sections. * elf64-ppc.c (ppc64_elf_section_flags): New function. (elf_backend_section_flags): Define. * elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Set SEC_SMALL_DATA for SHF_MIPS_GPREL sections. Delete FIXME. --- bfd/elf32-m32r.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'bfd/elf32-m32r.c') diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index edc95b5..2a4b0b2 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -3827,6 +3827,18 @@ static const struct bfd_elf_special_section m32r_elf_special_sections[] = { NULL, 0, 0, 0, 0 } }; +static bfd_boolean +m32r_elf_section_flags (const Elf_Internal_Shdr *hdr) +{ + const char *name = hdr->bfd_section->name; + + if (strncmp (name, ".sbss", 5) == 0 + || strncmp (name, ".sdata", 6) == 0) + hdr->bfd_section->flags |= SEC_SMALL_DATA; + + return TRUE; +} + static enum elf_reloc_type_class m32r_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, const asection *rel_sec ATTRIBUTE_UNUSED, @@ -3897,6 +3909,7 @@ m32r_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, #define bfd_elf32_bfd_set_private_flags m32r_elf_set_private_flags #define bfd_elf32_bfd_print_private_bfd_data m32r_elf_print_private_bfd_data #define elf_backend_special_sections m32r_elf_special_sections +#define elf_backend_section_flags m32r_elf_section_flags #define elf_backend_linux_prpsinfo32_ugid16 TRUE -- cgit v1.1