diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2015-07-12 10:50:25 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2015-07-12 10:50:40 -0700 |
commit | 480586639d6b814b2e87f6f106b8635cf7442b20 (patch) | |
tree | 8fcd160ca3fd8b27770e883a58937c1e50e3bc38 /gold/testsuite | |
parent | 8d6dbeb44ca93b836e3af8f8d3993997bf347112 (diff) | |
download | gdb-480586639d6b814b2e87f6f106b8635cf7442b20.zip gdb-480586639d6b814b2e87f6f106b8635cf7442b20.tar.gz gdb-480586639d6b814b2e87f6f106b8635cf7442b20.tar.bz2 |
Add SHF_COMPRESSED section decompression to gold
This patch adds SHF_COMPRESSED section decompression to gold.
PR gold/18321
* compressed_output.h (decompress_input_section): Add arguments
for ELF class, big endian and sh_flags.
* compressed_output.cc (decompress_input_section): Likewise.
Support the SHF_COMPRESSED section.
* dynobj.h (Dynobj): Add elfsize and is_big_endian member
functions.
* plugin.h (Pluginobj): Likewise.
* layout.cc (Layout::get_output_section_flags): Also clear the
SHF_COMPRESSED bit.
* object.h (Compressed_section_info): Add flag to store sh_flags.
(Object): Add pure virtual elfsize and is_big_endian member
functions.
* object.cc (need_decompressed_section): Don't skip the ".zdebug"
prefix here.
(build_compressed_section_map): Check SHF_COMPRESSED for
uncompressed size. Store sh_flags in Compressed_section_info.
Pass size, big_endian and sh_flags to decompress_input_section.
Skip the ".debug"/".zdebug" prefix when passing section name to
need_decompressed_section.
(Sized_relobj_file<size, big_endian>::do_find_special_section):
Don't check ".zdebug_*" sections.
(Object::decompressed_section_contents): Pass ELF class, big
endian and sh_flags to decompress_input_section.
* reloc.cc (Sized_relobj_file<size, big_endian>::write_sections):
Likewise.
* testsuite/Makefile.am (check_DATA): Add
debug_msg_cdebug_gabi.err and gdb_index_test_2_gabi.stdout.
(MOSTLYCLEANFILES): Add debug_msg_cdebug_gabi.err and
gdb_index_test_2_gabi.stdout.
(debug_msg_cdebug_gabi.o): New.
(odr_violation1_cdebug_gabi.o): Likewise.
(odr_violation2_cdebug_gabi.o): Likewise.
(debug_msg_cdebug_gabi.err): Likewise.
(check_SCRIPTS): Add gdb_index_test_2_gabi.sh.
(gdb_index_test_cdebug_gabi.o): Likewise.
(gdb_index_test_2_gabi): Likewise.
(gdb_index_test_2_gabi.stdout): Likewise.
* testsuite/gdb_index_test_2_gabi.sh: New file.
* testsuite/Makefile.in: Regenerated.
Diffstat (limited to 'gold/testsuite')
-rw-r--r-- | gold/testsuite/Makefile.am | 25 | ||||
-rw-r--r-- | gold/testsuite/Makefile.in | 28 | ||||
-rwxr-xr-x | gold/testsuite/gdb_index_test_2_gabi.sh | 26 |
3 files changed, 79 insertions, 0 deletions
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index 7669f27..9c28c9a 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -1239,6 +1239,22 @@ debug_msg_cdebug.err: debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_ rm -f $@; \ exit 1; \ fi +check_DATA += debug_msg_cdebug_gabi.err +MOSTLYCLEANFILES += debug_msg_cdebug_gabi.err +debug_msg_cdebug_gabi.o: debug_msg.cc gcctestdir/as + $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/debug_msg.cc +odr_violation1_cdebug_gabi.o: odr_violation1.cc gcctestdir/as + $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/odr_violation1.cc +odr_violation2_cdebug_gabi.o: odr_violation2.cc gcctestdir/as + $(CXXCOMPILE) -Bgcctestdir/ -O2 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/odr_violation2.cc +debug_msg_cdebug_gabi.err: debug_msg_cdebug_gabi.o odr_violation1_cdebug_gabi.o odr_violation2_cdebug_gabi.o gcctestdir/ld + @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug_gabi.o odr_violation1_cdebug_gabi.o odr_violation2_cdebug_gabi.o "2>$@" + @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug_gabi debug_msg_cdebug_gabi.o odr_violation1_cdebug_gabi.o odr_violation2_cdebug_gabi.o 2>$@; \ + then \ + echo 1>&2 "Link of debug_msg_cdebug_gabi should have failed"; \ + rm -f $@; \ + exit 1; \ + fi # See if we can also detect problems when we're linking .so's, not .o's. check_DATA += debug_msg_so.err @@ -2400,6 +2416,15 @@ gdb_index_test_2: gdb_index_test_cdebug.o gcctestdir/ld $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $< gdb_index_test_2.stdout: gdb_index_test_2 $(TEST_READELF) --debug-dump=gdb_index $< > $@ +check_SCRIPTS += gdb_index_test_2_gabi.sh +check_DATA += gdb_index_test_2_gabi.stdout +MOSTLYCLEANFILES += gdb_index_test_2.stdout gdb_index_test_2 +gdb_index_test_cdebug_gabi.o: gdb_index_test.cc + $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -o $@ $< +gdb_index_test_2_gabi: gdb_index_test_cdebug_gabi.o gcctestdir/ld + $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $< +gdb_index_test_2_gabi.stdout: gdb_index_test_2_gabi + $(TEST_READELF) --debug-dump=gdb_index $< > $@ # Another simple C test (DW_AT_high_pc encoding) for --gdb-index. check_SCRIPTS += gdb_index_test_3.sh diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in index 3f8818d..1131512 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -274,6 +274,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ debug_msg.err \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ missing_key_func.err \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ debug_msg_cdebug.err \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ debug_msg_cdebug_gabi.err \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ debug_msg_so.err \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ debug_msg_ndebug.err \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ undef_symbol.err \ @@ -347,6 +348,7 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_36 = debug_msg.err \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ missing_key_func.err \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ debug_msg_cdebug.err \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ debug_msg_cdebug_gabi.err \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ debug_msg_so.err \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ debug_msg_ndebug.err \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ undef_symbol.err \ @@ -599,16 +601,20 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ # Test that --gdb-index functions correctly with gcc-generated pubnames. @GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@am__append_65 = gdb_index_test_1.sh \ @GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@ gdb_index_test_2.sh \ +@GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@ gdb_index_test_2_gabi.sh \ @GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@ gdb_index_test_3.sh \ @GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@ gdb_index_test_4.sh @GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@am__append_66 = gdb_index_test_1.stdout \ @GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@ gdb_index_test_2.stdout \ +@GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@ gdb_index_test_2_gabi.stdout \ @GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@ gdb_index_test_3.stdout \ @GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@ gdb_index_test_4.stdout @GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@am__append_67 = gdb_index_test_1.stdout \ @GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@ gdb_index_test_1 \ @GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@ gdb_index_test_2.stdout \ @GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@ gdb_index_test_2 \ +@GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@ gdb_index_test_2.stdout \ +@GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@ gdb_index_test_2 \ @GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@ gdb_index_test_3.stdout \ @GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@ gdb_index_test_3 \ @GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@ gdb_index_test_4.stdout \ @@ -4412,6 +4418,8 @@ gdb_index_test_1.sh.log: gdb_index_test_1.sh @p='gdb_index_test_1.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) gdb_index_test_2.sh.log: gdb_index_test_2.sh @p='gdb_index_test_2.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) +gdb_index_test_2_gabi.sh.log: gdb_index_test_2_gabi.sh + @p='gdb_index_test_2_gabi.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) gdb_index_test_3.sh.log: gdb_index_test_3.sh @p='gdb_index_test_3.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) gdb_index_test_4.sh.log: gdb_index_test_4.sh @@ -5456,6 +5464,20 @@ uninstall-am: @GCC_TRUE@@NATIVE_LINKER_TRUE@ rm -f $@; \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ exit 1; \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ fi +@GCC_TRUE@@NATIVE_LINKER_TRUE@debug_msg_cdebug_gabi.o: debug_msg.cc gcctestdir/as +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/debug_msg.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@odr_violation1_cdebug_gabi.o: odr_violation1.cc gcctestdir/as +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/odr_violation1.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@odr_violation2_cdebug_gabi.o: odr_violation2.cc gcctestdir/as +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -Bgcctestdir/ -O2 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/odr_violation2.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@debug_msg_cdebug_gabi.err: debug_msg_cdebug_gabi.o odr_violation1_cdebug_gabi.o odr_violation2_cdebug_gabi.o gcctestdir/ld +@GCC_TRUE@@NATIVE_LINKER_TRUE@ @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug_gabi.o odr_violation1_cdebug_gabi.o odr_violation2_cdebug_gabi.o "2>$@" +@GCC_TRUE@@NATIVE_LINKER_TRUE@ @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug_gabi debug_msg_cdebug_gabi.o odr_violation1_cdebug_gabi.o odr_violation2_cdebug_gabi.o 2>$@; \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ then \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ echo 1>&2 "Link of debug_msg_cdebug_gabi should have failed"; \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ rm -f $@; \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ exit 1; \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ fi @GCC_TRUE@@NATIVE_LINKER_TRUE@debug_msg.so: debug_msg.cc gcctestdir/ld @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc @GCC_TRUE@@NATIVE_LINKER_TRUE@odr_violation1.so: odr_violation1.cc gcctestdir/ld @@ -6043,6 +6065,12 @@ uninstall-am: @GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $< @GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@gdb_index_test_2.stdout: gdb_index_test_2 @GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) --debug-dump=gdb_index $< > $@ +@GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@gdb_index_test_cdebug_gabi.o: gdb_index_test.cc +@GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -o $@ $< +@GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@gdb_index_test_2_gabi: gdb_index_test_cdebug_gabi.o gcctestdir/ld +@GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $< +@GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@gdb_index_test_2_gabi.stdout: gdb_index_test_2_gabi +@GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) --debug-dump=gdb_index $< > $@ @GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@gdb_index_test_3.o: gdb_index_test_3.c @GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@ $(COMPILE) -O0 -g -c -o $@ $< @GCC_TRUE@@HAVE_PUBNAMES_TRUE@@NATIVE_LINKER_TRUE@gdb_index_test_3: gdb_index_test_3.o gcctestdir/ld diff --git a/gold/testsuite/gdb_index_test_2_gabi.sh b/gold/testsuite/gdb_index_test_2_gabi.sh new file mode 100755 index 0000000..def9bea --- /dev/null +++ b/gold/testsuite/gdb_index_test_2_gabi.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# gdb_index_test_2gabi.sh -- a test case for the --gdb-index option. + +# Copyright (C) 2015 Free Software Foundation, Inc. +# Written by Cary Coutant <ccoutant@google.com>. +# Modified by H.J. Lu <hongjiu.lu@intel.com> + +# This file is part of gold. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. + +exec ${srcdir}/gdb_index_test_comm.sh gdb_index_test_2_gabi.stdout |