diff options
author | Cary Coutant <ccoutant@google.com> | 2011-04-22 22:39:55 +0000 |
---|---|---|
committer | Cary Coutant <ccoutant@google.com> | 2011-04-22 22:39:55 +0000 |
commit | 94a3fc8b837eb39007fa4e82120f60ec9429317d (patch) | |
tree | 36553d09d1690d090951979ae7df2653c6bb471a /gold/incremental.h | |
parent | c87e430233549c1670ff335b0d4614f1ea1d7edb (diff) | |
download | gdb-94a3fc8b837eb39007fa4e82120f60ec9429317d.zip gdb-94a3fc8b837eb39007fa4e82120f60ec9429317d.tar.gz gdb-94a3fc8b837eb39007fa4e82120f60ec9429317d.tar.bz2 |
* incremental.cc (Sized_incremental_binary::setup_readers): Allocate
global symbol map.
(Sized_incremental_binary::do_apply_incremental_relocs): New function.
(Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
(Sized_incr_relobj::do_relocate): Remap section indices in incremental
relocations.
(Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
(Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
(Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
* incremental.h
(Incremental_inputs_reader::global_symbol_reader_at_offset): New
function.
(Incremental_binary::apply_incremental_relocs): New function.
(Incremental_binary::do_apply_incremental_relocs): New function.
(Sized_incremental_binary::Sized_incremental_binary): Initialize new
data member.
(Sized_incremental_binary::add_global_symbol): New function.
(Sized_incremental_binary::global_symbol): New function.
(Sized_incremental_binary::do_apply_incremental_relocs): New function.
(Sized_incremental_binary::symbol_map_): New data member.
* layout.cc (Layout_task_runner::run): Apply incremental relocations.
* target.h (Sized_target::apply_relocation): New function.
* target-reloc.h (apply_relocation): New function.
* x86_64.cc (Target_x86_64::apply_relocation): New function.
Diffstat (limited to 'gold/incremental.h')
-rw-r--r-- | gold/incremental.h | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/gold/incremental.h b/gold/incremental.h index 2b3f0e7..dad5d66 100644 --- a/gold/incremental.h +++ b/gold/incremental.h @@ -898,6 +898,14 @@ class Incremental_inputs_reader return Incremental_input_entry_reader(this, offset); } + // Return a reader for the global symbol info at OFFSET. + Incremental_global_symbol_reader<big_endian> + global_symbol_reader_at_offset(unsigned int offset) const + { + const unsigned char* p = this->p_ + offset; + return Incremental_global_symbol_reader<big_endian>(p); + } + private: // Lookup a string in the ELF string table. const char* get_string(unsigned int offset) const @@ -1207,6 +1215,12 @@ class Incremental_binary reserve_layout(unsigned int input_file_index) { this->do_reserve_layout(input_file_index); } + // Apply incremental relocations for symbols whose values have changed. + void + apply_incremental_relocs(const Symbol_table* symtab, Layout* layout, + Output_file* of) + { this->do_apply_incremental_relocs(symtab, layout, of); } + // Functions and types for the elfcpp::Elf_file interface. This // permit us to use Incremental_binary as the File template parameter for // elfcpp::Elf_file. @@ -1279,6 +1293,10 @@ class Incremental_binary virtual void do_reserve_layout(unsigned int input_file_index) = 0; + // Apply incremental relocations for symbols whose values have changed. + virtual void + do_apply_incremental_relocs(const Symbol_table*, Layout*, Output_file*) = 0; + virtual unsigned int do_input_file_count() const = 0; @@ -1307,8 +1325,8 @@ class Sized_incremental_binary : public Incremental_binary const elfcpp::Ehdr<size, big_endian>& ehdr, Target* target) : Incremental_binary(output, target), elf_file_(this, ehdr), - section_map_(), has_incremental_info_(false), inputs_reader_(), - symtab_reader_(), relocs_reader_(), got_plt_reader_(), + section_map_(), symbol_map_(), has_incremental_info_(false), + inputs_reader_(), symtab_reader_(), relocs_reader_(), got_plt_reader_(), input_entry_readers_() { this->setup_readers(); } @@ -1322,6 +1340,20 @@ class Sized_incremental_binary : public Incremental_binary output_section(unsigned int shndx) { return this->section_map_[shndx]; } + // Map a symbol table entry from the input file to the output symbol table. + // SYMNDX is relative to the first forced-local or global symbol in the + // input file symbol table. + void + add_global_symbol(unsigned int symndx, Symbol* gsym) + { this->symbol_map_[symndx] = gsym; } + + // Map a symbol table entry from the input file to the output symbol table. + // SYMNDX is relative to the first forced-local or global symbol in the + // input file symbol table. + Symbol* + global_symbol(unsigned int symndx) const + { return this->symbol_map_[symndx]; } + // Readers for the incremental info sections. const Incremental_inputs_reader<size, big_endian>& @@ -1366,6 +1398,11 @@ class Sized_incremental_binary : public Incremental_binary virtual void do_reserve_layout(unsigned int input_file_index); + // Apply incremental relocations for symbols whose values have changed. + virtual void + do_apply_incremental_relocs(const Symbol_table* symtab, Layout* layout, + Output_file* of); + // Proxy class for a sized Incremental_input_entry_reader. class Sized_input_reader : public Input_reader @@ -1435,6 +1472,9 @@ class Sized_incremental_binary : public Incremental_binary // Map section index to an Output_section in the updated layout. std::vector<Output_section*> section_map_; + // Map global symbols from the input file to the symbol table. + std::vector<Symbol*> symbol_map_; + // Readers for the incremental info sections. bool has_incremental_info_; Incremental_inputs_reader<size, big_endian> inputs_reader_; |