Fix internal error with LTO on ARM.
authorCary Coutant <ccoutant@google.com>
Mon, 7 Jul 2014 17:14:45 +0000 (10:14 -0700)
committerCary Coutant <ccoutant@google.com>
Tue, 8 Jul 2014 17:44:09 +0000 (10:44 -0700)
This prevents the target-specific do_read_symbols methods from being called
twice when do_layout_deferred_sections needs to layout an .eh_frame section.

gold/
PR gold/15639
* dynobj.h (Sized_dynobj::base_read_symbols): New method.
* dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
(Sized_dynobj::base_read_symbols): ...new method.
* object.h (Sized_relobj_file::base_read_symbols): New method.
* object.cc (Sized_relobj_file::do_read_symbols): Move body to...
(Sized_relobj_file::base_read_symbols): ...new method.
* arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
* mips.cc: (Mips_relobj::do_read_symbols): Likewise.
* powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.

gold/ChangeLog
gold/arm.cc
gold/dynobj.cc
gold/dynobj.h
gold/mips.cc
gold/object.cc
gold/object.h
gold/powerpc.cc

index aa95b77e00e3372dfa2b1230cd17f6967f796003..0bd14e41805e83646c048e4fdf6797baa9b077ca 100644 (file)
@@ -1,3 +1,16 @@
+2014-07-08  Cary Coutant  <ccoutant@google.com>
+
+       PR gold/15639
+       * dynobj.h (Sized_dynobj::base_read_symbols): New method.
+       * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
+       (Sized_dynobj::base_read_symbols): ...new method.
+       * object.h (Sized_relobj_file::base_read_symbols): New method.
+       * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
+       (Sized_relobj_file::base_read_symbols): ...new method.
+       * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
+       * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
+       * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
+
 2014-07-04  Alan Modra  <amodra@gmail.com>
 
        * po/POTFILES.in: Regenerate.
index 607f9d6c1d92114d1a680f9375668bd27b27bd36..6c472bb469451ce38a3d2e2b1b0b41bc6ce401c7 100644 (file)
@@ -6683,7 +6683,7 @@ void
 Arm_relobj<big_endian>::do_read_symbols(Read_symbols_data* sd)
 {
   // Call parent class to read symbol information.
-  Sized_relobj_file<32, big_endian>::do_read_symbols(sd);
+  this->base_read_symbols(sd);
 
   // If this input file is a binary file, it has no processor
   // specific flags and attributes section.
@@ -6974,7 +6974,7 @@ void
 Arm_dynobj<big_endian>::do_read_symbols(Read_symbols_data* sd)
 {
   // Call parent class to read symbol information.
-  Sized_dynobj<32, big_endian>::do_read_symbols(sd);
+  this->base_read_symbols(sd);
 
   // Read processor-specific flags in ELF file header.
   const unsigned char* pehdr = this->get_view(elfcpp::file_header_offset,
index 2a1b9a3cd4cf5197f0cd9f3560dba5f233405ea4..baf8489452c13f80b8367680e3f986f1121db307 100644 (file)
@@ -335,6 +335,17 @@ Sized_dynobj<size, big_endian>::read_dynamic(const unsigned char* pshdrs,
 template<int size, bool big_endian>
 void
 Sized_dynobj<size, big_endian>::do_read_symbols(Read_symbols_data* sd)
+{
+  this->base_read_symbols(sd);
+}
+
+// Read the symbols and sections from a dynamic object.  We read the
+// dynamic symbols, not the normal symbols.  This is common code for
+// all target-specific overrides of do_read_symbols().
+
+template<int size, bool big_endian>
+void
+Sized_dynobj<size, big_endian>::base_read_symbols(Read_symbols_data* sd)
 {
   this->read_section_data(&this->elf_file_, sd);
 
index b8d4b904f6ee1d49aa2fa40a9ddb76b66ca577e2..03b8053400ae7ffac424196c344473a6d03ac5ce 100644 (file)
@@ -270,6 +270,12 @@ class Sized_dynobj : public Dynobj
   do_get_global_symbols() const
   { return this->symbols_; }
 
+ protected:
+  // Read the symbols.  This is common code for all target-specific
+  // overrides of do_read_symbols().
+  void
+  base_read_symbols(Read_symbols_data*);
+
  private:
   // For convenience.
   typedef Sized_dynobj<size, big_endian> This;
index 50d02271a378af9e71bb051b822f380277a0b1e3..450883efdfa02222065866a5dd2acc75f717bbd7 100644 (file)
@@ -5857,7 +5857,7 @@ void
 Mips_relobj<size, big_endian>::do_read_symbols(Read_symbols_data* sd)
 {
   // Call parent class to read symbol information.
-  Sized_relobj_file<size, big_endian>::do_read_symbols(sd);
+  this->base_read_symbols(sd);
 
   // Read processor-specific flags in ELF file header.
   const unsigned char* pehdr = this->get_view(elfcpp::file_header_offset,
index c894c135e361ebec7873306b40ef870a964bd3cb..1811cda5d91e9a743e86f97b6e07e66c5594df34 100644 (file)
@@ -754,6 +754,16 @@ Sized_relobj_file<size, big_endian>::do_find_special_sections(
 template<int size, bool big_endian>
 void
 Sized_relobj_file<size, big_endian>::do_read_symbols(Read_symbols_data* sd)
+{
+  this->base_read_symbols(sd);
+}
+
+// Read the sections and symbols from an object file.  This is common
+// code for all target-specific overrides of do_read_symbols().
+
+template<int size, bool big_endian>
+void
+Sized_relobj_file<size, big_endian>::base_read_symbols(Read_symbols_data* sd)
 {
   this->read_section_data(&this->elf_file_, sd);
 
@@ -1848,7 +1858,7 @@ Sized_relobj_file<size, big_endian>::do_layout_deferred_sections(Layout* layout)
 
          // Reading the symbols again here may be slow.
          Read_symbols_data sd;
-         this->read_symbols(&sd);
+         this->base_read_symbols(&sd);
          this->layout_eh_frame_section(layout,
                                        sd.symbols->data(),
                                        sd.symbols_size,
index 38b06f01fa99a2e380d3d6ee1f699c16991cee2b..92cdbdd8d3ad96428da8e5e97b2965a12e8eaccc 100644 (file)
@@ -2214,6 +2214,11 @@ class Sized_relobj_file : public Sized_relobj<size, big_endian>
   void
   do_read_symbols(Read_symbols_data*);
 
+  // Read the symbols.  This is common code for all target-specific
+  // overrides of do_read_symbols.
+  void
+  base_read_symbols(Read_symbols_data*);
+
   // Return the value of a local symbol.
   uint64_t
   do_local_symbol_value(unsigned int symndx, uint64_t addend) const
index 96432ed2ffe97d1b59294fcfc30e07cbdf7d3455..0a9ab7d0d5cca5f99dd93aa3b702ca43de84a347 100644 (file)
@@ -1839,7 +1839,7 @@ template<int size, bool big_endian>
 void
 Powerpc_relobj<size, big_endian>::do_read_symbols(Read_symbols_data* sd)
 {
-  Sized_relobj_file<size, big_endian>::do_read_symbols(sd);
+  this->base_read_symbols(sd);
   if (size == 64)
     {
       const int shdr_size = elfcpp::Elf_sizes<size>::shdr_size;
@@ -1896,14 +1896,14 @@ Powerpc_dynobj<size, big_endian>::set_abiversion(int ver)
     }
 }
 
-// Call Sized_dynobj::do_read_symbols to read the symbols then
+// Call Sized_dynobj::base_read_symbols to read the symbols then
 // read .opd from a dynamic object, filling in opd_ent_ vector,
 
 template<int size, bool big_endian>
 void
 Powerpc_dynobj<size, big_endian>::do_read_symbols(Read_symbols_data* sd)
 {
-  Sized_dynobj<size, big_endian>::do_read_symbols(sd);
+  this->base_read_symbols(sd);
   if (size == 64)
     {
       const int shdr_size = elfcpp::Elf_sizes<size>::shdr_size;