diff options
author | Nick Clifton <nickc@redhat.com> | 2020-08-20 15:03:21 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2020-08-20 15:03:21 +0100 |
commit | 01147b208215ae457e7ef2d5a105c9dac93d955a (patch) | |
tree | fbc5c694550b48165a1c707154633794a660bcc9 /bfd/bfd.c | |
parent | 33bf4c5c10d246543c7a9a8ba4bbbe173d7f3367 (diff) | |
download | gdb-01147b208215ae457e7ef2d5a105c9dac93d955a.zip gdb-01147b208215ae457e7ef2d5a105c9dac93d955a.tar.gz gdb-01147b208215ae457e7ef2d5a105c9dac93d955a.tar.bz2 |
Ensure that compressed sections that have an ELF compression header structure at the start are correctly aligned.
PR 26428
bfd * bfd.c (bfd_update_compression_header): Also set the sh_addralign
field in the ELF header of the compressed sections.
ld * testsuite/ld-elf/zlibbegin.rS: Update expected output.
* testsuite/ld-elf/zlibnormal.rS: Likewise.
Diffstat (limited to 'bfd/bfd.c')
-rw-r--r-- | bfd/bfd.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -2558,6 +2558,7 @@ bfd_update_compression_header (bfd *abfd, bfd_byte *contents, if ((abfd->flags & BFD_COMPRESS_GABI) != 0) { const struct elf_backend_data *bed = get_elf_backend_data (abfd); + struct bfd_elf_section_data * esd = elf_section_data (sec); /* Set the SHF_COMPRESSED bit. */ elf_section_flags (sec) |= SHF_COMPRESSED; @@ -2571,6 +2572,7 @@ bfd_update_compression_header (bfd *abfd, bfd_byte *contents, &echdr->ch_addralign); /* bfd_log2 (alignof (Elf32_Chdr)) */ bfd_set_section_alignment (sec, 2); + esd->this_hdr.sh_addralign = 4; } else { @@ -2582,6 +2584,7 @@ bfd_update_compression_header (bfd *abfd, bfd_byte *contents, &echdr->ch_addralign); /* bfd_log2 (alignof (Elf64_Chdr)) */ bfd_set_section_alignment (sec, 3); + esd->this_hdr.sh_addralign = 8; } break; } |