Fix gold build error at -O0.
authorCary Coutant <ccoutant@gmail.com>
Thu, 11 Jun 2015 20:19:38 +0000 (13:19 -0700)
committerCary Coutant <ccoutant@gmail.com>
Thu, 11 Jun 2015 20:21:11 +0000 (13:21 -0700)
In aarch64.cc, Erratum_stub::STUB_ADDR_ALIGN and Reloc_stub::STUB_ADDR_ALIGN
are declared as static const int, and initialized in the class body. These
values are referenced from outside the class body, and with no optimization,
the references go unresolved.

gold/
* aarch64.cc (Erratum_stub::STUB_ADDR_ALIGN): Move initialization
outside class body.
(Reloc_stub::STUB_ADDR_ALIGN): Likewise.

gold/ChangeLog
gold/aarch64.cc

index 4d6cd3d..7039dd2 100644 (file)
@@ -1,5 +1,11 @@
 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
 
+       * aarch64.cc (Erratum_stub::STUB_ADDR_ALIGN): Move initialization
+       outside class body.
+       (Reloc_stub::STUB_ADDR_ALIGN): Likewise.
+
+2015-06-11  Cary Coutant  <ccoutant@gmail.com>
+
        PR gold/17731
        * layout.cc (corresponding_uncompressed_section_name): New function.
        (Layout::choose_output_section): Call it.
index 130fcc2..8dfd933 100644 (file)
@@ -840,7 +840,7 @@ public:
   typedef typename elfcpp::Elf_types<size>::Elf_Addr AArch64_address;
   typedef typename AArch64_insn_utilities<big_endian>::Insntype Insntype;
 
-  static const int STUB_ADDR_ALIGN = 4;
+  static const int STUB_ADDR_ALIGN;
 
   static const Insntype invalid_insn = static_cast<Insntype>(-1);
 
@@ -930,6 +930,8 @@ private:
   AArch64_address erratum_address_;
 };  // End of "Erratum_stub".
 
+template<int size, bool big_endian>
+const int Erratum_stub<size, big_endian>::STUB_ADDR_ALIGN = 4;
 
 // Comparator used in set definition.
 template<int size, bool big_endian>
@@ -980,7 +982,7 @@ class Reloc_stub : public Stub_base<size, big_endian>
   static const int MIN_ADRP_IMM = -(1 << 20);
 
   static const int BYTES_PER_INSN = 4;
-  static const int STUB_ADDR_ALIGN = 4;
+  static const int STUB_ADDR_ALIGN;
 
   // Determine whether the offset fits in the jump/branch instruction.
   static bool
@@ -1126,6 +1128,8 @@ class Reloc_stub : public Stub_base<size, big_endian>
   static const unsigned int invalid_index = static_cast<unsigned int>(-1);
 };  // End of Reloc_stub
 
+template<int size, bool big_endian>
+const int Reloc_stub<size, big_endian>::STUB_ADDR_ALIGN = 4;
 
 // Write data to output file.