aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-nios2.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-03-02 10:16:02 +1030
committerAlan Modra <amodra@gmail.com>2020-03-02 11:36:19 +1030
commit8c803a2dd7d3d742a3d0071914f557ef465afe71 (patch)
tree36ded7fa02019a59d7edab5009212ad354d61959 /bfd/elf32-nios2.c
parent7d4b2d2d29e2fc3af14d14412845615cc994cf91 (diff)
downloadgdb-8c803a2dd7d3d742a3d0071914f557ef465afe71.zip
gdb-8c803a2dd7d3d742a3d0071914f557ef465afe71.tar.gz
gdb-8c803a2dd7d3d742a3d0071914f557ef465afe71.tar.bz2
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.
Diffstat (limited to 'bfd/elf32-nios2.c')
-rw-r--r--bfd/elf32-nios2.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c
index 17e97bc..2fcfe6f 100644
--- a/bfd/elf32-nios2.c
+++ b/bfd/elf32-nios2.c
@@ -4539,10 +4539,10 @@ nios2_elf32_relocate_section (bfd *output_bfd,
/* Implement elf-backend_section_flags:
Convert NIOS2 specific section flags to bfd internal section flags. */
static bfd_boolean
-nios2_elf32_section_flags (flagword *flags, const Elf_Internal_Shdr *hdr)
+nios2_elf32_section_flags (const Elf_Internal_Shdr *hdr)
{
if (hdr->sh_flags & SHF_NIOS2_GPREL)
- *flags |= SEC_SMALL_DATA;
+ hdr->bfd_section->flags |= SEC_SMALL_DATA;
return TRUE;
}