aboutsummaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2016-12-07 14:11:57 +1030
committerAlan Modra <amodra@gmail.com>2016-12-07 14:11:57 +1030
commitdc60b26d983494a3cdec0d4f167ed98fde1a832a (patch)
tree8e63f7d56ce6f3d97ef392a0a13c5f8e8efa882f /gold
parent86a6934561f0048624f3ff83f5d3c2565514f0aa (diff)
downloadgdb-dc60b26d983494a3cdec0d4f167ed98fde1a832a.zip
gdb-dc60b26d983494a3cdec0d4f167ed98fde1a832a.tar.gz
gdb-dc60b26d983494a3cdec0d4f167ed98fde1a832a.tar.bz2
[GOLD] PowerPC stub debug
Some more debug output, and a little hardening. * powerpc.cc (Stub_table_owner): Provide constructor. (Powerpc_relobj::set_stub_table): Resize fill with -1. (Target_powerpc::Branch_info::make_stub): Provide target debug output on returning false.
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog7
-rw-r--r--gold/powerpc.cc38
2 files changed, 34 insertions, 11 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index ed98ff4..50af9a2 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,10 @@
+2016-12-07 Alan Modra <amodra@gmail.com>
+
+ * powerpc.cc (Stub_table_owner): Provide constructor.
+ (Powerpc_relobj::set_stub_table): Resize fill with -1.
+ (Target_powerpc::Branch_info::make_stub): Provide target debug
+ output on returning false.
+
2016-12-05 Cary Coutant <ccoutant@gmail.com>
Tristan Gingold <gingold@adacore.com>
diff --git a/gold/powerpc.cc b/gold/powerpc.cc
index 67e171c..a850c36 100644
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -70,6 +70,10 @@ class Target_powerpc;
struct Stub_table_owner
{
+ Stub_table_owner()
+ : output_section(NULL), owner(NULL)
+ { }
+
Output_section* output_section;
const Output_section::Input_section* owner;
};
@@ -275,7 +279,7 @@ public:
set_stub_table(unsigned int shndx, unsigned int stub_index)
{
if (shndx >= this->stub_table_index_.size())
- this->stub_table_index_.resize(shndx + 1);
+ this->stub_table_index_.resize(shndx + 1, -1);
this->stub_table_index_[shndx] = stub_index;
}
@@ -2720,6 +2724,8 @@ Target_powerpc<size, big_endian>::Branch_info::make_stub(
Target_powerpc<size, big_endian>* target =
static_cast<Target_powerpc<size, big_endian>*>(
parameters->sized_target<size, big_endian>());
+ bool ok = true;
+
if (gsym != NULL
? gsym->use_plt_offset(Scan::get_reference_flags(this->r_type_, target))
: this->object_->local_has_plt_offset(this->r_sym_))
@@ -2745,13 +2751,13 @@ Target_powerpc<size, big_endian>::Branch_info::make_stub(
from += (this->object_->output_section(this->shndx_)->address()
+ this->offset_);
if (gsym != NULL)
- return stub_table->add_plt_call_entry(from,
- this->object_, gsym,
- this->r_type_, this->addend_);
+ ok = stub_table->add_plt_call_entry(from,
+ this->object_, gsym,
+ this->r_type_, this->addend_);
else
- return stub_table->add_plt_call_entry(from,
- this->object_, this->r_sym_,
- this->r_type_, this->addend_);
+ ok = stub_table->add_plt_call_entry(from,
+ this->object_, this->r_sym_,
+ this->r_type_, this->addend_);
}
}
else
@@ -2838,12 +2844,22 @@ Target_powerpc<size, big_endian>::Branch_info::make_stub(
&& gsym != NULL
&& gsym->source() == Symbol::IN_OUTPUT_DATA
&& gsym->output_data() == target->savres_section());
- return stub_table->add_long_branch_entry(this->object_,
- this->r_type_,
- from, to, save_res);
+ ok = stub_table->add_long_branch_entry(this->object_,
+ this->r_type_,
+ from, to, save_res);
}
}
- return true;
+ if (!ok)
+ gold_debug(DEBUG_TARGET,
+ "branch at %s:%s+%#lx\n"
+ "can't reach stub attached to %s:%s",
+ this->object_->name().c_str(),
+ this->object_->section_name(this->shndx_).c_str(),
+ (unsigned long) this->offset_,
+ stub_table->relobj()->name().c_str(),
+ stub_table->relobj()->section_name(stub_table->shndx()).c_str());
+
+ return ok;
}
// Relaxation hook. This is where we do stub generation.