aboutsummaryrefslogtreecommitdiff
path: root/gold/copy-relocs.cc
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2011-06-08 03:50:12 +0000
committerCary Coutant <ccoutant@google.com>2011-06-08 03:50:12 +0000
commit26d3c67de1d0e6434dabb908e5a6fa002f5b1db8 (patch)
treeadebe5713f81ac6e6f85f353dcc70e83ad4d8a65 /gold/copy-relocs.cc
parentb8e9bd6c6461ea6a53d5a48bad21aab75cd1e9e5 (diff)
downloadgdb-26d3c67de1d0e6434dabb908e5a6fa002f5b1db8.zip
gdb-26d3c67de1d0e6434dabb908e5a6fa002f5b1db8.tar.gz
gdb-26d3c67de1d0e6434dabb908e5a6fa002f5b1db8.tar.bz2
* copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
instead of emit_copy_reloc. (Copy_relocs::emit_copy_reloc): Refactor. (Copy_relocs::make_copy_reloc): New function. (Copy_relocs::add_copy_reloc): Remove. * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public section. (Copy_relocs::make_copy_reloc): New function. (Copy_relocs::add_copy_reloc): Remove. * gold.cc (queue_middle_tasks): Emit old COPY relocations from unchanged input files. * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag. * incremental.cc (Sized_incremental_binary::do_reserve_layout): Reserve BSS space for COPY relocations. (Sized_incremental_binary::do_emit_copy_relocs): New function. (Output_section_incremental_inputs::write_info_blocks): Record whether a symbol is copied from a shared object. (Sized_incr_dynobj::do_add_symbols): Record COPY relocations. * incremental.h (enum Incremental_shlib_symbol_flags): New type. (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant. (Incremental_input_entry_reader::get_output_symbol_index): Add is_copy parameter. (Incremental_binary::emit_copy_relocs): New function. (Incremental_binary::do_emit_copy_relocs): New function. (Sized_incremental_binary::Sized_incremental_binary): Initialize new data member. (Sized_incremental_binary::add_copy_reloc): New function. (Sized_incremental_binary::do_emit_copy_relocs): New function. (Sized_incremental_binary::Copy_reloc): New struct. (Sized_incremental_binary::Copy_relocs): New typedef. (Sized_incremental_binary::copy_relocs_): New data member. * symtab.cc (Symbol_table::add_from_incrobj): Change return type. * symtab.h (Symbol_table::add_from_incrobj): Change return type. * target.h (Sized_target::emit_copy_reloc): New function. * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
Diffstat (limited to 'gold/copy-relocs.cc')
-rw-r--r--gold/copy-relocs.cc39
1 files changed, 20 insertions, 19 deletions
diff --git a/gold/copy-relocs.cc b/gold/copy-relocs.cc
index bfdbb90..20b110d 100644
--- a/gold/copy-relocs.cc
+++ b/gold/copy-relocs.cc
@@ -65,7 +65,7 @@ Copy_relocs<sh_type, size, big_endian>::copy_reloc(
Output_data_reloc<sh_type, true, size, big_endian>* reloc_section)
{
if (this->need_copy_reloc(sym, object, shndx))
- this->emit_copy_reloc(symtab, layout, sym, reloc_section);
+ this->make_copy_reloc(symtab, layout, sym, reloc_section);
else
{
// We may not need a COPY relocation. Save this relocation to
@@ -106,6 +106,24 @@ template<int sh_type, int size, bool big_endian>
void
Copy_relocs<sh_type, size, big_endian>::emit_copy_reloc(
Symbol_table* symtab,
+ Sized_symbol<size>* sym,
+ Output_data* posd,
+ off_t offset,
+ Output_data_reloc<sh_type, true, size, big_endian>* reloc_section)
+{
+ // Define the symbol as being copied.
+ symtab->define_with_copy_reloc(sym, posd, offset);
+
+ // Add the COPY relocation to the dynamic reloc section.
+ reloc_section->add_global(sym, this->copy_reloc_type_, posd, offset, 0);
+}
+
+// Make a COPY relocation for SYM and emit it.
+
+template<int sh_type, int size, bool big_endian>
+void
+Copy_relocs<sh_type, size, big_endian>::make_copy_reloc(
+ Symbol_table* symtab,
Layout* layout,
Sized_symbol<size>* sym,
Output_data_reloc<sh_type, true, size, big_endian>* reloc_section)
@@ -164,24 +182,7 @@ Copy_relocs<sh_type, size, big_endian>::emit_copy_reloc(
section_size_type offset = dynbss_size;
dynbss->set_current_data_size(dynbss_size + symsize);
- // Define the symbol as being copied.
- symtab->define_with_copy_reloc(sym, dynbss, offset);
-
- // Add the COPY relocation to the dynamic reloc section.
- this->add_copy_reloc(sym, offset, reloc_section);
-}
-
-// Add a COPY relocation for SYM to RELOC_SECTION.
-
-template<int sh_type, int size, bool big_endian>
-void
-Copy_relocs<sh_type, size, big_endian>::add_copy_reloc(
- Symbol* sym,
- section_size_type offset,
- Output_data_reloc<sh_type, true, size, big_endian>* reloc_section)
-{
- reloc_section->add_global(sym, this->copy_reloc_type_, this->dynbss_,
- offset, 0);
+ this->emit_copy_reloc(symtab, sym, dynbss, offset, reloc_section);
}
// Save a relocation to possibly be emitted later.