Ensure that compressed sections that have an ELF compression header structure at...
authorNick Clifton <nickc@redhat.com>
Thu, 20 Aug 2020 14:03:21 +0000 (15:03 +0100)
committerNick Clifton <nickc@redhat.com>
Thu, 20 Aug 2020 14:03:21 +0000 (15:03 +0100)
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.

bfd/ChangeLog
bfd/bfd.c
ld/ChangeLog
ld/testsuite/ld-elf/zlibbegin.rS
ld/testsuite/ld-elf/zlibnormal.rS

index 8c43a163fc4b5cfc7c36d688536b6889a34ceb58..670803ddfb14b0b69540b5333a379234fecbe756 100644 (file)
@@ -1,3 +1,9 @@
+2020-08-20  Nick Clifton  <nickc@redhat.com>
+
+       PR 26428
+       * bfd.c (bfd_update_compression_header): Also set the sh_addralign
+       field in the ELF header of the compressed sections.
+
 2020-08-20  Nick Clifton  <nickc@redhat.com>
 
        PR 26406
index ec38a0673c7ad606449a4c39ddfd75f7b08a0d89..449bcc6cefbbe83ce836a401a6540c120bc3121c 100644 (file)
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -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;
        }
index 973c00077b915c7cd73b0cc5802da71bd3257321..0e3a8593c352133088079740f486be6b156f3358 100644 (file)
@@ -1,3 +1,9 @@
+2020-08-20  Nick Clifton  <nickc@redhat.com>
+
+       PR 26428
+       * testsuite/ld-elf/zlibbegin.rS: Update expected output.
+       * testsuite/ld-elf/zlibnormal.rS: Likewise.
+
 2020-08-16  Alan Modra  <amodra@gmail.com>
 
        * testsuite/ld-powerpc/inline.s,
index dbab80c2ac874543593648102cb4310fc2253bed..c34a0f889866a334df08cbd2e6891351ee0fe3a5 100644 (file)
@@ -1,3 +1,3 @@
 #...
- +\[[ 0-9]+\] .debug_.* +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ [0-9a-f]+ +G?C +0 +0 +1
+ +\[[ 0-9]+\] .debug_.* +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ [0-9a-f]+ +G?C +0 +0 +[48]
 #pass
index dbab80c2ac874543593648102cb4310fc2253bed..c34a0f889866a334df08cbd2e6891351ee0fe3a5 100644 (file)
@@ -1,3 +1,3 @@
 #...
- +\[[ 0-9]+\] .debug_.* +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ [0-9a-f]+ +G?C +0 +0 +1
+ +\[[ 0-9]+\] .debug_.* +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ [0-9a-f]+ +G?C +0 +0 +[48]
 #pass