diff options
author | Mark Wielaard <mark@klomp.org> | 2018-11-27 11:59:10 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2018-11-27 11:59:10 +0000 |
commit | 4207142d6a5d2359170c5f9a140fc1a2351fbda9 (patch) | |
tree | a2d367ab1675c2d4206e10943a8e0ea9c7904784 /binutils | |
parent | 6a75ea85b19306046e04a08eec344ec67ec2733d (diff) | |
download | gdb-4207142d6a5d2359170c5f9a140fc1a2351fbda9.zip gdb-4207142d6a5d2359170c5f9a140fc1a2351fbda9.tar.gz gdb-4207142d6a5d2359170c5f9a140fc1a2351fbda9.tar.bz2 |
Handle ELF compressed header alignment correctly by setting up the section alignment correctly for the Elf32_Chdr or Elf64_Chdr type and respect the ch_addralign field when decompressing the section data.
PR binutils/23919
binutils* readelf.c (dump_sections_as_strings): Remove bogus addralign check.
(dump_sections_as_bytes): Likewise.
(load_specific_debug_sections): Likewise.
* testsuite/binutils-all/dw2-3.rS: Adjust alignment.
* testsuite/binutils-all/dw2-3.rt: Likewise.
bfd * bfd.c (bfd_update_compression_header): Explicitly set alignment.
(bfd_check_compression_header): Add uncompressed_alignment_power
argument. Check ch_addralign is a power of 2.
* bfd-in2.h: Regenerated.
* compress.c (bfd_compress_section_contents): Get and set
orig_uncompressed_alignment_pow if section is decompressed.
(bfd_is_section_compressed_with_header): Add and get
uncompressed_align_pow_p argument.
(bfd_is_section_compressed): Add uncompressed_align_power argument
to bfd_is_section_compressed_with_header call.
(bfd_init_section_decompress_status): Get and set
uncompressed_alignment_power.
* elf.c (_bfd_elf_make_section_from_shdr): Add
uncompressed_align_power argument to
bfd_is_section_compressed_with_header call.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 9 | ||||
-rw-r--r-- | binutils/readelf.c | 18 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/dw2-3.rS | 2 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/dw2-3.rt | 2 |
4 files changed, 11 insertions, 20 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index ed80459..f749778 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,12 @@ +2018-11-27 Mark Wielaard <mark@klomp.org> + + PR binutils/23919 + * readelf.c (dump_sections_as_strings): Remove bogus addralign check. + (dump_sections_as_bytes): Likewise. + (load_specific_debug_sections): Likewise. + * testsuite/binutils-all/dw2-3.rS: Adjust alignment. + * testsuite/binutils-all/dw2-3.rt: Likewise. + 2018-11-20 H.J. Lu <hongjiu.lu@intel.com> PR binutils/23898 diff --git a/binutils/readelf.c b/binutils/readelf.c index 3974400..afb039f 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -13397,12 +13397,6 @@ dump_section_as_strings (Elf_Internal_Shdr * section, Filedata * filedata) printable_section_name (filedata, section), chdr.ch_type); return FALSE; } - else if (chdr.ch_addralign != section->sh_addralign) - { - warn (_("compressed section '%s' is corrupted\n"), - printable_section_name (filedata, section)); - return FALSE; - } uncompressed_size = chdr.ch_size; start += compression_header_size; new_size -= compression_header_size; @@ -13544,12 +13538,6 @@ dump_section_as_bytes (Elf_Internal_Shdr * section, printable_section_name (filedata, section), chdr.ch_type); return FALSE; } - else if (chdr.ch_addralign != section->sh_addralign) - { - warn (_("compressed section '%s' is corrupted\n"), - printable_section_name (filedata, section)); - return FALSE; - } uncompressed_size = chdr.ch_size; start += compression_header_size; new_size -= compression_header_size; @@ -13719,12 +13707,6 @@ load_specific_debug_section (enum dwarf_section_display_enum debug, section->name, chdr.ch_type); return FALSE; } - else if (chdr.ch_addralign != sec->sh_addralign) - { - warn (_("compressed section '%s' is corrupted\n"), - section->name); - return FALSE; - } uncompressed_size = chdr.ch_size; start += compression_header_size; size -= compression_header_size; diff --git a/binutils/testsuite/binutils-all/dw2-3.rS b/binutils/testsuite/binutils-all/dw2-3.rS index f1637e9..86bc73d 100644 --- a/binutils/testsuite/binutils-all/dw2-3.rS +++ b/binutils/testsuite/binutils-all/dw2-3.rS @@ -1,3 +1,3 @@ #... - +\[[ 0-9]+\] .debug_info +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ [0-9a-f]+ +C +0 +0 +1 + +\[[ 0-9]+\] .debug_info +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ [0-9a-f]+ +C +0 +0 +(4|8) #pass diff --git a/binutils/testsuite/binutils-all/dw2-3.rt b/binutils/testsuite/binutils-all/dw2-3.rt index f59cbaa..74e7f8d 100644 --- a/binutils/testsuite/binutils-all/dw2-3.rt +++ b/binutils/testsuite/binutils-all/dw2-3.rt @@ -1,6 +1,6 @@ #... +\[[ 0-9]+\] .debug_info - +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +0 +0 +1 + +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +0 +0 +(4|8) +\[0+800\]: COMPRESSED +ZLIB, 0+9d, 1 #pass |