This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb/binutils-2_29-branch] Fix problem where erratum stubs are not always applied.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c2fd86f2bdfa2f565cf6da6530f1bfb65824e2d3

commit c2fd86f2bdfa2f565cf6da6530f1bfb65824e2d3
Author: Cary Coutant <ccoutant@gmail.com>
Date:   Thu Nov 30 13:44:28 2017 -0800

    Fix problem where erratum stubs are not always applied.
    
    I checked over the results of applying --fix-cortex-a53-843419 to
    a very large program (gitit) with two stub tables and thousands
    of erratum fixes. I noticed that all the erratum_stubs were being
    created but about 1/3 of them were being skipped over by
    fix_errata_and_relocate_erratum_stubs(). By skipped over I mean
    no branch relocation or adrp -> adr transformation was applied to
    the erratum address, leaving the erratum_stub unreachable, and
    with a branch with a 0 immediate.
    
    The root cause of the skipped over erratum_stubs is
    Erratum_stub::invalidate_erratum_stub() that is used to set
    relobj_ to NULL when an erratum_stub has been processed.
    Unfortunately relobj_ is used in operator<() so altering relobj
    makes the results from erratum_stubs_.lower_bound() as used in
    find_erratum_stubs_for_input_section() unreliable.
    
    2017-11-30  Peter Smith  <peter.smith@linaro.org>
    	    Cary Coutant  <ccoutant@gmail.com>
    
    gold/
    	PR gold/20765
    	* aarch64.cc (Erratum_stub::invalidate_erratum_stub): Use erratum_insn_
    	instead of relobj_ to invalidate the stub.
    	(Erratum_stub::is_invalidated_erratum_stub): Likewise.

Diff:
---
 gold/ChangeLog  | 8 ++++++++
 gold/aarch64.cc | 6 +++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/gold/ChangeLog b/gold/ChangeLog
index b02dcba..297ffe9 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,4 +1,12 @@
 2017-11-30  Peter Smith  <peter.smith@linaro.org>
+	    Cary Coutant  <ccoutant@gmail.com>
+
+	PR gold/20765
+	* aarch64.cc (Erratum_stub::invalidate_erratum_stub): Use erratum_insn_
+	instead of relobj_ to invalidate the stub.
+	(Erratum_stub::is_invalidated_erratum_stub): Likewise.
+
+2017-11-30  Peter Smith  <peter.smith@linaro.org>
 
 	PR gold/22233
 	* aarch64.cc (AArch64_relobj::fix_errata_and_relocate_erratum_stubs):
diff --git a/gold/aarch64.cc b/gold/aarch64.cc
index d0839ce..aa7561a 100644
--- a/gold/aarch64.cc
+++ b/gold/aarch64.cc
@@ -1052,13 +1052,13 @@ public:
   void
   invalidate_erratum_stub()
   {
-     gold_assert(this->relobj_ != NULL);
-     this->relobj_ = NULL;
+     gold_assert(this->erratum_insn_ != invalid_insn);
+     this->erratum_insn_ = invalid_insn;
   }
 
   bool
   is_invalidated_erratum_stub()
-  { return this->relobj_ == NULL; }
+  { return this->erratum_insn_ == invalid_insn; }
 
 protected:
   virtual void


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]