mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 17:18:55 +00:00
2010-09-08 Doug Kwan <dougkwan@google.com>
* arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method. (Arm_relobj::do_relocate_sections): Add new parameter for output file to match the parent. (Target_arm::scan_reloc_section_for_stubs): Use would-be final values of local symbols instead of input values. Update code to track changes in gold::relocate_section. * object.cc (Sized_relobj::compute_final_local_value): New methods. (Sized_relobj::compute_final_local_value_internal): New methods. (Sized_relobj::do_finalize_local_symbols): Move code from loop body into private version of Sized_relobj::compute_final_local_value. Call the inline method. * object.h (Symbol_value::Symbol_value): Define destructor. Free merged symbol value if there is one. (Symbol_value::has_output_value): New method defintiion. (Sized_relobj::Compute_final_local_value_status): New enum type. (Sized_relobj::compute_final_local_value): New methods. (Sized_relobj::compute_final_local_value_internal): New methods. * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh and arm_cortex_a8.sh. (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl, arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc): New tests. * Makefile.in: Regenerate. * testsuite/arm_bl_out_of_range.s: Update test. * testsuite/thumb_bl_out_of_range.s: Ditto. * testsuite/thumb_blx_out_of_range.s: Ditto. * testsuite/arm_branch_out_of_range.sh: New file. * testsuite/arm_cortex_a8.sh: Ditto. * testsuite/arm_cortex_a8_b.s: Ditto. * testsuite/arm_cortex_a8_b_cond.s: Ditto. * testsuite/arm_cortex_a8_b_local.s: Ditto. * testsuite/arm_cortex_a8_bl.s: Ditto. * testsuite/arm_cortex_a8_blx.s: Ditto. * testsuite/arm_cortex_a8_local.s: Ditto. * testsuite/arm_cortex_a8_local_reloc.s: Ditto. * testsuite/thumb_bl_out_of_range_local.s: Ditto.
This commit is contained in:
@@ -1155,6 +1155,12 @@ class Symbol_value
|
||||
is_tls_symbol_(false), is_ifunc_symbol_(false), has_output_value_(true)
|
||||
{ this->u_.value = 0; }
|
||||
|
||||
~Symbol_value()
|
||||
{
|
||||
if (!this->has_output_value_)
|
||||
delete this->u_.merged_symbol_value;
|
||||
}
|
||||
|
||||
// Get the value of this symbol. OBJECT is the object in which this
|
||||
// symbol is defined, and ADDEND is an addend to add to the value.
|
||||
template<bool big_endian>
|
||||
@@ -1380,6 +1386,11 @@ class Symbol_value
|
||||
is_ifunc_symbol() const
|
||||
{ return this->is_ifunc_symbol_; }
|
||||
|
||||
// Return true if this has output value.
|
||||
bool
|
||||
has_output_value() const
|
||||
{ return this->has_output_value_; }
|
||||
|
||||
private:
|
||||
// The index of this local symbol in the output symbol table. This
|
||||
// will be 0 if no value has been assigned yet, and the symbol may
|
||||
@@ -1558,6 +1569,16 @@ class Sized_relobj : public Relobj
|
||||
|
||||
static const Address invalid_address = static_cast<Address>(0) - 1;
|
||||
|
||||
enum Compute_final_local_value_status
|
||||
{
|
||||
// No error.
|
||||
CFLV_OK,
|
||||
// An error occurred.
|
||||
CFLV_ERROR,
|
||||
// The local symbol has no output section.
|
||||
CFLV_DISCARDED
|
||||
};
|
||||
|
||||
Sized_relobj(const std::string& name, Input_file* input_file, off_t offset,
|
||||
const typename elfcpp::Ehdr<size, big_endian>&);
|
||||
|
||||
@@ -1742,6 +1763,22 @@ class Sized_relobj : public Relobj
|
||||
Address
|
||||
map_to_kept_section(unsigned int shndx, bool* found) const;
|
||||
|
||||
// Compute final local symbol value. R_SYM is the local symbol index.
|
||||
// LV_IN points to a local symbol value containing the input value.
|
||||
// LV_OUT points to a local symbol value storing the final output value,
|
||||
// which must not be a merged symbol value since before calling this
|
||||
// method to avoid memory leak. SYMTAB points to a symbol table.
|
||||
//
|
||||
// The method returns a status code at return. If the return status is
|
||||
// CFLV_OK, *LV_OUT contains the final value. If the return status is
|
||||
// CFLV_ERROR, *LV_OUT is 0. If the return status is CFLV_DISCARDED,
|
||||
// *LV_OUT is not modified.
|
||||
Compute_final_local_value_status
|
||||
compute_final_local_value(unsigned int r_sym,
|
||||
const Symbol_value<size>* lv_in,
|
||||
Symbol_value<size>* lv_out,
|
||||
const Symbol_table* symtab);
|
||||
|
||||
protected:
|
||||
// Set up.
|
||||
virtual void
|
||||
@@ -2162,6 +2199,28 @@ class Sized_relobj : public Relobj
|
||||
return true;
|
||||
}
|
||||
|
||||
// Compute final local symbol value. R_SYM is the local symbol index.
|
||||
// LV_IN points to a local symbol value containing the input value.
|
||||
// LV_OUT points to a local symbol value storing the final output value,
|
||||
// which must not be a merged symbol value since before calling this
|
||||
// method to avoid memory leak. RELOCATABLE indicates whether we are
|
||||
// linking a relocatable output. OUT_SECTIONS is an array of output
|
||||
// sections. OUT_OFFSETS is an array of offsets of the sections. SYMTAB
|
||||
// points to a symbol table.
|
||||
//
|
||||
// The method returns a status code at return. If the return status is
|
||||
// CFLV_OK, *LV_OUT contains the final value. If the return status is
|
||||
// CFLV_ERROR, *LV_OUT is 0. If the return status is CFLV_DISCARDED,
|
||||
// *LV_OUT is not modified.
|
||||
inline Compute_final_local_value_status
|
||||
compute_final_local_value_internal(unsigned int r_sym,
|
||||
const Symbol_value<size>* lv_in,
|
||||
Symbol_value<size>* lv_out,
|
||||
bool relocatable,
|
||||
const Output_sections& out_sections,
|
||||
const std::vector<Address>& out_offsets,
|
||||
const Symbol_table* symtab);
|
||||
|
||||
// The GOT offsets of local symbols. This map also stores GOT offsets
|
||||
// for tp-relative offsets for TLS symbols.
|
||||
typedef Unordered_map<unsigned int, Got_offset_list*> Local_got_offsets;
|
||||
|
||||
Reference in New Issue
Block a user