public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Cary Coutant <ccoutant@gmail.com>
To: Han Shen <shenhan@google.com>
Cc: binutils <binutils@sourceware.org>,
	Luis Lozano <llozano@google.com>,
		Bhaskar <bjanakiraman@google.com>
Subject: Re: [gold][aarch64] Patch for erratum-843419 (2 of 2 - fix erratum occurrences)
Date: Thu, 11 Jun 2015 20:25:00 -0000	[thread overview]
Message-ID: <CAJimCsGBBzwrEZHdXji21TohfDd+pYOe8N7sHAuAVW-Ng2Ht_g@mail.gmail.com> (raw)
In-Reply-To: <CACkGtrjvQ67aQau4yDWnF0rOuKLsBgQU5MdXCh_f56Wvb8s5mg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 451 bytes --]

With your last patch, gold won't build at -O0, because the
declarations of "static const int STUB_ADDR_ALIGN" need to be made
outside the class body. I've committed the attached patch to move
these initializations out of the class body.

-cary


2015-06-11  Cary Coutant  <ccoutant@gmail.com>

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

[-- Attachment #2: stub-align.patch --]
[-- Type: application/octet-stream, Size: 1844 bytes --]

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.

2015-06-11  Cary Coutant  <ccoutant@gmail.com>

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


diff --git a/gold/aarch64.cc b/gold/aarch64.cc
index 130fcc2..8dfd933 100644
--- a/gold/aarch64.cc
+++ b/gold/aarch64.cc
@@ -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.
 

  parent reply	other threads:[~2015-06-11 20:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-12 18:20 Han Shen
2015-06-01 21:39 ` Cary Coutant
2015-06-05 18:50   ` Han Shen
2015-06-10  6:15     ` Cary Coutant
     [not found]       ` <CACkGtrjvQ67aQau4yDWnF0rOuKLsBgQU5MdXCh_f56Wvb8s5mg@mail.gmail.com>
2015-06-11 20:25         ` Cary Coutant [this message]
2015-06-11 21:05           ` Han Shen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJimCsGBBzwrEZHdXji21TohfDd+pYOe8N7sHAuAVW-Ng2Ht_g@mail.gmail.com \
    --to=ccoutant@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=bjanakiraman@google.com \
    --cc=llozano@google.com \
    --cc=shenhan@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).