diff options
Diffstat (limited to 'binutils-2.22/gold/arm.cc')
-rw-r--r-- | binutils-2.22/gold/arm.cc | 85 |
1 files changed, 59 insertions, 26 deletions
diff --git a/binutils-2.22/gold/arm.cc b/binutils-2.22/gold/arm.cc index e31bb60..d41ba350 100644 --- a/binutils-2.22/gold/arm.cc +++ b/binutils-2.22/gold/arm.cc @@ -2574,6 +2574,9 @@ class Target_arm : public Sized_target<32, big_endian> && Target::do_section_may_have_icf_unsafe_pointers(section_name)); } + virtual void + do_define_standard_symbols(Symbol_table*, Layout*); + private: // The class which scans relocations. class Scan @@ -8582,7 +8585,7 @@ void Target_arm<big_endian>::do_finalize_sections( Layout* layout, const Input_objects* input_objects, - Symbol_table* symtab) + Symbol_table*) { bool merged_any_attributes = false; // Merge processor-specific flags. @@ -8669,18 +8672,6 @@ Target_arm<big_endian>::do_finalize_sections( if (exidx_section != NULL && exidx_section->type() == elfcpp::SHT_ARM_EXIDX) { - // Create __exidx_start and __exidx_end symbols. - symtab->define_in_output_data("__exidx_start", NULL, - Symbol_table::PREDEFINED, - exidx_section, 0, 0, elfcpp::STT_OBJECT, - elfcpp::STB_GLOBAL, elfcpp::STV_HIDDEN, - 0, false, true); - symtab->define_in_output_data("__exidx_end", NULL, - Symbol_table::PREDEFINED, - exidx_section, 0, 0, elfcpp::STT_OBJECT, - elfcpp::STB_GLOBAL, elfcpp::STV_HIDDEN, - 0, true, true); - // For the ARM target, we need to add a PT_ARM_EXIDX segment for // the .ARM.exidx section. if (!layout->script_options()->saw_phdrs_clause()) @@ -8694,19 +8685,6 @@ Target_arm<big_endian>::do_finalize_sections( elfcpp::PF_R); } } - else - { - symtab->define_as_constant("__exidx_start", NULL, - Symbol_table::PREDEFINED, - 0, 0, elfcpp::STT_OBJECT, - elfcpp::STB_GLOBAL, elfcpp::STV_HIDDEN, 0, - true, false); - symtab->define_as_constant("__exidx_end", NULL, - Symbol_table::PREDEFINED, - 0, 0, elfcpp::STT_OBJECT, - elfcpp::STB_GLOBAL, elfcpp::STV_HIDDEN, 0, - true, false); - } } // Create an .ARM.attributes section if we have merged any attributes @@ -11994,6 +11972,61 @@ Target_arm<big_endian>::fix_exidx_coverage( merge_exidx_entries(), task); } +template<bool big_endian> +void +Target_arm<big_endian>::do_define_standard_symbols( + Symbol_table* symtab, + Layout* layout) +{ + // Handle the .ARM.exidx section. + Output_section* exidx_section = layout->find_output_section(".ARM.exidx"); + + if (exidx_section != NULL) + { + // Create __exidx_start and __exidx_end symbols. + symtab->define_in_output_data("__exidx_start", + NULL, // version + Symbol_table::PREDEFINED, + exidx_section, + 0, // value + 0, // symsize + elfcpp::STT_NOTYPE, + elfcpp::STB_GLOBAL, + elfcpp::STV_HIDDEN, + 0, // nonvis + false, // offset_is_from_end + true); // only_if_ref + + symtab->define_in_output_data("__exidx_end", + NULL, // version + Symbol_table::PREDEFINED, + exidx_section, + 0, // value + 0, // symsize + elfcpp::STT_NOTYPE, + elfcpp::STB_GLOBAL, + elfcpp::STV_HIDDEN, + 0, // nonvis + true, // offset_is_from_end + true); // only_if_ref + } + else + { + // Define __exidx_start and __exidx_end even when .ARM.exidx + // section is missing to match ld's behaviour. + symtab->define_as_constant("__exidx_start", NULL, + Symbol_table::PREDEFINED, + 0, 0, elfcpp::STT_OBJECT, + elfcpp::STB_GLOBAL, elfcpp::STV_HIDDEN, 0, + true, false); + symtab->define_as_constant("__exidx_end", NULL, + Symbol_table::PREDEFINED, + 0, 0, elfcpp::STT_OBJECT, + elfcpp::STB_GLOBAL, elfcpp::STV_HIDDEN, 0, + true, false); + } +} + Target_selector_arm<false> target_selector_arm; Target_selector_arm<true> target_selector_armbe; |