This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gold][PATCH] PR gold/18321: gold doesn't support SHF_COMPRESSED sections


On Wed, May 13, 2015 at 11:51 PM, Cary Coutant <ccoutant@gmail.com> wrote:
>> This patch adds SHF_COMPRESSED section decompression to gold.  OK for
>> master?
>
> +         bool is_compressed
> +           = (shdr.get_sh_flags() & elfcpp::SHF_COMPRESSED) != 0;
>
> Please match the style of surrounding code. In gold, when we break
> a line at '=', we break after the '=' and indent 4 spaces.

Fixed.

> -             uint64_t uncompressed_size = get_uncompressed_size(contents, len);
> +               obj->section_contents(i, &len, false);
>
> See above.

Fixed.

> +               compression_header_size
> +                 = elfcpp::Elf_sizes<size>::chdr_size;
>
> This will fit on one line.

Removed.

> +             uint64_t uncompressed_size
> +               = get_uncompressed_size(contents + compression_header_size,
> +                                       len - compression_header_size);
>
> In new-style compressed sections, the uncompressed size is in the
> compression header. See my comments below.

I changed it to

              uint64_t uncompressed_size;
              if (is_zcompressed)
                uncompressed_size = get_uncompressed_size(contents, len);
              else
                {
                  elfcpp::Chdr<size, big_endian> chdr(contents);
                  uncompressed_size = chdr.get_ch_size();
                }

to avoid passing size to big_endian and sh_flags to get_uncompressed_size.

> +             info.flag = convert_to_section_size_type(shdr.get_sh_flags());
>
> You shouldn't be using convert_to_section_size_type on sh_flags.
>
>               if (uncompressed_size != -1ULL)
>                 {
> +                 if (is_compressed)
> +                   {
> +                     typename elfcpp::Chdr<size, big_endian> chdr(contents);
> +                     if (chdr.get_ch_type() != elfcpp::ELFCOMPRESS_ZLIB
> +                         || chdr.get_ch_size() != uncompressed_size
> +                         || (chdr.get_ch_addralign()
> +                             != shdr.get_sh_addralign()))
> +                       return uncompressed_map;
> +                   }
>                   unsigned char* uncompressed_data = NULL;
> -                 if (decompress_if_needed && need_decompressed_section(name))
> +                 if (decompress_if_needed
> +                     && (is_compressed
> +                         || need_decompressed_section(name)))
>                     {
>                       uncompressed_data = new unsigned char[uncompressed_size];
> -                     if (decompress_input_section(contents, len,
> +                     if (decompress_input_section(contents +
> compression_header_size,
> +                                                  len -
> compression_header_size,
>                                                    uncompressed_data,
>                                                    uncompressed_size))
>                         info.contents = uncompressed_data;
>
> I don't see how this is going to work right. This patch doesn't do anything
> to decompress_input_section, so in an SHF_COMPRESS section, it looks like
> you're expecting both an Elf compression header *and* the old-style "ZLIB"
> plus 8 big-endian bytes. That's wrong. In a new-style compressed section,
> the raw compressed data should begin immediately after the compression
> header. For reference from the gABI proposal:
>
>  ELFCOMPRESS_ZLIB
>         The section data is compressed with the ZLIB compression algorithm.
>         The compressed ZLIB data bytes begin with the byte immediately
>         following the compression header, and extend to the end of the
>         section. Additional documentation for ZLIB may be found at
>         http://zlib.net/.

Fixed.

> I'd add a flag to get_uncompressed_size and decompress_input_section, let
> them deal with the difference between the two styles, and greatly simplify
> the logic in this function.

I changed to pass size and big endian to decompress_input_section.

> If the test case is passing, that makes me suspect that the assembler is
> also wrong.
>
> +  if (memmem(names, sd->section_names_size, ".zdebug_", 8) != NULL
> +      || memmem(names, sd->section_names_size, ".debug_", 7) != NULL)
>
> Scanning the section strings table for ".zdebug_" is a kludge, necessary
> only because we didn't have a section type or flag to scan for.  Rather
> than extend this kludge to the ABI-compliant implementation, I'd rather
> scan the section headers for the SHF_COMPRESSED flag. If we find any,
> there's no need to look for ".zdebug_".

Removed.

> +  if ((p->second.flag & elfcpp::SHF_COMPRESSED) != 0)
> +    {
> +      const int size = parameters->target().get_size();
> +      if (size == 32)
> +       compression_header_size = elfcpp::Elf_sizes<32>::chdr_size;
> +      else if (size == 64)
> +       compression_header_size = elfcpp::Elf_sizes<64>::chdr_size;
> +      else
> +       gold_unreachable();
> +    }
> +  else
> +    compression_header_size = 0;
>
> This logic should be in decompress_input_section.

Done.

> +  if (!decompress_input_section(buffer + compression_header_size,
> +                               buffer_size - compression_header_size,
>                                 uncompressed_data,
>                                 uncompressed_size))
>
> As above, decompress_input_section needs to deal with either an old-style
> compression header, or a new-style one -- not a combination of the two.

Done.

>  struct Compressed_section_info
>  {
>    section_size_type size;
> +  section_size_type flag;
>
> Why is this section_size_type? It should be elfcpp::Elf_Xword.

Done.

> +         if ((shdr.get_sh_flags() & elfcpp::SHF_COMPRESSED) != 0)
> +            compression_header_size = elfcpp::Elf_sizes<size>::chdr_size;
> +         else
> +           compression_header_size = 0;
> +         if (!decompress_input_section(p + compression_header_size,
> +                                       len - compression_header_size,
> +                                       view, view_size))
>
> See above.
-
Changed.

Here is the updated patch.  OK for master?

Thanks.


-- 
H.J.
----
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.
* object.h (Compressed_section_info): Add flag to store sh_flags.
* object.cc (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.
(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.
* output.cc (Output_section::Output_section): Clear the
SHF_COMPRESSED bit.
* 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.
From ca0b69bed1761a787be4d47ff32e1f99f1d59ca0 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Wed, 18 Mar 2015 06:50:18 -0700
Subject: [PATCH 1/2] 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.
	* object.h (Compressed_section_info): Add flag to store sh_flags.
	* object.cc (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.
	(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.
	* output.cc (Output_section::Output_section): Clear the
	SHF_COMPRESSED bit.
	* 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.
---
 gold/compressed_output.cc               | 49 +++++++++++++++++++++++++++++-
 gold/compressed_output.h                |  2 +-
 gold/object.cc                          | 53 ++++++++++++++++++++++++---------
 gold/object.h                           |  1 +
 gold/output.cc                          |  4 ++-
 gold/reloc.cc                           |  4 ++-
 gold/testsuite/Makefile.am              | 25 ++++++++++++++++
 gold/testsuite/Makefile.in              | 28 +++++++++++++++++
 gold/testsuite/gdb_index_test_2_gabi.sh | 26 ++++++++++++++++
 9 files changed, 174 insertions(+), 18 deletions(-)
 create mode 100755 gold/testsuite/gdb_index_test_2_gabi.sh

diff --git a/gold/compressed_output.cc b/gold/compressed_output.cc
index 8c9fc1e..02d7821 100644
--- a/gold/compressed_output.cc
+++ b/gold/compressed_output.cc
@@ -143,8 +143,55 @@ bool
 decompress_input_section(const unsigned char* compressed_data,
 			 unsigned long compressed_size,
 			 unsigned char* uncompressed_data,
-			 unsigned long uncompressed_size)
+			 unsigned long uncompressed_size,
+			 int size,
+			 bool big_endian,
+			 elfcpp::Elf_Xword sh_flags)
 {
+  if ((sh_flags & elfcpp::SHF_COMPRESSED) != 0)
+    {
+      unsigned int compression_header_size;
+      if (size == 32)
+	{
+	  compression_header_size = elfcpp::Elf_sizes<32>::chdr_size;
+	  if (big_endian)
+	    {
+	      elfcpp::Chdr<32, true> chdr(compressed_data);
+	      if (chdr.get_ch_type() != elfcpp::ELFCOMPRESS_ZLIB)
+		return false;
+	    }
+	  else
+	    {
+	      elfcpp::Chdr<32, false> chdr(compressed_data);
+	      if (chdr.get_ch_type() != elfcpp::ELFCOMPRESS_ZLIB)
+		return false;
+	    }
+	}
+      else if (size == 64)
+	{
+	  compression_header_size = elfcpp::Elf_sizes<64>::chdr_size;
+	  if (big_endian)
+	    {
+	      elfcpp::Chdr<64, true> chdr(compressed_data);
+	      if (chdr.get_ch_type() != elfcpp::ELFCOMPRESS_ZLIB)
+		return false;
+	    }
+	  else
+	    {
+	      elfcpp::Chdr<64, false> chdr(compressed_data);
+	      if (chdr.get_ch_type() != elfcpp::ELFCOMPRESS_ZLIB)
+		return false;
+	    }
+	}
+      else
+	gold_unreachable();
+
+      return zlib_decompress(compressed_data + compression_header_size,
+			     compressed_size - compression_header_size,
+			     uncompressed_data,
+			     uncompressed_size);
+    }
+
   const unsigned int zlib_header_size = 12;
 
   /* Verify the compression header.  Currently, we support only zlib
diff --git a/gold/compressed_output.h b/gold/compressed_output.h
index b5fdbeb..616c80a 100644
--- a/gold/compressed_output.h
+++ b/gold/compressed_output.h
@@ -47,7 +47,7 @@ get_uncompressed_size(const unsigned char*, section_size_type);
 
 extern bool
 decompress_input_section(const unsigned char*, unsigned long, unsigned char*,
-			 unsigned long);
+			 unsigned long, int, bool, elfcpp::Elf_Xword);
 
 // This is used for a section whose data should be compressed.  It is
 // a regular Output_section which computes its contents into a buffer
diff --git a/gold/object.cc b/gold/object.cc
index 18c6670..7d377a3 100644
--- a/gold/object.cc
+++ b/gold/object.cc
@@ -740,25 +740,49 @@ build_compressed_section_map(
 	      continue;
 	    }
 
-	  const char* name = names + shdr.get_sh_name();
-	  if (is_compressed_debug_section(name))
+	  bool is_zcompressed = false;
+	  bool is_compressed =
+	      (shdr.get_sh_flags() & elfcpp::SHF_COMPRESSED) != 0;
+	  const char* name;
+
+	  if (is_compressed)
+	    name = NULL;
+	  else
+	    {
+	      name = names + shdr.get_sh_name();
+	      if (is_compressed_debug_section(name))
+		is_zcompressed = true;
+	    }
+	  if (is_zcompressed || is_compressed)
 	    {
 	      section_size_type len;
 	      const unsigned char* contents =
 		  obj->section_contents(i, &len, false);
-	      uint64_t uncompressed_size = get_uncompressed_size(contents, len);
+	      uint64_t uncompressed_size;
+	      if (is_zcompressed)
+		uncompressed_size = get_uncompressed_size(contents, len);
+	      else
+		{
+		  elfcpp::Chdr<size, big_endian> chdr(contents);
+		  uncompressed_size = chdr.get_ch_size();
+		}
 	      Compressed_section_info info;
 	      info.size = convert_to_section_size_type(uncompressed_size);
+	      info.flag = shdr.get_sh_flags();
 	      info.contents = NULL;
 	      if (uncompressed_size != -1ULL)
 		{
 		  unsigned char* uncompressed_data = NULL;
-		  if (decompress_if_needed && need_decompressed_section(name))
+		  if (decompress_if_needed
+		      && (is_compressed
+			  || need_decompressed_section(name)))
 		    {
 		      uncompressed_data = new unsigned char[uncompressed_size];
 		      if (decompress_input_section(contents, len,
 						   uncompressed_data,
-						   uncompressed_size))
+						   uncompressed_size,
+						   size, big_endian,
+						   shdr.get_sh_flags()))
 			info.contents = uncompressed_data;
 		      else
 			delete[] uncompressed_data;
@@ -786,14 +810,11 @@ Sized_relobj_file<size, big_endian>::do_find_special_sections(
   if (this->find_eh_frame(pshdrs, names, sd->section_names_size))
     this->has_eh_frame_ = true;
 
-  if (memmem(names, sd->section_names_size, ".zdebug_", 8) != NULL)
-    {
-      Compressed_section_map* compressed_sections =
-	  build_compressed_section_map<size, big_endian>(
-	      pshdrs, this->shnum(), names, sd->section_names_size, this, true);
-      if (compressed_sections != NULL)
-        this->set_compressed_sections(compressed_sections);
-    }
+  Compressed_section_map* compressed_sections =
+    build_compressed_section_map<size, big_endian>(
+						   pshdrs, this->shnum(), names, sd->section_names_size, this, true);
+  if (compressed_sections != NULL)
+    this->set_compressed_sections(compressed_sections);
 
   return (this->has_eh_frame_
 	  || (!parameters->options().relocatable()
@@ -2890,10 +2911,14 @@ Object::decompressed_section_contents(
     }
 
   unsigned char* uncompressed_data = new unsigned char[uncompressed_size];
+  Relobj *relobj = static_cast<Relobj*>(this);
   if (!decompress_input_section(buffer,
 				buffer_size,
 				uncompressed_data,
-				uncompressed_size))
+				uncompressed_size,
+				relobj->elfsize(),
+				relobj->is_big_endian(),
+				p->second.flag))
     this->error(_("could not decompress section %s"),
 		this->do_section_name(shndx).c_str());
 
diff --git a/gold/object.h b/gold/object.h
index a3d5d0e..b30925d 100644
--- a/gold/object.h
+++ b/gold/object.h
@@ -320,6 +320,7 @@ class Got_offset_list
 struct Compressed_section_info
 {
   section_size_type size;
+  elfcpp::Elf_Xword flag;
   const unsigned char* contents;
 };
 typedef std::map<unsigned int, Compressed_section_info> Compressed_section_map;
diff --git a/gold/output.cc b/gold/output.cc
index 5cc3629..5d8b8b5 100644
--- a/gold/output.cc
+++ b/gold/output.cc
@@ -2265,7 +2265,9 @@ Output_section::Output_section(const char* name, elfcpp::Elf_Word type,
     info_symndx_(NULL),
     info_(0),
     type_(type),
-    flags_(flags),
+    // Clear the elfcpp::SHF_COMPRESSED bit.  It will be set by
+    // --compress-debug-sections=zlib-gabi.
+    flags_(flags & ~elfcpp::SHF_COMPRESSED),
     order_(ORDER_INVALID),
     out_shndx_(-1U),
     symtab_index_(0),
diff --git a/gold/reloc.cc b/gold/reloc.cc
index 910c4ee..df897d3 100644
--- a/gold/reloc.cc
+++ b/gold/reloc.cc
@@ -866,7 +866,9 @@ Sized_relobj_file<size, big_endian>::write_sections(const Layout* layout,
 	  // Read and decompress the section.
           section_size_type len;
 	  const unsigned char* p = this->section_contents(i, &len, false);
-	  if (!decompress_input_section(p, len, view, view_size))
+	  if (!decompress_input_section(p, len, view, view_size,
+					size, big_endian,
+					shdr.get_sh_flags()))
 	    this->error(_("could not decompress section %s"),
 			this->section_name(i).c_str());
         }
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
index e2390eb..0f00f2b 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
@@ -2379,6 +2395,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 fe8da13..85d478e 100644
--- a/gold/testsuite/Makefile.in
+++ b/gold/testsuite/Makefile.in
@@ -268,6 +268,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 \
@@ -341,6 +342,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 \
@@ -593,16 +595,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 \
@@ -4356,6 +4362,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
@@ -5394,6 +5402,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
@@ -5967,6 +5989,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
-- 
1.9.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]