From 5d7908e0880030628536a0266968a15922574735 Mon Sep 17 00:00:00 2001 From: Cary Coutant Date: Thu, 11 Jun 2015 13:19:38 -0700 Subject: [PATCH] Fix gold build error at -O0. 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 | 6 ++++++ gold/aarch64.cc | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gold/ChangeLog b/gold/ChangeLog index 4d6cd3da847..7039dd2d40b 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,9 @@ +2015-06-11 Cary Coutant + + * aarch64.cc (Erratum_stub::STUB_ADDR_ALIGN): Move initialization + outside class body. + (Reloc_stub::STUB_ADDR_ALIGN): Likewise. + 2015-06-11 Cary Coutant PR gold/17731 diff --git a/gold/aarch64.cc b/gold/aarch64.cc index 130fcc2cba0..8dfd933966b 100644 --- a/gold/aarch64.cc +++ b/gold/aarch64.cc @@ -840,7 +840,7 @@ public: typedef typename elfcpp::Elf_types::Elf_Addr AArch64_address; typedef typename AArch64_insn_utilities::Insntype Insntype; - static const int STUB_ADDR_ALIGN = 4; + static const int STUB_ADDR_ALIGN; static const Insntype invalid_insn = static_cast(-1); @@ -930,6 +930,8 @@ private: AArch64_address erratum_address_; }; // End of "Erratum_stub". +template +const int Erratum_stub::STUB_ADDR_ALIGN = 4; // Comparator used in set definition. template @@ -980,7 +982,7 @@ class Reloc_stub : public Stub_base 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 static const unsigned int invalid_index = static_cast(-1); }; // End of Reloc_stub +template +const int Reloc_stub::STUB_ADDR_ALIGN = 4; // Write data to output file. -- 2.30.2