Allow target to add custom dynamic table entries.
2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com> gold/ * output.cc (Output_data_dynamic::Dynamic_entry::write): Get the value of DYNAMIC_CUSTOM dynamic entry. * output.h (Output_data_dynamic::add_custom): New function. (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM dynamic entry. (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM. * target.h (Target::dynamic_tag_custom_value): New function. (Target::do_dynamic_tag_custom_value): New function.
This commit is contained in:
parent
98ff923154
commit
918fc1f8d2
4 changed files with 38 additions and 1 deletions
|
@ -1,3 +1,14 @@
|
||||||
|
2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
|
||||||
|
|
||||||
|
* output.cc (Output_data_dynamic::Dynamic_entry::write):
|
||||||
|
Get the value of DYNAMIC_CUSTOM dynamic entry.
|
||||||
|
* output.h (Output_data_dynamic::add_custom): New function.
|
||||||
|
(Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
|
||||||
|
dynamic entry.
|
||||||
|
(enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
|
||||||
|
* target.h (Target::dynamic_tag_custom_value): New function.
|
||||||
|
(Target::do_dynamic_tag_custom_value): New function.
|
||||||
|
|
||||||
2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
|
2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
|
||||||
|
|
||||||
* symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
|
* symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
|
||||||
|
|
|
@ -1796,6 +1796,10 @@ Output_data_dynamic::Dynamic_entry::write(
|
||||||
val = pool->get_offset(this->u_.str);
|
val = pool->get_offset(this->u_.str);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case DYNAMIC_CUSTOM:
|
||||||
|
val = parameters->target().dynamic_tag_custom_value(this->tag_);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
val = this->u_.od->address() + this->offset_;
|
val = this->u_.od->address() + this->offset_;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2577,6 +2577,11 @@ class Output_data_dynamic : public Output_section_data
|
||||||
add_string(elfcpp::DT tag, const std::string& str)
|
add_string(elfcpp::DT tag, const std::string& str)
|
||||||
{ this->add_string(tag, str.c_str()); }
|
{ this->add_string(tag, str.c_str()); }
|
||||||
|
|
||||||
|
// Add a new dynamic entry with custom value.
|
||||||
|
void
|
||||||
|
add_custom(elfcpp::DT tag)
|
||||||
|
{ this->add_entry(Dynamic_entry(tag)); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Adjust the output section to set the entry size.
|
// Adjust the output section to set the entry size.
|
||||||
void
|
void
|
||||||
|
@ -2641,6 +2646,11 @@ class Output_data_dynamic : public Output_section_data
|
||||||
: tag_(tag), offset_(DYNAMIC_STRING)
|
: tag_(tag), offset_(DYNAMIC_STRING)
|
||||||
{ this->u_.str = str; }
|
{ this->u_.str = str; }
|
||||||
|
|
||||||
|
// Create an entry with a custom value.
|
||||||
|
Dynamic_entry(elfcpp::DT tag)
|
||||||
|
: tag_(tag), offset_(DYNAMIC_CUSTOM)
|
||||||
|
{ }
|
||||||
|
|
||||||
// Return the tag of this entry.
|
// Return the tag of this entry.
|
||||||
elfcpp::DT
|
elfcpp::DT
|
||||||
tag() const
|
tag() const
|
||||||
|
@ -2664,7 +2674,9 @@ class Output_data_dynamic : public Output_section_data
|
||||||
// Symbol adress.
|
// Symbol adress.
|
||||||
DYNAMIC_SYMBOL = -3U,
|
DYNAMIC_SYMBOL = -3U,
|
||||||
// String.
|
// String.
|
||||||
DYNAMIC_STRING = -4U
|
DYNAMIC_STRING = -4U,
|
||||||
|
// Custom value.
|
||||||
|
DYNAMIC_CUSTOM = -5U
|
||||||
// Any other value indicates a section address plus OFFSET.
|
// Any other value indicates a section address plus OFFSET.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -470,6 +470,11 @@ class Target
|
||||||
versions, symtab);
|
versions, symtab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the custom dynamic tag value.
|
||||||
|
unsigned int
|
||||||
|
dynamic_tag_custom_value(elfcpp::DT tag) const
|
||||||
|
{ return this->do_dynamic_tag_custom_value(tag); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// This struct holds the constant information for a child class. We
|
// This struct holds the constant information for a child class. We
|
||||||
// use a struct to avoid the overhead of virtual function calls for
|
// use a struct to avoid the overhead of virtual function calls for
|
||||||
|
@ -753,6 +758,11 @@ class Target
|
||||||
Symbol_table*) const
|
Symbol_table*) const
|
||||||
{ gold_unreachable(); }
|
{ gold_unreachable(); }
|
||||||
|
|
||||||
|
// This may be overridden by the child class.
|
||||||
|
virtual unsigned int
|
||||||
|
do_dynamic_tag_custom_value(elfcpp::DT) const
|
||||||
|
{ gold_unreachable(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// The implementations of the four do_make_elf_object virtual functions are
|
// The implementations of the four do_make_elf_object virtual functions are
|
||||||
// almost identical except for their sizes and endianness. We use a template.
|
// almost identical except for their sizes and endianness. We use a template.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue