aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-11-17 15:13:37 +1030
committerAndreas K. Hüttel <dilfridge@gentoo.org>2021-01-23 20:23:04 +0200
commit1da3ee941832776185478d1b2da8c835ae951eaf (patch)
tree66bf6dab2cd061e12bbb06569ea7b85ff299568a
parent[GOLD] fix jump to long branch on powerpc (diff)
downloadbinutils-gdb-1da3ee941832776185478d1b2da8c835ae951eaf.tar.gz
binutils-gdb-1da3ee941832776185478d1b2da8c835ae951eaf.tar.bz2
binutils-gdb-1da3ee941832776185478d1b2da8c835ae951eaf.zip
[GOLD] powerpc incremental-dump assertion failure
incremental-dump wants to instantiate Target_powerpc without options being set up. This patch fixes internal error in options, at gold/parameters.h:92 * powerpc.cc (Target_powerpc::no_tprel_opt_): Rename from tprel_opt_. Init to false. (Target_powerpc::tprel_opt): Test parameters->options().tls_optimize(). (Target_powerpc::set_tprel_opt): Delete. (Target_powerpc::set_no_tprel_opt): New function. Update all uses of set_tprel_opt. (cherry picked from commit 4e0e019fa8eda9b7ffe0615133f55e9b0b882fa1) (cherry picked from commit 984b18d6d228ecb1c49f70acb7ae6e4f47f09414)
-rw-r--r--gold/ChangeLog9
-rw-r--r--gold/powerpc.cc19
2 files changed, 18 insertions, 10 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 03d2c9aa74..8b274ddd04 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,12 @@
+2020-11-17 Alan Modra <amodra@gmail.com>
+
+ * powerpc.cc (Target_powerpc::no_tprel_opt_): Rename from tprel_opt_.
+ Init to false.
+ (Target_powerpc::tprel_opt): Test parameters->options().tls_optimize().
+ (Target_powerpc::set_tprel_opt): Delete.
+ (Target_powerpc::set_no_tprel_opt): New function. Update all uses
+ of set_tprel_opt.
+
2020-11-16 Michael Hudson-Doyle <michael.hudson@canonical.com>
PR 26902
diff --git a/gold/powerpc.cc b/gold/powerpc.cc
index 79c25a637d..fd4371efa4 100644
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -649,8 +649,7 @@ class Target_powerpc : public Sized_target<size, big_endian>
stub_tables_(), branch_lookup_table_(), branch_info_(), tocsave_loc_(),
power10_relocs_(false), plt_thread_safe_(false), plt_localentry0_(false),
plt_localentry0_init_(false), has_localentry0_(false),
- has_tls_get_addr_opt_(false),
- tprel_opt_(parameters->options().tls_optimize()),
+ has_tls_get_addr_opt_(false), no_tprel_opt_(false),
relax_failed_(false), relax_fail_count_(0),
stub_group_size_(0), savres_section_(0),
tls_get_addr_(NULL), tls_get_addr_opt_(NULL),
@@ -1154,11 +1153,11 @@ class Target_powerpc : public Sized_target<size, big_endian>
bool
tprel_opt() const
- { return this->tprel_opt_; }
+ { return !this->no_tprel_opt_ && parameters->options().tls_optimize(); }
void
- set_tprel_opt(bool val)
- { this->tprel_opt_ = val; }
+ set_no_tprel_opt()
+ { this->no_tprel_opt_ = true; }
// Remember any symbols seen with non-zero localentry, even those
// not providing a definition
@@ -1717,7 +1716,7 @@ class Target_powerpc : public Sized_target<size, big_endian>
bool plt_localentry0_init_;
bool has_localentry0_;
bool has_tls_get_addr_opt_;
- bool tprel_opt_;
+ bool no_tprel_opt_;
bool relax_failed_;
int relax_fail_count_;
@@ -8471,7 +8470,7 @@ Target_powerpc<size, big_endian>::Scan::local(
uint32_t insn = elfcpp::Swap<32, big_endian>::readval(view + off);
if ((insn & ((0x3fu << 26) | 0x1f << 16))
!= ((15u << 26) | ((size == 32 ? 2 : 13) << 16)))
- target->set_tprel_opt(false);
+ target->set_no_tprel_opt();
}
}
break;
@@ -8486,7 +8485,7 @@ Target_powerpc<size, big_endian>::Scan::local(
break;
// Fall through.
case elfcpp::R_POWERPC_TPREL16_HI:
- target->set_tprel_opt(false);
+ target->set_no_tprel_opt();
break;
default:
break;
@@ -9268,7 +9267,7 @@ Target_powerpc<size, big_endian>::Scan::global(
uint32_t insn = elfcpp::Swap<32, big_endian>::readval(view + off);
if ((insn & ((0x3fu << 26) | 0x1f << 16))
!= ((15u << 26) | ((size == 32 ? 2 : 13) << 16)))
- target->set_tprel_opt(false);
+ target->set_no_tprel_opt();
}
}
break;
@@ -9283,7 +9282,7 @@ Target_powerpc<size, big_endian>::Scan::global(
break;
// Fall through.
case elfcpp::R_POWERPC_TPREL16_HI:
- target->set_tprel_opt(false);
+ target->set_no_tprel_opt();
break;
default:
break;