* output.h (Output_data_got::add_global_tls, add_local_tls,

add_local_tls_pair): New functions.
	(Output_data_got::add_local_pair_with_rel): Remove second
	reloc param.  Expand comment.
	(Output_data_got::Got_entry): Rename use_plt_offset_ to
	use_plt_or_tls_offset_, similarly for constructor param.
	(Output_data_got::Got_entry::write): Add got_index param.
	* output.cc (Output_data_got::add_global_tls, add_local_tls,
	add_local_tls_pair): New functions.
	(Output_data_got::Got_entry::write): Handle tls symbols
	with use_plt_or_tls_offset_ set specially.
	(Output_data_got::add_local_pair_with_rel): Only one reloc.
	(Output_data_got::do_write): Replace iterator with index, pass
	index to entry write function.
	* target.h (Target::tls_offset_for_local, tls_offset_for_global,
	do_tls_offset_for_local, do_tls_offset_for_global): New functions.
	* arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
	call.
	* i386.cc (Target_i386::Scan::local): Likewise.
	* sparc.cc (Target_sparc::Scan::local): Likewise.
	* x86_64.cc (Target_x86_64::Scan::local): Likewise.
	* powerpc.cc (Target_powerpc::do_tls_offset_for_local,
	do_tls_offset_for_global): New functions.
	(Target_powerpc::Scan::local): Correct TLS relocations and got
	entry values.
	(Target_powerpc::Scan::global): Don't emit unnecessary
	dynamic relocations on TLS GOT entries.
This commit is contained in:
Alan Modra
2012-09-10 23:05:54 +00:00
parent 00716ab174
commit bd73a62d77
9 changed files with 242 additions and 59 deletions

View File

@@ -270,6 +270,20 @@ class Target
plt_address_for_local(const Relobj* object, unsigned int symndx) const
{ return this->do_plt_address_for_local(object, symndx); }
// Return the offset to use for the GOT_INDX'th got entry which is
// for a local tls symbol specified by OBJECT, SYMNDX.
int64_t
tls_offset_for_local(const Relobj* object,
unsigned int symndx,
unsigned int got_indx) const
{ return do_tls_offset_for_local(object, symndx, got_indx); }
// Return the offset to use for the GOT_INDX'th got entry which is
// for global tls symbol GSYM.
int64_t
tls_offset_for_global(Symbol* gsym, unsigned int got_indx) const
{ return do_tls_offset_for_global(gsym, got_indx); }
// Return whether this target can use relocation types to determine
// if a function's address is taken.
bool
@@ -546,6 +560,14 @@ class Target
do_plt_address_for_local(const Relobj*, unsigned int) const
{ gold_unreachable(); }
virtual int64_t
do_tls_offset_for_local(const Relobj*, unsigned int, unsigned int) const
{ gold_unreachable(); }
virtual int64_t
do_tls_offset_for_global(Symbol*, unsigned int) const
{ gold_unreachable(); }
// Virtual function which may be overriden by the child class.
virtual bool
do_can_check_for_function_pointers() const