summaryrefslogtreecommitdiff
path: root/gold/target.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2012-09-09 03:43:51 +0000
committerAlan Modra <amodra@gmail.com>2012-09-09 03:43:51 +0000
commite81fea4d172699b2e986bc541f812cac0995da6b (patch)
treef53406e2ad174c23989c3052f9f6367ff7967099 /gold/target.h
parentb7099d964f9a5736272cadb6d19083d643005aa1 (diff)
downloadbinutils-gdb-e81fea4d172699b2e986bc541f812cac0995da6b.tar.gz
* target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
(Sized_target::gc_add_reference, do_gc_add_reference): New functions. * gc.h (gc_process_relocs): Call target gc_add_reference. * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym. * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol. (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove unnecessary cast. * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters to cater for when we don't need code offset. Update use. (Powerpc_relobj::access_from_map_, opd_valid_): New vars. (Powerpc_relobj::access_from_map, add_reference, opd_valid, set_opd_valid): New functions. (Target_powerpc::do_gc_add_reference): New function. (Target_powerpc::gc_process_relocs): Call gc()->add_reference on stashed refs. (Target_powerpc::do_gc_mark_symbol): New function.
Diffstat (limited to 'gold/target.h')
-rw-r--r--gold/target.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/gold/target.h b/gold/target.h
index 25ac96b492f..effde151a7a 100644
--- a/gold/target.h
+++ b/gold/target.h
@@ -421,6 +421,11 @@ class Target
size_t* plen) const
{ return this->do_output_section_name(relobj, name, plen); }
+ // Add any special sections for this symbol to the gc work list.
+ void
+ gc_mark_symbol(Symbol_table* symtab, Symbol* sym) const
+ { this->do_gc_mark_symbol(symtab, sym); }
+
protected:
// This struct holds the constant information for a child class. We
// use a struct to avoid the overhead of virtual function calls for
@@ -669,6 +674,11 @@ class Target
do_output_section_name(const Relobj*, const char*, size_t*) const
{ return NULL; }
+ // This may be overridden by the child class.
+ virtual void
+ do_gc_mark_symbol(Symbol_table*, Symbol*) const
+ { }
+
private:
// The implementations of the four do_make_elf_object virtual functions are
// almost identical except for their sizes and endianness. We use a template.
@@ -935,6 +945,21 @@ class Sized_target : public Target
section_size_type /* view_size */)
{ gold_unreachable(); }
+ // Handle target specific gc actions when adding a gc reference from
+ // SRC_OBJ, SRC_SHNDX to a location specified by DST_OBJ, DST_SHNDX
+ // and DST_OFF.
+ void
+ gc_add_reference(Symbol_table* symtab,
+ Object* src_obj,
+ unsigned int src_shndx,
+ Object* dst_obj,
+ unsigned int dst_shndx,
+ typename elfcpp::Elf_types<size>::Elf_Addr dst_off) const
+ {
+ this->do_gc_add_reference(symtab, src_obj, src_shndx,
+ dst_obj, dst_shndx, dst_off);
+ }
+
protected:
Sized_target(const Target::Target_info* pti)
: Target(pti)
@@ -946,6 +971,13 @@ class Sized_target : public Target
// Set the EI_OSABI field if requested.
virtual void
do_adjust_elf_header(unsigned char*, int) const;
+
+ // Handle target specific gc actions when adding a gc reference.
+ virtual void
+ do_gc_add_reference(Symbol_table*, Object*, unsigned int,
+ Object*, unsigned int,
+ typename elfcpp::Elf_types<size>::Elf_Addr) const
+ { }
};
} // End namespace gold.