aboutsummaryrefslogtreecommitdiff
path: root/gold/object.h
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2008-02-06 08:13:50 +0000
committerIan Lance Taylor <iant@google.com>2008-02-06 08:13:50 +0000
commit6a74a71947df73c828f073af0dcad0c323dcd8c4 (patch)
tree19103071382f3c094d30ea8fa6e8d8bbc0af1031 /gold/object.h
parent0797561a54769f4d8217c1f141858380025b0094 (diff)
downloadgdb-6a74a71947df73c828f073af0dcad0c323dcd8c4.zip
gdb-6a74a71947df73c828f073af0dcad0c323dcd8c4.tar.gz
gdb-6a74a71947df73c828f073af0dcad0c323dcd8c4.tar.bz2
Initial -r support.
Diffstat (limited to 'gold/object.h')
-rw-r--r--gold/object.h46
1 files changed, 42 insertions, 4 deletions
diff --git a/gold/object.h b/gold/object.h
index 5a62546..dbe0ca1 100644
--- a/gold/object.h
+++ b/gold/object.h
@@ -41,6 +41,7 @@ class Output_section;
class Output_file;
class Dynobj;
class Object_merge_map;
+class Relocatable_relocs;
template<typename Stringpool_char>
class Stringpool_template;
@@ -456,6 +457,7 @@ class Relobj : public Object
Relobj(const std::string& name, Input_file* input_file, off_t offset = 0)
: Object(name, input_file, false, offset),
map_to_output_(),
+ map_to_relocatable_relocs_(NULL),
object_merge_map_(NULL),
relocs_must_follow_section_writes_(false)
{ }
@@ -562,6 +564,22 @@ class Relobj : public Object
this->object_merge_map_ = object_merge_map;
}
+ // Record the relocatable reloc info for an input reloc section.
+ void
+ set_relocatable_relocs(unsigned int reloc_shndx, Relocatable_relocs* rr)
+ {
+ gold_assert(reloc_shndx < this->shnum());
+ (*this->map_to_relocatable_relocs_)[reloc_shndx] = rr;
+ }
+
+ // Get the relocatable reloc info for an input reloc section.
+ Relocatable_relocs*
+ relocatable_relocs(unsigned int reloc_shndx)
+ {
+ gold_assert(reloc_shndx < this->shnum());
+ return (*this->map_to_relocatable_relocs_)[reloc_shndx];
+ }
+
protected:
// What we need to know to map an input section to an output
// section. We keep an array of these, one for each input section,
@@ -592,10 +610,11 @@ class Relobj : public Object
// Count local symbols--implemented by child class.
virtual void
do_count_local_symbols(Stringpool_template<char>*,
- Stringpool_template<char>*) = 0;
+ Stringpool_template<char>*) = 0;
- // Finalize the local symbols. Set the output symbol table indexes for the local variables, and set the
- // offset where local symbol information will be stored.
+ // Finalize the local symbols. Set the output symbol table indexes
+ // for the local variables, and set the offset where local symbol
+ // information will be stored.
virtual unsigned int
do_finalize_local_symbols(unsigned int, off_t) = 0;
@@ -622,6 +641,14 @@ class Relobj : public Object
map_to_output() const
{ return this->map_to_output_; }
+ // Set the size of the relocatable relocs array.
+ void
+ size_relocatable_relocs()
+ {
+ this->map_to_relocatable_relocs_ =
+ new std::vector<Relocatable_relocs*>(this->shnum());
+ }
+
// Record that we must wait for the output sections to be written
// before applying relocations.
void
@@ -631,6 +658,9 @@ class Relobj : public Object
private:
// Mapping from input sections to output section.
std::vector<Map_to_output> map_to_output_;
+ // Mapping from input section index to the information recorded for
+ // the relocations. This is only used for a relocatable link.
+ std::vector<Relocatable_relocs*>* map_to_relocatable_relocs_;
// Mappings for merge sections. This is managed by the code in the
// Merge_map class.
Object_merge_map* object_merge_map_;
@@ -992,6 +1022,14 @@ class Sized_relobj : public Relobj
return this->local_values_[sym].output_dynsym_index();
}
+ // Return the input section index of local symbol SYM.
+ unsigned int
+ local_symbol_input_shndx(unsigned int sym) const
+ {
+ gold_assert(sym < this->local_values_.size());
+ return this->local_values_[sym].input_shndx();
+ }
+
// Return the appropriate Sized_target structure.
Sized_target<size, big_endian>*
sized_target()
@@ -1218,7 +1256,7 @@ class Sized_relobj : public Relobj
// Whether to include a section group in the link.
bool
- include_section_group(Layout*, unsigned int,
+ include_section_group(Symbol_table*, Layout*, unsigned int, const char*,
const elfcpp::Shdr<size, big_endian>&,
std::vector<bool>*);