aboutsummaryrefslogtreecommitdiff
path: root/gold/reloc.h
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2007-11-09 07:00:15 +0000
committerIan Lance Taylor <iant@google.com>2007-11-09 07:00:15 +0000
commit730cdc88f70c0804b5daf2259d3bd8ad29b6411b (patch)
treebdc5f06993a5579fea47d658ecb900c9586727f2 /gold/reloc.h
parent0abe36f50df0f2475fec735f5c907bb7af584ab0 (diff)
downloadgdb-730cdc88f70c0804b5daf2259d3bd8ad29b6411b.zip
gdb-730cdc88f70c0804b5daf2259d3bd8ad29b6411b.tar.gz
gdb-730cdc88f70c0804b5daf2259d3bd8ad29b6411b.tar.bz2
Generate a complete exception frame header. Discard duplicate
exception frame information.
Diffstat (limited to 'gold/reloc.h')
-rw-r--r--gold/reloc.h58
1 files changed, 56 insertions, 2 deletions
diff --git a/gold/reloc.h b/gold/reloc.h
index 1bf0457..5d2a160 100644
--- a/gold/reloc.h
+++ b/gold/reloc.h
@@ -129,9 +129,12 @@ class Relocate_task : public Task
public:
Relocate_task(const General_options& options, const Symbol_table* symtab,
const Layout* layout, Relobj* object, Output_file* of,
- Task_token* final_blocker)
+ Task_token* input_sections_blocker,
+ Task_token* output_sections_blocker, Task_token* final_blocker)
: options_(options), symtab_(symtab), layout_(layout), object_(object),
- of_(of), final_blocker_(final_blocker)
+ of_(of), input_sections_blocker_(input_sections_blocker),
+ output_sections_blocker_(output_sections_blocker),
+ final_blocker_(final_blocker)
{ }
// The standard Task methods.
@@ -153,6 +156,8 @@ class Relocate_task : public Task
const Layout* layout_;
Relobj* object_;
Output_file* of_;
+ Task_token* input_sections_blocker_;
+ Task_token* output_sections_blocker_;
Task_token* final_blocker_;
};
@@ -594,6 +599,55 @@ class Copy_relocs
Copy_reloc_entries entries_;
};
+// Track relocations while reading a section. This lets you ask for
+// the relocation at a certain offset, and see how relocs occur
+// between points of interest.
+
+template<int size, bool big_endian>
+class Track_relocs
+{
+ public:
+ Track_relocs()
+ : object_(NULL), prelocs_(NULL), len_(0), pos_(0), reloc_size_(0)
+ { }
+
+ // Initialize the Track_relocs object. OBJECT is the object holding
+ // the reloc section, RELOC_SHNDX is the section index of the reloc
+ // section, and RELOC_TYPE is the type of the reloc section
+ // (elfcpp::SHT_REL or elfcpp::SHT_RELA). This returns false if
+ // something went wrong.
+ bool
+ initialize(Sized_relobj<size, big_endian>* object, unsigned int reloc_shndx,
+ unsigned int reloc_type);
+
+ // Return the offset in the data section to which the next reloc
+ // applies. THis returns -1 if there is no next reloc.
+ off_t
+ next_offset() const;
+
+ // Return the symbol index of the next reloc. This returns -1U if
+ // there is no next reloc.
+ unsigned int
+ next_symndx() const;
+
+ // Advance to OFFSET within the data section, and return the number
+ // of relocs which would be skipped.
+ int
+ advance(off_t offset);
+
+ private:
+ // The object file.
+ Sized_relobj<size, big_endian>* object_;
+ // The contents of the reloc section.
+ const unsigned char* prelocs_;
+ // The length of the reloc section.
+ off_t len_;
+ // Our current position in the reloc section.
+ off_t pos_;
+ // The size of the relocs in the section.
+ int reloc_size_;
+};
+
} // End namespace gold.
#endif // !defined(GOLD_RELOC_H)