aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfnn-aarch64.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/elfnn-aarch64.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/elfnn-aarch64.c')
-rw-r--r--bfd/elfnn-aarch64.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 35dd8ab..ba3ad45 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -4313,9 +4313,15 @@ elfNN_aarch64_size_stubs (bfd *output_bfd,
for (input_bfd = info->input_bfds;
input_bfd != NULL; input_bfd = input_bfd->link.next)
- if (!_bfd_aarch64_erratum_835769_scan (input_bfd, info,
- &num_erratum_835769_fixes))
- return FALSE;
+ {
+ if (!is_aarch64_elf (input_bfd)
+ || (input_bfd->flags & BFD_LINKER_CREATED) != 0)
+ continue;
+
+ if (!_bfd_aarch64_erratum_835769_scan (input_bfd, info,
+ &num_erratum_835769_fixes))
+ return FALSE;
+ }
_bfd_aarch64_resize_stubs (htab);
(*htab->layout_sections_again) ();
@@ -4331,6 +4337,10 @@ elfNN_aarch64_size_stubs (bfd *output_bfd,
{
asection *section;
+ if (!is_aarch64_elf (input_bfd)
+ || (input_bfd->flags & BFD_LINKER_CREATED) != 0)
+ continue;
+
for (section = input_bfd->sections;
section != NULL;
section = section->next)
@@ -4353,6 +4363,10 @@ elfNN_aarch64_size_stubs (bfd *output_bfd,
asection *section;
Elf_Internal_Sym *local_syms = NULL;
+ if (!is_aarch64_elf (input_bfd)
+ || (input_bfd->flags & BFD_LINKER_CREATED) != 0)
+ continue;
+
/* We'll need the symbol table in a second. */
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
if (symtab_hdr->sh_info == 0)