[gold][PATCH] Extend --compress-debug-sections in gold

H.J. Lu hjl.tools@gmail.com
Fri May 15 11:07:00 GMT 2015


On Wed, May 13, 2015 at 11:59 PM, Cary Coutant <ccoutant@gmail.com> wrote:
> +      memcpy(*compressed_data + compression_header_size, "ZLIB", 4);
> +      elfcpp::Swap_unaligned<64, true>::writeval(*compressed_data + 4
> +                                                + compression_header_size,
>                                                  uncompressed_size);
>
> This is wrong. If you're generating new-style compressed sections, the
> new compression header is supposed to *replace* the old "ZLIB" plus
> 8-byte big-endian size. You're writing both.
>
> -cary
>

Fixed.  Here is the updated patch.  OK for master?


-- 
H.J.
---
This patch extends --compress-debug-sections= with [zlib-gnu|zlib-gabi]
in gold.

PR gold/18322
* compressed_output.cc (zlib_compress): Add argument for
compression header size.  Set header size to compression header
size if it isn't 0.  Don't write out the zlib header here.
(Output_compressed_section::set_final_data_size): Support
zlib-gnu and zlib-gabi compressions.  Pass compression header
size to zlib_compress and write out compression header.  Set
the SHF_COMPRESSED bit for zlib-gabi compression.  Otherwise
clear the SHF_COMPRESSED bit
* options.h (compress_debug_sections): Add zlib-gnu and
zlib-gabi.
* output.h (Output_section::set_flags): New.
* testsuite/Makefile.am (check_PROGRAMS): Add
flagstest_compress_debug_sections_none,
flagstest_compress_debug_sections_gnu and
flagstest_compress_debug_sections_gabi.
(check_DATA): Add flagstest_compress_debug_sections_none.stdout.
flagstest_compress_debug_sections.stdout,
flagstest_compress_debug_sections.cmp,
flagstest_compress_debug_sections.check,
flagstest_compress_debug_sections_gnu.stdout,
flagstest_compress_debug_sections_gnu.cmp,
flagstest_compress_debug_sections_gnu.check,
flagstest_compress_debug_sections_gabi.stdout,
flagstest_compress_debug_sections_gabi.cmp and
flagstest_compress_debug_sections_gabi.check.
(flagstest_compress_debug_sections_none): New.
(flagstest_compress_debug_sections_none.stdout): Likewise.
(flagstest_compress_debug_sections.stdout): Likewise.
(flagstest_compress_debug_sections.check): Likewise.
(flagstest_compress_debug_sections.cmp): Likewise.
(flagstest_compress_debug_sections_gnu): Likewise.
(flagstest_compress_debug_sections_gnu.stdout): Likewise.
(flagstest_compress_debug_sections_gnu.check): Likewise.
(flagstest_compress_debug_sections_gnu.cmp): Likewise.
(flagstest_compress_debug_sections_gabi): Likewise.
(flagstest_compress_debug_sections_gabi.stdout): Likewise.
(flagstest_compress_debug_sections_gnu.check): Likewise.
(flagstest_compress_debug_sections_gnu.cmp): Likewise.
* testsuite/Makefile.in: Regenerated.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Extend-compress-debug-sections-in-gold.patch
Type: text/x-patch
Size: 27891 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20150515/1c502301/attachment.bin>


More information about the Binutils mailing list