Hello community, here is the log from the commit of package binutils for openSUSE:Factory checked in at 2019-01-29 14:39:17 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/binutils (Old) and /work/SRC/openSUSE:Factory/.binutils.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "binutils" Tue Jan 29 14:39:17 2019 rev:131 rq:668394 version:2.31 Changes: -------- --- /work/SRC/openSUSE:Factory/binutils/binutils.changes 2018-12-03 10:03:04.212111958 +0100 +++ /work/SRC/openSUSE:Factory/.binutils.new.28833/binutils.changes 2019-01-29 14:39:18.263486881 +0100 @@ -1,0 +2,14 @@ +Thu Jan 24 14:10:56 UTC 2019 - m...@suse.com + +- Add s390-relro.diff to improve relro support on s390 + [fate#326356] + +------------------------------------------------------------------- +Thu Dec 6 13:53:51 UTC 2018 - m...@suse.com + +- Fix the fix for PR23919 [bsc#1118644]: + rename handle-ELF-compressed-header-alignment-correctly-by-.patch + to fix-pr23919-1.diff and add fix-pr23919-2.diff + and fix-pr23919-3.diff . + +------------------------------------------------------------------- cross-aarch64-binutils.changes: same change cross-arm-binutils.changes: same change cross-avr-binutils.changes: same change cross-epiphany-binutils.changes: same change cross-hppa-binutils.changes: same change cross-hppa64-binutils.changes: same change cross-i386-binutils.changes: same change cross-ia64-binutils.changes: same change cross-m68k-binutils.changes: same change cross-mips-binutils.changes: same change cross-ppc-binutils.changes: same change cross-ppc64-binutils.changes: same change cross-ppc64le-binutils.changes: same change cross-riscv64-binutils.changes: same change cross-rx-binutils.changes: same change cross-s390-binutils.changes: same change cross-s390x-binutils.changes: same change cross-sparc-binutils.changes: same change cross-sparc64-binutils.changes: same change cross-spu-binutils.changes: same change cross-x86_64-binutils.changes: same change Old: ---- handle-ELF-compressed-header-alignment-correctly-by-.patch New: ---- fix-pr23919-1.diff fix-pr23919-2.diff fix-pr23919-3.diff s390-relro.diff ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ binutils.spec ++++++ --- /var/tmp/diff_new_pack.CGZCbs/_old 2019-01-29 14:39:33.703468056 +0100 +++ /var/tmp/diff_new_pack.CGZCbs/_new 2019-01-29 14:39:33.707468052 +0100 @@ -1,7 +1,7 @@ # # spec file for package binutils # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,7 +12,7 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# Please submit bugfixes or comments via http://bugs.opensuse.org/ # @@ -94,7 +94,10 @@ Patch34: aarch64-common-pagesize.patch Patch36: binutils-pr22868.diff Patch37: binutils-revert-plt32-in-branches.diff -Patch38: handle-ELF-compressed-header-alignment-correctly-by-.patch +Patch38: fix-pr23919-1.diff +Patch39: fix-pr23919-2.diff +Patch40: fix-pr23919-3.diff +Patch41: s390-relro.diff Patch90: cross-avr-nesc-as.patch Patch92: cross-avr-omit_section_dynsym.patch Patch93: cross-avr-size.patch @@ -169,6 +172,9 @@ %patch37 -p1 %endif %patch38 -p1 +%patch39 -p1 +%patch40 -p1 +%patch41 -p1 %if "%{TARGET}" == "avr" cp gas/config/tc-avr.h gas/config/tc-avr-nesc.h %patch90 ++++++ cross-aarch64-binutils.spec ++++++ --- /var/tmp/diff_new_pack.CGZCbs/_old 2019-01-29 14:39:33.731468022 +0100 +++ /var/tmp/diff_new_pack.CGZCbs/_new 2019-01-29 14:39:33.731468022 +0100 @@ -1,7 +1,7 @@ # # spec file for package cross-aarch64-binutils # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,7 +12,7 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# Please submit bugfixes or comments via http://bugs.opensuse.org/ # @@ -97,7 +97,10 @@ Patch34: aarch64-common-pagesize.patch Patch36: binutils-pr22868.diff Patch37: binutils-revert-plt32-in-branches.diff -Patch38: handle-ELF-compressed-header-alignment-correctly-by-.patch +Patch38: fix-pr23919-1.diff +Patch39: fix-pr23919-2.diff +Patch40: fix-pr23919-3.diff +Patch41: s390-relro.diff Patch90: cross-avr-nesc-as.patch Patch92: cross-avr-omit_section_dynsym.patch Patch93: cross-avr-size.patch @@ -172,6 +175,9 @@ %patch37 -p1 %endif %patch38 -p1 +%patch39 -p1 +%patch40 -p1 +%patch41 -p1 %if "%{TARGET}" == "avr" cp gas/config/tc-avr.h gas/config/tc-avr-nesc.h %patch90 cross-arm-binutils.spec: same change cross-avr-binutils.spec: same change cross-epiphany-binutils.spec: same change cross-hppa-binutils.spec: same change cross-hppa64-binutils.spec: same change cross-i386-binutils.spec: same change cross-ia64-binutils.spec: same change cross-m68k-binutils.spec: same change cross-mips-binutils.spec: same change cross-ppc-binutils.spec: same change cross-ppc64-binutils.spec: same change cross-ppc64le-binutils.spec: same change cross-riscv64-binutils.spec: same change cross-rx-binutils.spec: same change cross-s390-binutils.spec: same change cross-s390x-binutils.spec: same change cross-sparc-binutils.spec: same change cross-sparc64-binutils.spec: same change cross-spu-binutils.spec: same change cross-x86_64-binutils.spec: same change ++++++ fix-pr23919-1.diff ++++++ >From 4207142d6a5d2359170c5f9a140fc1a2351fbda9 Mon Sep 17 00:00:00 2001 From: Mark Wielaard <m...@klomp.org> Date: Tue, 27 Nov 2018 11:59:10 +0000 Subject: [PATCH] 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. --- bfd/ChangeLog | 19 +++++++++++++ bfd/bfd-in2.h | 6 ++-- bfd/bfd.c | 20 ++++++++++---- bfd/compress.c | 35 +++++++++++++++++------- bfd/elf.c | 5 ++-- binutils/ChangeLog | 9 ++++++ binutils/readelf.c | 18 ------------ binutils/testsuite/binutils-all/dw2-3.rS | 2 +- binutils/testsuite/binutils-all/dw2-3.rt | 2 +- 9 files changed, 77 insertions(+), 39 deletions(-) diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index ee8cd7ef0b..6d92c51cb9 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -7419,7 +7419,8 @@ void bfd_update_compression_header bfd_boolean bfd_check_compression_header (bfd *abfd, bfd_byte *contents, asection *sec, - bfd_size_type *uncompressed_size); + bfd_size_type *uncompressed_size, + unsigned int *uncompressed_alignment_power); int bfd_get_compression_header_size (bfd *abfd, asection *sec); @@ -8006,7 +8007,8 @@ void bfd_cache_section_contents bfd_boolean bfd_is_section_compressed_with_header (bfd *abfd, asection *section, int *compression_header_size_p, - bfd_size_type *uncompressed_size_p); + bfd_size_type *uncompressed_size_p, + unsigned int *uncompressed_alignment_power_p); bfd_boolean bfd_is_section_compressed (bfd *abfd, asection *section); diff --git a/bfd/bfd.c b/bfd/bfd.c index 15becd7ae8..2b658298ea 100644 --- a/bfd/bfd.c +++ b/bfd/bfd.c @@ -2332,6 +2332,8 @@ bfd_update_compression_header (bfd *abfd, bfd_byte *contents, bfd_put_32 (abfd, sec->size, &echdr->ch_size); bfd_put_32 (abfd, 1 << sec->alignment_power, &echdr->ch_addralign); + /* bfd_log2 (alignof (Elf32_Chdr)) */ + bfd_set_section_alignment (abfd, sec, 2); } else { @@ -2342,6 +2344,8 @@ bfd_update_compression_header (bfd *abfd, bfd_byte *contents, bfd_put_64 (abfd, sec->size, &echdr->ch_size); bfd_put_64 (abfd, 1 << sec->alignment_power, &echdr->ch_addralign); + /* bfd_log2 (alignof (Elf64_Chdr)) */ + bfd_set_section_alignment (abfd, sec, 3); } } else @@ -2354,6 +2358,8 @@ bfd_update_compression_header (bfd *abfd, bfd_byte *contents, order. */ memcpy (contents, "ZLIB", 4); bfd_putb64 (sec->size, contents + 4); + /* No way to keep the original alignment, just use 1 always. */ + bfd_set_section_alignment (abfd, sec, 0); } } } @@ -2368,12 +2374,14 @@ bfd_update_compression_header (bfd *abfd, bfd_byte *contents, SYNOPSIS bfd_boolean bfd_check_compression_header (bfd *abfd, bfd_byte *contents, asection *sec, - bfd_size_type *uncompressed_size); + bfd_size_type *uncompressed_size, + unsigned int *uncompressed_alignment_power); DESCRIPTION Check the compression header at CONTENTS of SEC in ABFD and - store the uncompressed size in UNCOMPRESSED_SIZE if the - compression header is valid. + store the uncompressed size in UNCOMPRESSED_SIZE and the + uncompressed data alignment in UNCOMPRESSED_ALIGNMENT_POWER + if the compression header is valid. RETURNS Return TRUE if the compression header is valid. @@ -2382,7 +2390,8 @@ RETURNS bfd_boolean bfd_check_compression_header (bfd *abfd, bfd_byte *contents, asection *sec, - bfd_size_type *uncompressed_size) + bfd_size_type *uncompressed_size, + unsigned int *uncompressed_alignment_power) { if (bfd_get_flavour (abfd) == bfd_target_elf_flavour && (elf_section_flags (sec) & SHF_COMPRESSED) != 0) @@ -2404,9 +2413,10 @@ bfd_check_compression_header (bfd *abfd, bfd_byte *contents, chdr.ch_addralign = bfd_get_64 (abfd, &echdr->ch_addralign); } if (chdr.ch_type == ELFCOMPRESS_ZLIB - && chdr.ch_addralign == 1U << sec->alignment_power) + && chdr.ch_addralign == (1U << bfd_log2 (chdr.ch_addralign))) { *uncompressed_size = chdr.ch_size; + *uncompressed_alignment_power = bfd_log2 (chdr.ch_addralign); return TRUE; } } diff --git a/bfd/compress.c b/bfd/compress.c index 53e566e498..97ea624eb8 100644 --- a/bfd/compress.c +++ b/bfd/compress.c @@ -84,11 +84,13 @@ bfd_compress_section_contents (bfd *abfd, sec_ptr sec, int zlib_size = 0; int orig_compression_header_size; bfd_size_type orig_uncompressed_size; + unsigned int orig_uncompressed_alignment_pow; int header_size = bfd_get_compression_header_size (abfd, NULL); bfd_boolean compressed = bfd_is_section_compressed_with_header (abfd, sec, &orig_compression_header_size, - &orig_uncompressed_size); + &orig_uncompressed_size, + &orig_uncompressed_alignment_pow); /* Either ELF compression header or the 12-byte, "ZLIB" + 8-byte size, overhead in .zdebug* section. */ @@ -153,6 +155,9 @@ bfd_compress_section_contents (bfd *abfd, sec_ptr sec, return 0; } free (uncompressed_buffer); + bfd_set_section_alignment (abfd, sec, + orig_uncompressed_alignment_pow); + sec->contents = buffer; sec->compress_status = COMPRESS_SECTION_DONE; return orig_uncompressed_size; @@ -364,20 +369,24 @@ SYNOPSIS bfd_boolean bfd_is_section_compressed_with_header (bfd *abfd, asection *section, int *compression_header_size_p, - bfd_size_type *uncompressed_size_p); + bfd_size_type *uncompressed_size_p, + unsigned int *uncompressed_alignment_power_p); DESCRIPTION Return @code{TRUE} if @var{section} is compressed. Compression - header size is returned in @var{compression_header_size_p} and - uncompressed size is returned in @var{uncompressed_size_p}. If - compression is unsupported, compression header size is returned - with -1 and uncompressed size is returned with 0. + header size is returned in @var{compression_header_size_p}, + uncompressed size is returned in @var{uncompressed_size_p} + and the uncompressed data alignement power is returned in + @var{uncompressed_align_pow_p}. If compression is + unsupported, compression header size is returned with -1 + and uncompressed size is returned with 0. */ bfd_boolean bfd_is_section_compressed_with_header (bfd *abfd, sec_ptr sec, int *compression_header_size_p, - bfd_size_type *uncompressed_size_p) + bfd_size_type *uncompressed_size_p, + unsigned int *uncompressed_align_pow_p) { bfd_byte header[MAX_COMPRESSION_HEADER_SIZE]; int compression_header_size; @@ -412,7 +421,8 @@ bfd_is_section_compressed_with_header (bfd *abfd, sec_ptr sec, if (compression_header_size != 0) { if (!bfd_check_compression_header (abfd, header, sec, - uncompressed_size_p)) + uncompressed_size_p, + uncompressed_align_pow_p)) compression_header_size = -1; } /* Check for the pathalogical case of a debug string section that @@ -449,9 +459,11 @@ bfd_is_section_compressed (bfd *abfd, sec_ptr sec) { int compression_header_size; bfd_size_type uncompressed_size; + unsigned int uncompressed_align_power; return (bfd_is_section_compressed_with_header (abfd, sec, &compression_header_size, - &uncompressed_size) + &uncompressed_size, + &uncompressed_align_power) && compression_header_size >= 0 && uncompressed_size > 0); } @@ -480,6 +492,7 @@ bfd_init_section_decompress_status (bfd *abfd, sec_ptr sec) int compression_header_size; int header_size; bfd_size_type uncompressed_size; + unsigned int uncompressed_alignment_power = 0; compression_header_size = bfd_get_compression_header_size (abfd, sec); if (compression_header_size > MAX_COMPRESSION_HEADER_SIZE) @@ -508,7 +521,8 @@ bfd_init_section_decompress_status (bfd *abfd, sec_ptr sec) uncompressed_size = bfd_getb64 (header + 4); } else if (!bfd_check_compression_header (abfd, header, sec, - &uncompressed_size)) + &uncompressed_size, + &uncompressed_alignment_power)) { bfd_set_error (bfd_error_wrong_format); return FALSE; @@ -516,6 +530,7 @@ bfd_init_section_decompress_status (bfd *abfd, sec_ptr sec) sec->compressed_size = sec->size; sec->size = uncompressed_size; + bfd_set_section_alignment (abfd, sec, uncompressed_alignment_power); sec->compress_status = DECOMPRESS_SECTION_SIZED; return TRUE; diff --git a/bfd/elf.c b/bfd/elf.c index bebda20195..604971dd4c 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -1177,11 +1177,12 @@ _bfd_elf_make_section_from_shdr (bfd *abfd, enum { nothing, compress, decompress } action = nothing; int compression_header_size; bfd_size_type uncompressed_size; + unsigned int uncompressed_align_power; bfd_boolean compressed = bfd_is_section_compressed_with_header (abfd, newsect, &compression_header_size, - &uncompressed_size); - + &uncompressed_size, + &uncompressed_align_power); if (compressed) { /* Compressed section. Check if we should decompress. */ diff --git a/binutils/readelf.c b/binutils/readelf.c index 39744009ab..afb039f7b7 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 f1637e9149..86bc73d9a2 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 f59cbaa22b..74e7f8deca 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 -- 2.19.1 ++++++ fix-pr23919-2.diff ++++++ commit 131a5a648d314cd15811158150573cb40eb3abd0 Author: H.J. Lu <hjl.to...@gmail.com> Date: Tue Nov 27 06:02:36 2018 -0800 Initialize *uncompressed_align_pow_p to 0 Initialize *uncompressed_align_pow_p to 0 since *uncompressed_align_pow_p is passed to bfd_is_section_compressed_with_header as uninitialized, PR binutils/23919 * compress.c (bfd_is_section_compressed_with_header): Initialize *uncompressed_align_pow_p to 0. diff --git a/bfd/compress.c b/bfd/compress.c index 97ea624..18a7597 100644 --- a/bfd/compress.c +++ b/bfd/compress.c @@ -394,6 +394,8 @@ bfd_is_section_compressed_with_header (bfd *abfd, sec_ptr sec, unsigned int saved = sec->compress_status; bfd_boolean compressed; + *uncompressed_align_pow_p = 0; + compression_header_size = bfd_get_compression_header_size (abfd, sec); if (compression_header_size > MAX_COMPRESSION_HEADER_SIZE) abort (); ++++++ fix-pr23919-3.diff ++++++ commit 5f6c22aee74f17393b82934a5682d985672e011a Author: H.J. Lu <hjl.to...@gmail.com> Date: Sun Dec 2 05:42:36 2018 -0800 gold: Get alignment of uncompressed section from ch_addralign The ELF compression header has a field (ch_addralign) that is set to the alignment of the uncompressed section. This way the section itself can have a different alignment than the decompressed section. Update decompress_input_section to get alignment of the decompressed section and use it when merging decompressed strings. PR binutils/23919 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Get addralign from decompressed_section_contents. * object.cc (build_compressed_section_map): Set info.addralign. (Object::decompressed_section_contents): Add a palign argument and store p->second.addralign in *palign if it isn't NULL. * object.h (Compressed_section_info): Add addralign. (section_is_compressed): Add a palign argument, default it to NULL, store p->second.addralign in *palign if it isn't NULL. (Object::decompressed_section_contents): Likewise. * output.cc (Output_section::add_input_section): Get addralign from section_is_compressed. Index: binutils-2.31/gold/merge.cc =================================================================== --- binutils-2.31.orig/gold/merge.cc 2018-12-06 14:52:01.000000000 +0100 +++ binutils-2.31/gold/merge.cc 2018-12-06 14:52:10.000000000 +0100 @@ -440,9 +440,11 @@ Output_merge_string<Char_type>::do_add_i { section_size_type sec_len; bool is_new; + uint64_t addralign = this->addralign(); const unsigned char* pdata = object->decompressed_section_contents(shndx, &sec_len, - &is_new); + &is_new, + &addralign); const Char_type* p = reinterpret_cast<const Char_type*>(pdata); const Char_type* pend = p + sec_len / sizeof(Char_type); @@ -494,7 +496,7 @@ Output_merge_string<Char_type>::do_add_i // aligned, so each string within the section must retain the same // modulo. uintptr_t init_align_modulo = (reinterpret_cast<uintptr_t>(pdata) - & (this->addralign() - 1)); + & (addralign - 1)); bool has_misaligned_strings = false; while (p < pend) @@ -503,7 +505,7 @@ Output_merge_string<Char_type>::do_add_i // Within merge input section each string must be aligned. if (len != 0 - && ((reinterpret_cast<uintptr_t>(p) & (this->addralign() - 1)) + && ((reinterpret_cast<uintptr_t>(p) & (addralign - 1)) != init_align_modulo)) has_misaligned_strings = true; Index: binutils-2.31/gold/object.cc =================================================================== --- binutils-2.31.orig/gold/object.cc 2018-12-06 14:52:01.000000000 +0100 +++ binutils-2.31/gold/object.cc 2018-12-06 14:52:10.000000000 +0100 @@ -751,11 +751,13 @@ build_compressed_section_map( const unsigned char* contents = obj->section_contents(i, &len, false); uint64_t uncompressed_size; + Compressed_section_info info; if (is_zcompressed) { // Skip over the ".zdebug" prefix. name += 7; uncompressed_size = get_uncompressed_size(contents, len); + info.addralign = shdr.get_sh_addralign(); } else { @@ -763,8 +765,8 @@ build_compressed_section_map( name += 6; elfcpp::Chdr<size, big_endian> chdr(contents); uncompressed_size = chdr.get_ch_size(); + info.addralign = chdr.get_ch_addralign(); } - Compressed_section_info info; info.size = convert_to_section_size_type(uncompressed_size); info.flag = shdr.get_sh_flags(); info.contents = NULL; @@ -3060,7 +3062,8 @@ const unsigned char* Object::decompressed_section_contents( unsigned int shndx, section_size_type* plen, - bool* is_new) + bool* is_new, + uint64_t* palign) { section_size_type buffer_size; const unsigned char* buffer = this->do_section_contents(shndx, &buffer_size, @@ -3087,6 +3090,8 @@ Object::decompressed_section_contents( { *plen = uncompressed_size; *is_new = false; + if (palign != NULL) + *palign = p->second.addralign; return p->second.contents; } @@ -3108,6 +3113,8 @@ Object::decompressed_section_contents( // once in this pass. *plen = uncompressed_size; *is_new = true; + if (palign != NULL) + *palign = p->second.addralign; return uncompressed_data; } Index: binutils-2.31/gold/object.h =================================================================== --- binutils-2.31.orig/gold/object.h 2018-12-06 14:52:01.000000000 +0100 +++ binutils-2.31/gold/object.h 2018-12-06 14:52:10.000000000 +0100 @@ -373,6 +373,7 @@ struct Compressed_section_info { section_size_type size; elfcpp::Elf_Xword flag; + uint64_t addralign; const unsigned char* contents; }; typedef std::map<unsigned int, Compressed_section_info> Compressed_section_map; @@ -808,7 +809,8 @@ class Object bool section_is_compressed(unsigned int shndx, - section_size_type* uncompressed_size) const + section_size_type* uncompressed_size, + elfcpp::Elf_Xword* palign = NULL) const { if (this->compressed_sections_ == NULL) return false; @@ -818,6 +820,8 @@ class Object { if (uncompressed_size != NULL) *uncompressed_size = p->second.size; + if (palign != NULL) + *palign = p->second.addralign; return true; } return false; @@ -828,7 +832,7 @@ class Object // by the caller. const unsigned char* decompressed_section_contents(unsigned int shndx, section_size_type* plen, - bool* is_cached); + bool* is_cached, uint64_t* palign = NULL); // Discard any buffers of decompressed sections. This is done // at the end of the Add_symbols task. Index: binutils-2.31/gold/output.cc =================================================================== --- binutils-2.31.orig/gold/output.cc 2018-12-06 14:52:01.000000000 +0100 +++ binutils-2.31/gold/output.cc 2018-12-06 14:52:10.000000000 +0100 @@ -2448,7 +2448,13 @@ Output_section::add_input_section(Layout unsigned int reloc_shndx, bool have_sections_script) { + section_size_type input_section_size = shdr.get_sh_size(); + section_size_type uncompressed_size; elfcpp::Elf_Xword addralign = shdr.get_sh_addralign(); + if (object->section_is_compressed(shndx, &uncompressed_size, + &addralign)) + input_section_size = uncompressed_size; + if ((addralign & (addralign - 1)) != 0) { object->error(_("invalid alignment %lu for section \"%s\""), @@ -2498,11 +2504,6 @@ Output_section::add_input_section(Layout } } - section_size_type input_section_size = shdr.get_sh_size(); - section_size_type uncompressed_size; - if (object->section_is_compressed(shndx, &uncompressed_size)) - input_section_size = uncompressed_size; - off_t offset_in_section; if (this->has_fixed_layout()) ++++++ s390-relro.diff ++++++ ++++ 1079 lines (skipped)