]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix problem where erratum stubs are not always applied.
authorCary Coutant <ccoutant@gmail.com>
Thu, 30 Nov 2017 21:44:28 +0000 (13:44 -0800)
committerCary Coutant <ccoutant@gmail.com>
Thu, 30 Nov 2017 23:16:03 +0000 (15:16 -0800)
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.

gold/ChangeLog
gold/aarch64.cc

index b02dcba5b5a549751df0667ca23ab88946483759..297ffe98c3d929e2b79d471177d04d71d6b9037e 100644 (file)
@@ -1,3 +1,11 @@
+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
index d0839ce0af55419d3e4d86cbf8c23c1840a59c12..aa7561a69d9a394d29b92f2838c9f7f44bd2f384 100644 (file)
@@ -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