aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-07-14 10:25:52 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-07-14 10:26:23 -0700
commit19a7fe52ae3d0971e67a134bcb1648899e21ae1c (patch)
tree08f4f3425d6bed3ed2996c8cdb5b7b93015b77c3
parent22121df01ff9247b3cb272f52632848f9631f80f (diff)
downloadgdb-19a7fe52ae3d0971e67a134bcb1648899e21ae1c.zip
gdb-19a7fe52ae3d0971e67a134bcb1648899e21ae1c.tar.gz
gdb-19a7fe52ae3d0971e67a134bcb1648899e21ae1c.tar.bz2
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.
-rw-r--r--binutils/ChangeLog7
-rw-r--r--binutils/doc/binutils.texi16
-rw-r--r--binutils/objcopy.c2
-rw-r--r--binutils/testsuite/ChangeLog4
-rw-r--r--binutils/testsuite/binutils-all/compress.exp23
-rw-r--r--gas/ChangeLog8
-rw-r--r--gas/as.c4
-rw-r--r--gas/doc/as.texinfo17
-rw-r--r--gold/ChangeLog10
-rw-r--r--gold/compressed_output.cc7
-rw-r--r--gold/testsuite/Makefile.am4
-rw-r--r--gold/testsuite/Makefile.in4
-rw-r--r--ld/ChangeLog7
-rw-r--r--ld/emultempl/elf32.em2
-rw-r--r--ld/ld.texinfo9
-rw-r--r--ld/testsuite/ChangeLog6
-rw-r--r--ld/testsuite/ld-elf/zlibbegin.rS2
-rw-r--r--ld/testsuite/ld-elf/zlibnormal.rS2
18 files changed, 93 insertions, 41 deletions
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 <hongjiu.lu@intel.com>
+
+ * 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 <hongjiu.lu@intel.com>
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 <hongjiu.lu@intel.com>
+
+ * binutils-all/compress.exp: Update.
+
2015-07-10 H.J. Lu <hongjiu.lu@intel.com>
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
}
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 5374c5e..8d84bab 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,11 @@
+2015-07-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ * 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.
+
2015-07-09 Catherine Moore <clm@codesourcery.com>
* config/tc-mips.c (check_fpabi): Handle
diff --git a/gas/as.c b/gas/as.c
index b8a5be4..6fb28e9 100644
--- a/gas/as.c
+++ b/gas/as.c
@@ -665,7 +665,7 @@ This program has absolutely no warranty.\n"));
if (strcasecmp (optarg, "none") == 0)
flag_compress_debug = COMPRESS_DEBUG_NONE;
else if (strcasecmp (optarg, "zlib") == 0)
- flag_compress_debug = COMPRESS_DEBUG_GNU_ZLIB;
+ flag_compress_debug = COMPRESS_DEBUG_GABI_ZLIB;
else if (strcasecmp (optarg, "zlib-gnu") == 0)
flag_compress_debug = COMPRESS_DEBUG_GNU_ZLIB;
else if (strcasecmp (optarg, "zlib-gabi") == 0)
@@ -679,7 +679,7 @@ This program has absolutely no warranty.\n"));
#endif
}
else
- flag_compress_debug = COMPRESS_DEBUG;
+ flag_compress_debug = COMPRESS_DEBUG_GABI_ZLIB;
break;
case OPTION_NOCOMPRESS_DEBUG:
diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo
index 950bf28..70f1b96 100644
--- a/gas/doc/as.texinfo
+++ b/gas/doc/as.texinfo
@@ -625,10 +625,10 @@ Begin in alternate macro mode.
@end ifclear
@item --compress-debug-sections
-Compress DWARF debug sections using zlib. The debug sections are renamed
-to begin with @samp{.zdebug}, and the resulting object file may not be
-compatible with older linkers and object file utilities. Note if compression
-would make a given section @emph{larger} then it is not compressed or renamed.
+Compress DWARF debug sections using zlib with SHF_COMPRESSED from the
+ELF ABI. The resulting object file may not be compatible with older
+linkers and object file utilities. Note if compression would make a
+given section @emph{larger} then it is not compressed.
@ifset ELF
@cindex @samp{--compress-debug-sections=} option
@@ -640,10 +640,13 @@ 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}. Note if compression would make a given section
+@emph{larger} then it is not compressed nor renamed.
+
@end ifset
@item --nocompress-debug-sections
diff --git a/gold/ChangeLog b/gold/ChangeLog
index a8c2507..309b4753 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,13 @@
+2015-07-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ * 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.
+
2015-07-12 H.J. Lu <hongjiu.lu@intel.com>
PR gold/18322
diff --git a/gold/compressed_output.cc b/gold/compressed_output.cc
index 2630330..77679fe 100644
--- a/gold/compressed_output.cc
+++ b/gold/compressed_output.cc
@@ -233,11 +233,10 @@ Output_compressed_section::set_final_data_size()
enum { none, gnu_zlib, gabi_zlib } compress;
int compression_header_size = 12;
const int size = parameters->target().get_size();
- if (strcmp(this->options_->compress_debug_sections(), "zlib") == 0)
+ if (strcmp(this->options_->compress_debug_sections(), "zlib-gnu") == 0)
compress = gnu_zlib;
- else if (strcmp(this->options_->compress_debug_sections(), "zlib-gnu") == 0)
- compress = gnu_zlib;
- else if (strcmp(this->options_->compress_debug_sections(), "zlib-gabi") == 0)
+ else if (strcmp(this->options_->compress_debug_sections(), "zlib-gabi") == 0
+ || strcmp(this->options_->compress_debug_sections(), "zlib") == 0)
{
compress = gabi_zlib;
if (size == 32)
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
index d2f4668..41186c6 100644
--- a/gold/testsuite/Makefile.am
+++ b/gold/testsuite/Makefile.am
@@ -1353,9 +1353,9 @@ flagstest_compress_debug_sections.stdout: flagstest_compress_debug_sections
$(TEST_READELF) -w $< | sed -e "s/.zdebug_/.debug_/" > $@.tmp
mv -f $@.tmp $@
-# Check there are compressed DWARF .zdebug_* sections.
+# Check there are compressed DWARF .debug_* sections.
flagstest_compress_debug_sections.check: flagstest_compress_debug_sections
- $(TEST_READELF) -SW $< | grep ".zdebug_" > $@.tmp
+ $(TEST_READELF) -SW $< | egrep ".debug_.* C *" > $@.tmp
mv -f $@.tmp $@
# Compare DWARF debug info.
diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
index 1c336c6..563f598 100644
--- a/gold/testsuite/Makefile.in
+++ b/gold/testsuite/Makefile.in
@@ -5618,9 +5618,9 @@ uninstall-am:
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) -w $< | sed -e "s/.zdebug_/.debug_/" > $@.tmp
@GCC_TRUE@@NATIVE_LINKER_TRUE@ mv -f $@.tmp $@
-# Check there are compressed DWARF .zdebug_* sections.
+# Check there are compressed DWARF .debug_* sections.
@GCC_TRUE@@NATIVE_LINKER_TRUE@flagstest_compress_debug_sections.check: flagstest_compress_debug_sections
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) -SW $< | grep ".zdebug_" > $@.tmp
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) -SW $< | egrep ".debug_.* C *" > $@.tmp
@GCC_TRUE@@NATIVE_LINKER_TRUE@ mv -f $@.tmp $@
# Compare DWARF debug info.
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 3035fd7..3dd0a6f 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,10 @@
+2015-07-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ * 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.
+
2015-07-14 Nick Clifton <nickc@redhat.com>
* ld.texinfo (Options): Add missing period after @xref.
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 14f7963..8a41347 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -2223,7 +2223,7 @@ gld${EMULATION_NAME}_handle_option (int optc)
if (strcasecmp (optarg, "none") == 0)
link_info.compress_debug = COMPRESS_DEBUG_NONE;
else if (strcasecmp (optarg, "zlib") == 0)
- link_info.compress_debug = COMPRESS_DEBUG_GNU_ZLIB;
+ link_info.compress_debug = COMPRESS_DEBUG_GABI_ZLIB;
else if (strcasecmp (optarg, "zlib-gnu") == 0)
link_info.compress_debug = COMPRESS_DEBUG_GNU_ZLIB;
else if (strcasecmp (optarg, "zlib-gabi") == 0)
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index e7989b7..b48396d 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -2228,11 +2228,12 @@ hash tables. The default is @code{sysv}.
@itemx --compress-debug-sections=zlib-gabi
On ELF platforms , these options control how DWARF debug sections are
compressed using zlib. @option{--compress-debug-sections=none} doesn't
-compress DWARF debug sections. @option{--compress-debug-sections=zlib}
-and @option{--compress-debug-sections=zlib-gnu} compress DWARF debug
+compress DWARF debug sections.
+@option{--compress-debug-sections=zlib-gnu} compresses DWARF debug
sections and rename debug section names to begin with @samp{.zdebug}
-instead of @samp{.debug}. @option{--compress-debug-sections=zlib-gabi}
-compresses DWARF debug sections with SHF_COMPRESSED from the ELF ABI.
+instead of @samp{.debug}. @option{--compress-debug-sections=zlib}
+and @option{--compress-debug-sections=zlib-gabi}
+compress DWARF debug sections with SHF_COMPRESSED from the ELF ABI.
@kindex --reduce-memory-overheads
@item --reduce-memory-overheads
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 410359c..c279cbd 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2015-07-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ * ld-elf/zlibbegin.rS: Updated to .debug_.* with the
+ SHF_COMPRESSED bit.
+ * ld-elf/zlibnormal.rS: Likewise.
+
2015-07-09 Catherine Moore <clm@codesourcery.com>
* ld-mips-elf/attr-gnu-4-08.d: Update expected output.
diff --git a/ld/testsuite/ld-elf/zlibbegin.rS b/ld/testsuite/ld-elf/zlibbegin.rS
index 54de24c..294fdb4 100644
--- a/ld/testsuite/ld-elf/zlibbegin.rS
+++ b/ld/testsuite/ld-elf/zlibbegin.rS
@@ -1,3 +1,3 @@
#...
- +\[[ 0-9]+\] .zdebug_.* +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ [0-9a-f]+ +0 +0 +1
+ +\[[ 0-9]+\] .debug_.* +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ [0-9a-f]+ +C +0 +0 +1
#pass
diff --git a/ld/testsuite/ld-elf/zlibnormal.rS b/ld/testsuite/ld-elf/zlibnormal.rS
index 54de24c..294fdb4 100644
--- a/ld/testsuite/ld-elf/zlibnormal.rS
+++ b/ld/testsuite/ld-elf/zlibnormal.rS
@@ -1,3 +1,3 @@
#...
- +\[[ 0-9]+\] .zdebug_.* +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ [0-9a-f]+ +0 +0 +1
+ +\[[ 0-9]+\] .debug_.* +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ [0-9a-f]+ +C +0 +0 +1
#pass