GNU Binutils with patches for OS216
Revisión | f9aa8e5d979f7b60ca37b331a1dacebcf5e89a4f (tree) |
---|---|
Tiempo | 2017-02-22 08:10:20 |
Autor | Alan Modra <amodra@gmai...> |
Commiter | Alan Modra |
[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.
@@ -1,6 +1,12 @@ | ||
1 | 1 | 2017-02-22 Alan Modra <amodra@gmail.com> |
2 | 2 | |
3 | 3 | Apply from master |
4 | + 2016-12-07 Alan Modra <amodra@gmail.com> | |
5 | + * powerpc.cc (Stub_table_owner): Provide constructor. | |
6 | + (Powerpc_relobj::set_stub_table): Resize fill with -1. | |
7 | + (Target_powerpc::Branch_info::make_stub): Provide target debug | |
8 | + output on returning false. | |
9 | + | |
4 | 10 | 2016-12-01 Cary Coutant <ccoutant@gmail.com> |
5 | 11 | PR gold/20807 |
6 | 12 | * aarch64.cc (Target_aarch64::scan_reloc_section_for_stubs): Handle |
@@ -70,6 +70,10 @@ class Target_powerpc; | ||
70 | 70 | |
71 | 71 | struct Stub_table_owner |
72 | 72 | { |
73 | + Stub_table_owner() | |
74 | + : output_section(NULL), owner(NULL) | |
75 | + { } | |
76 | + | |
73 | 77 | Output_section* output_section; |
74 | 78 | const Output_section::Input_section* owner; |
75 | 79 | }; |
@@ -275,7 +279,7 @@ public: | ||
275 | 279 | set_stub_table(unsigned int shndx, unsigned int stub_index) |
276 | 280 | { |
277 | 281 | if (shndx >= this->stub_table_index_.size()) |
278 | - this->stub_table_index_.resize(shndx + 1); | |
282 | + this->stub_table_index_.resize(shndx + 1, -1); | |
279 | 283 | this->stub_table_index_[shndx] = stub_index; |
280 | 284 | } |
281 | 285 |
@@ -2720,6 +2724,8 @@ Target_powerpc<size, big_endian>::Branch_info::make_stub( | ||
2720 | 2724 | Target_powerpc<size, big_endian>* target = |
2721 | 2725 | static_cast<Target_powerpc<size, big_endian>*>( |
2722 | 2726 | parameters->sized_target<size, big_endian>()); |
2727 | + bool ok = true; | |
2728 | + | |
2723 | 2729 | if (gsym != NULL |
2724 | 2730 | ? gsym->use_plt_offset(Scan::get_reference_flags(this->r_type_, target)) |
2725 | 2731 | : this->object_->local_has_plt_offset(this->r_sym_)) |
@@ -2745,13 +2751,13 @@ Target_powerpc<size, big_endian>::Branch_info::make_stub( | ||
2745 | 2751 | from += (this->object_->output_section(this->shndx_)->address() |
2746 | 2752 | + this->offset_); |
2747 | 2753 | if (gsym != NULL) |
2748 | - return stub_table->add_plt_call_entry(from, | |
2749 | - this->object_, gsym, | |
2750 | - this->r_type_, this->addend_); | |
2754 | + ok = stub_table->add_plt_call_entry(from, | |
2755 | + this->object_, gsym, | |
2756 | + this->r_type_, this->addend_); | |
2751 | 2757 | else |
2752 | - return stub_table->add_plt_call_entry(from, | |
2753 | - this->object_, this->r_sym_, | |
2754 | - this->r_type_, this->addend_); | |
2758 | + ok = stub_table->add_plt_call_entry(from, | |
2759 | + this->object_, this->r_sym_, | |
2760 | + this->r_type_, this->addend_); | |
2755 | 2761 | } |
2756 | 2762 | } |
2757 | 2763 | else |
@@ -2838,12 +2844,22 @@ Target_powerpc<size, big_endian>::Branch_info::make_stub( | ||
2838 | 2844 | && gsym != NULL |
2839 | 2845 | && gsym->source() == Symbol::IN_OUTPUT_DATA |
2840 | 2846 | && gsym->output_data() == target->savres_section()); |
2841 | - return stub_table->add_long_branch_entry(this->object_, | |
2842 | - this->r_type_, | |
2843 | - from, to, save_res); | |
2847 | + ok = stub_table->add_long_branch_entry(this->object_, | |
2848 | + this->r_type_, | |
2849 | + from, to, save_res); | |
2844 | 2850 | } |
2845 | 2851 | } |
2846 | - return true; | |
2852 | + if (!ok) | |
2853 | + gold_debug(DEBUG_TARGET, | |
2854 | + "branch at %s:%s+%#lx\n" | |
2855 | + "can't reach stub attached to %s:%s", | |
2856 | + this->object_->name().c_str(), | |
2857 | + this->object_->section_name(this->shndx_).c_str(), | |
2858 | + (unsigned long) this->offset_, | |
2859 | + stub_table->relobj()->name().c_str(), | |
2860 | + stub_table->relobj()->section_name(stub_table->shndx()).c_str()); | |
2861 | + | |
2862 | + return ok; | |
2847 | 2863 | } |
2848 | 2864 | |
2849 | 2865 | // Relaxation hook. This is where we do stub generation. |