Bug 18322 - gold doesn't support --compress-debug-sections={zlib-gabi|zlib-gnu}
Summary: gold doesn't support --compress-debug-sections={zlib-gabi|zlib-gnu}
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.26
: P2 enhancement
Target Milestone: 2.26
Assignee: H.J. Lu
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-24 14:54 UTC by H.J. Lu
Modified: 2015-07-12 23:15 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2015-04-24 14:54:28 UTC
[hjl@gnu-6 compressed-4]$ cat x.c
#include <stdio.h>

int
main ()
{
  printf ("hello world\n");
  return 0;
}
[hjl@gnu-6 compressed-4]$ make gold.gabi
gcc -B./ -g -Wa,--compress-debug-sections -c x.c -o x.o
gcc -B./ -o gold.gabi x.o -fuse-ld=gold -Wl,--compress-debug-sections=zlib-gabi
./ld.gold: fatal error: --compress-debug-sections=zlib-gabi: must take one of the following arguments: none, zlib
collect2: error: ld returned 1 exit status
make: *** [gold.gabi] Error 1
[hjl@gnu-6 compressed-4]$ make gold.gnu
gcc -B./ -o gold.gnu x.o -fuse-ld=gold -Wl,--compress-debug-sections=zlib-gnu
./ld.gold: fatal error: --compress-debug-sections=zlib-gnu: must take one of the following arguments: none, zlib
collect2: error: ld returned 1 exit status
make: *** [gold.gnu] Error 1
[hjl@gnu-6 compressed-4]$
Comment 1 H.J. Lu 2015-04-30 14:45:04 UTC
A patch is posted at

https://sourceware.org/ml/binutils/2015-04/msg00386.html
Comment 2 Sourceware Commits 2015-07-12 17:58:16 UTC
The master branch has been updated by H.J. Lu <hjl@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=fb8b9dbc147d37129e5a366a395302f532f5d190

commit fb8b9dbc147d37129e5a366a395302f532f5d190
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Jul 12 10:56:41 2015 -0700

    Extend --compress-debug-sections in gold
    
    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.
Comment 3 H.J. Lu 2015-07-12 23:14:48 UTC
Fixed.