From 8c803a2dd7d3d742a3d0071914f557ef465afe71 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 2 Mar 2020 10:16:02 +1030 Subject: elf_backend_section_flags and _bfd_elf_init_private_section_data I was looking at elf_backend_section_flags as a means of setting SEC_SMALL_DATA for .sdata, .sbss and the like, and condidered adding an asection* parameter to access the section name easily before realising that hdr->bfd_section of course makes the section available. So no new parameter needed. In fact the flagword* parameter isn't needed either, so out it goes. The patch also tidies some horrible code in _bfd_elf_new_section_hook that can change whether known ABI sections have sh_type and sh_flags set up depending on which of the bfd_make_section functions is used. (Some of those set section flags before _bfd_elf_new_section_hook is called, others leave the flags zero.) The function also had some hacks for .init_array and .fini_array to affect how _bfd_elf_init_private_section_data behaved for those sections. It's cleaner to do that in _bfd_elf_init_private_section_data. So that all goes and we now init sh_type and sh_flags for all known ABI sections in _bfd_elf_new_section_hook. _bfd_elf_init_private_section_data is changed to suit, and now doesn't just single out SHT_INIT_ARRAY and SHT_FINI_ARRAY but rather any of the special section types. The _bfd_elf_new_section_hook change resulting in +FAIL: ld-aarch64/erratum835769-843419 exposing some errors in the aarch64 backend. elfNN_aarch64_size_stubs should not be looking at linker created sections in the stub bfd. Nor should code like "symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr" be run without first checking that input_bfd is ELF. * elf-bfd.h (elf_backend_section_flags): Remove flagword* param. * elf.c (_bfd_elf_make_section_from_shdr): Set section flags before calling elf_backend_section_flags with adjusted params. Use newsect->flags past that point. (_bfd_elf_new_section_hook): Always set sh_type and sh_flags for special sections. (_bfd_elf_init_private_section_data): Allow normal sh_type sections to have their type overridden, and all sh_flags but processor and os specific. * elf32-arm.c (elf32_arm_section_flags): Adjust for changed params. * elf32-mep.c (mep_elf_section_flags): Likewise. * elf32-nios2.c (nios2_elf32_section_flags): Likewise. * elf64-alpha.c (elf64_alpha_section_flags): Likewise. * elf64-ia64-vms.c (elf64_ia64_section_flags): Likewise. * elfnn-ia64.c (elfNN_ia64_section_flags): Likewise. * elfnn-aarch64.c (elfNN_aarch64_size_stubs): Exclude the linker stub BFD and non-aarch64 input files when scanning for stubs. --- bfd/elf-bfd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bfd/elf-bfd.h') diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index b930761..61e733f 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -955,7 +955,7 @@ struct elf_backend_data /* A function to convert machine dependent ELF section header flags to BFD internal section header flags. */ bfd_boolean (*elf_backend_section_flags) - (flagword *, const Elf_Internal_Shdr *); + (const Elf_Internal_Shdr *); /* A function that returns a struct containing ELF section flags and type for the given BFD section. */ -- cgit v1.1