From b51d5d619a9fcf799bf90c4b16bb74d6caf00ff1 Mon Sep 17 00:00:00 2001 From: Than McIntosh Date: Fri, 16 Oct 2015 09:44:18 -0400 Subject: Fix gold build error at -O0. Cherrypick of upstream commit 5d7908e0880030628536a0266968a15922574735 Author: Cary Coutant Date: Thu Jun 11 13:19:38 2015 -0700 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. Change-Id: I6c0726e624be076e0d0565652a56da5ef761d88a --- binutils-2.25/gold/ChangeLog | 6 ++++++ binutils-2.25/gold/aarch64.cc | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/binutils-2.25/gold/ChangeLog b/binutils-2.25/gold/ChangeLog index ae585107..608d9fd9 100644 --- a/binutils-2.25/gold/ChangeLog +++ b/binutils-2.25/gold/ChangeLog @@ -61,6 +61,12 @@ code into create_erratum_stub. * options.h (fix_cortex_a53_835769): New option. +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-10 Han Shen Patch for erratum-843419 (2 of 2 - fix erratum occurrences). diff --git a/binutils-2.25/gold/aarch64.cc b/binutils-2.25/gold/aarch64.cc index ac18bc44..49481945 100644 --- a/binutils-2.25/gold/aarch64.cc +++ b/binutils-2.25/gold/aarch64.cc @@ -897,7 +897,7 @@ public: typedef AArch64_insn_utilities Insn_utilities; 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); @@ -1020,6 +1020,9 @@ private: }; // End of "Erratum_stub". +template +const int Erratum_stub::STUB_ADDR_ALIGN = 4; + // Comparator used in set definition. template struct Erratum_stub_less @@ -1069,7 +1072,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 @@ -1215,6 +1218,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. -- cgit v1.2.3