From 19a7fe52ae3d0971e67a134bcb1648899e21ae1c Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 14 Jul 2015 10:25:52 -0700 Subject: Make default compression gABI compliant All programs in binutils+gdb git repo now support gABI compression with the SHF_COMPRESSED bit. This patch makes the zlib-gabi option as compression default for gas, gold, ld and objcopy, instead of the zlib-gnu option whose outputs are incompatible with gABI. binutils/ * objcopy.c (copy_file): Set BFD_COMPRESS_GABI if not zlib-gnu. * doc/binutils.texi: Change --compress-debug-sections and --compress-debug-sections=zlib to zlib-gabi. binutils/testsuite/ * binutils-all/compress.exp: Update. gas/ * as.c (parse_args): Make --compress-debug-sections and --compress-debug-sections=zlib the same as --compress-debug-sections=zlib-gabi. * doc/as.texinfo: Change --compress-debug-sections and --compress-debug-sections=zlib to zlib-gabi. gold/ * compressed_output.cc (Output_compressed_section::set_final_data_size): Make --compress-debug-sections=zlib the same as --compress-debug-sections=zlib-gabi. * testsuite/Makefile.am (flagstest_compress_debug_sections.check): Expect ".debug_.*" with the SHF_COMPRESSED bit, instead of ".zdebug_". * testsuite/Makefile.in: Regenerated. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Make --compress-debug-sections=zlib the same as --compress-debug-sections=zlib-gabi. * ld.texinfo: Change --compress-debug-sections=zlib to zlib-gabi. ld/testsuite/ * ld-elf/zlibbegin.rS: Updated to .debug_.* with the SHF_COMPRESSED bit. * ld-elf/zlibnormal.rS: Likewise. --- binutils/ChangeLog | 7 +++++++ binutils/doc/binutils.texi | 16 +++++++++------- binutils/objcopy.c | 2 +- binutils/testsuite/ChangeLog | 4 ++++ binutils/testsuite/binutils-all/compress.exp | 23 ++++++++++++++--------- 5 files changed, 35 insertions(+), 17 deletions(-) (limited to 'binutils') diff --git a/binutils/ChangeLog b/binutils/ChangeLog index c504b33..4431ab8 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,10 @@ +2015-07-14 H.J. Lu + + * objcopy.c (copy_file): Set BFD_COMPRESS_GABI if not + zlib-gnu. + * doc/binutils.texi: Change --compress-debug-sections and + --compress-debug-sections=zlib to zlib-gabi. + 2015-07-10 H.J. Lu PR binutils/18656 diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi index 0781036..466f125 100644 --- a/binutils/doc/binutils.texi +++ b/binutils/doc/binutils.texi @@ -1844,10 +1844,9 @@ It can also be a useful way of reducing the size of a @option{--just-symbols} linker input file. @item --compress-debug-sections -Compress DWARF debug sections using zlib. The debug sections are -renamed to begin with @samp{.zdebug} instead of @samp{.debug}. Note - -if compression would actually make a section @emph{larger} then it is -not compressed or renamed. +Compress DWARF debug sections using zlib with SHF_COMPRESSED from the +ELF ABI. Note - if compression would actually make a section +@emph{larger}, then it is not compressed. @item --compress-debug-sections=none @itemx --compress-debug-sections=zlib @@ -1857,10 +1856,13 @@ For ELF files, these options control how DWARF debug sections are compressed. @option{--compress-debug-sections=none} is equivalent to @option{--nocompress-debug-sections}. @option{--compress-debug-sections=zlib} and -@option{--compress-debug-sections=zlib-gnu} are equivalent to +@option{--compress-debug-sections=zlib-gabi} are equivalent to @option{--compress-debug-sections}. -@option{--compress-debug-sections=zlib-gabi} compresses -DWARF debug sections with SHF_COMPRESSED from the ELF ABI. +@option{--compress-debug-sections=zlib-gnu} compresses DWARF debug +sections using zlib. The debug sections are renamed to begin with +@samp{.zdebug} instead of @samp{.debug}. Note - if compression would +actually make a section @emph{larger}, then it is not compressed nor +renamed. @item --decompress-debug-sections Decompress DWARF debug sections using zlib. The original section diff --git a/binutils/objcopy.c b/binutils/objcopy.c index d6516e0..bb6ca44 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -2607,7 +2607,7 @@ copy_file (const char *input_filename, const char *output_filename, ibfd->flags |= BFD_COMPRESS; /* Don't check if input is ELF here since this information is only available after bfd_check_format_matches is called. */ - if (do_debug_sections == compress_gabi_zlib) + if (do_debug_sections != compress_gnu_zlib) ibfd->flags |= BFD_COMPRESS_GABI; break; case decompress: diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog index 435961a..5f4fbc3 100644 --- a/binutils/testsuite/ChangeLog +++ b/binutils/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-07-14 H.J. Lu + + * binutils-all/compress.exp: Update. + 2015-07-10 H.J. Lu PR binutils/18656 diff --git a/binutils/testsuite/binutils-all/compress.exp b/binutils/testsuite/binutils-all/compress.exp index abff197..4dac503 100644 --- a/binutils/testsuite/binutils-all/compress.exp +++ b/binutils/testsuite/binutils-all/compress.exp @@ -39,7 +39,12 @@ if { ![binutils_assemble_flags $srcdir/$subdir/dw2-1.S ${compressedfile}.o --com return } -set got [remote_exec host "cmp ${testfile}.o ${compressedfile}.o"] +if { ![binutils_assemble_flags $srcdir/$subdir/dw2-1.S ${compressedfile}gnu.o --compress-debug-sections=zlib-gnu] } then { + unsupported "compressed debug sections with zlib-gnu" + return +} + +set got [remote_exec host "cmp ${testfile}.o ${compressedfile}gnu.o"] # Use it to set up xfail. set exec_output [lindex $got 1] if [string match "" $exec_output] then { @@ -136,8 +141,8 @@ if ![string match "" $got] then { # Xfail this test if there are no compressed sections. setup_xfail "$compression_used$target_triplet" -set testname "objcopy compress debug sections in archive" -set got [binutils_run $OBJCOPY "--compress-debug-sections ${copyfile}.a ${compressedcopyfile}.a"] +set testname "objcopy compress debug sections in archive with zlib-gnu" +set got [binutils_run $OBJCOPY "--compress-debug-sections=zlib-gnu ${copyfile}.a ${compressedcopyfile}.a"] if ![string match "" $got] then { fail "objcopy ($testname)" } else { @@ -228,13 +233,13 @@ if { ![binutils_assemble_flags $srcdir/$subdir/dw2-1.S ${compressedfile}gnu.o -- return } -set src1 ${compressedfile}gnu.o +set src1 ${compressedfile}gabi.o set src2 ${compressedfile}.o set status [remote_exec build cmp "${src1} ${src2}"] set exec_output [lindex $status 1] set exec_output [prune_warnings $exec_output] if ![string match "" $exec_output] then { - fail "compressed debug sections with zlib-gnu" + fail "compressed debug sections with zlib-gabi" return } @@ -248,13 +253,13 @@ if { ![binutils_assemble_flags $srcdir/$subdir/dw2-2.S ${compressedfile2}gnu.o - return } -set src1 ${compressedfile2}gnu.o +set src1 ${compressedfile2}gabi.o set src2 ${compressedfile2}.o set status [remote_exec build cmp "${src1} ${src2}"] set exec_output [lindex $status 1] set exec_output [prune_warnings $exec_output] if ![string match "" $exec_output] then { - fail "compressed debug sections with zlib-gnu" + fail "compressed debug sections with zlib-gabi" return } @@ -292,13 +297,13 @@ if { ![binutils_assemble_flags $srcdir/$subdir/dw2-3.S ${compressedfile3}gnu.o - return } -set src1 ${compressedfile3}gnu.o +set src1 ${compressedfile3}gabi.o set src2 ${compressedfile3}.o set status [remote_exec build cmp "${src1} ${src2}"] set exec_output [lindex $status 1] set exec_output [prune_warnings $exec_output] if ![string match "" $exec_output] then { - fail "compressed debug sections with zlib-gnu" + fail "compressed debug sections with zlib-gabi" return } -- cgit v1.1