aboutsummaryrefslogtreecommitdiff
path: root/gold/target.h
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2011-07-08 22:48:08 +0000
committerIan Lance Taylor <ian@airs.com>2011-07-08 22:48:08 +0000
commit67181c72fbaad59e5793cf6bcb8d12d7d211c817 (patch)
tree00fc34342606bb1317c091a607b1f62fa6186142 /gold/target.h
parent5e44ecb338cc222e3033b72fe63e67054b942eed (diff)
downloadgdb-67181c72fbaad59e5793cf6bcb8d12d7d211c817.zip
gdb-67181c72fbaad59e5793cf6bcb8d12d7d211c817.tar.gz
gdb-67181c72fbaad59e5793cf6bcb8d12d7d211c817.tar.bz2
PR gold/12372
* target.h (Target::plt_address_for_global): New function. (Target::plt_address_for_local): New function. (Target::plt_section_for_global): Remove. (Target::plt_section_for_local): Remove. (Target::do_plt_address_for_global): New virtual function. (Target::do_plt_address_for_local): New virtual function. (Target::do_plt_section_for_global): Remove. (Target::do_plt_section_for_local): Remove. (Target::register_global_plt_entry): Add Symbol_table and Layout parameters. * output.cc (Output_data_got::Got_entry::write): Use plt_address_for_global and plt_address_for_local. * layout.cc (Layout::add_target_dynamic_tags): Use size and address of output section. * i386.cc (class Output_data_plt_i386): Add irelative_rel_, got_irelative_, and irelative_count_ fields. Update declarations. (Output_data_plt_i386::has_irelative_section): New function. (Output_data_plt_i386::entry_count): Add irelative_count_. (Output_data_plt_i386::set_final_data_size): Likewise. (class Target_i386): Add got_irelative_ and rel_irelative_ fields. Update declarations. (Target_i386::Target_i386): Initialize new fields. (Target_i386::do_plt_address_for_global): New function replacing do_plt_section_for_global. (Target_i386::do_plt_address_for_local): New function replacing do_plt_section_for_local. (Target_i386::got_section): Create got_irelative_. (Target_i386::rel_irelative_section): New function. (Output_data_plt_i386::Output_data_plt_i386): Initialize new fields. Don't define __rel_iplt_{start,end}. (Output_data_plt_i386::add_entry): Add symtab and layout parameters. Change all callers. Use different PLT and GOT for IFUNC symbols. (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and layout parameters. Change all callers. Use different PLT and GOT. (Output_data_plt_i386::rel_tls_desc): Fix formatting. (Output_data_plt_i386::rel_irelative): New function. (Output_data_plt_i386::address_for_global): New function. (Output_data_plt_i386::address_for_local): New function. (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use IRELATIVE GOT when changing IFUNC GOT entries. (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE reloc. (Target_i386::do_finalize_sections): Create the __rel_iplt symbols if we didn't create an IRELATIVE GOT. (Target_i386::Relocate::relocate): Use plt_address_for_global and plt_address_for_local. (Target_i386::do_dynsym_value): Use plt_address_for_global. * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_, got_irelative_, and irelative_count_ fields. Update declarations. (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]: Initialize new fields. Remove symtab parameter. Change all callers. (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add irelative_count_. (Output_data_plt_x86_64::has_irelative_section): New function. (Output_data_plt_x86_64::entry_count): Add irelative_count_. (class Target_x86_64): Add got_irelative_ and rel_irelative_ fields. Update declarations. (Target_x86_64::Target_x86_64): Initialize new fields. (Target_x86_64::do_plt_address_for_global): New function replacing do_plt_section_for_global. (Target_x86_64::do_plt_address_for_local): New function replacing do_plt_section_for_local. (Target_x86_64::got_section): Create got_irelative_. (Target_x86_64::rela_irelative_section): New function. (Output_data_plt_x86_64::init): Remove symtab parameter. Change all callers. Don't create __rel_iplt_{start,end}. (Output_data_plt_x86_64::add_entry): Add symtab and layout parameters. Change all callers. Use different PLT and GOT for IFUNC symbols. (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and layout parameters. Change all callers. Use different PLT and GOT. (Output_data_plt_x86_64::add_relocation): Add symtab and layout parameters. Change all callers. Use different PLT and GOT for IFUNC symbols. (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting. (Output_data_plt_x86_64::rela_irelative): New function. (Output_data_plt_x86_64::address_for_global): New function. (Output_data_plt_x86_64::address_for_local): New function. (Output_data_plt_x86_64::set_final_data_size): Likewise. (Output_data_plt_x86_64::do_write): Write out IRELATIVE area. (Target_x86_64::init_got_plt_for_update): Create got_irelative_. (Target_x86_64::register_global_plt_entry): Add symtab and layout parameters. (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE reloc. (Target_x86_64::do_finalize_sections): Create the __rela_iplt symbols if we didn't create an IRELATIVE GOT. (Target_x86_64::Relocate::relocate): Use plt_address_for_global and plt_address_for_local. (Target_x86_64::do_dynsym_value): Use plt_address_for_global. * testsuite/ifuncvar1.c: New test file. * testsuite/ifuncvar2.c: New test file. * testsuite/ifuncvar3.c: New test file. * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar. (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets. (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables. (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables. * testsuite/Makefile.in: Rebuild.
Diffstat (limited to 'gold/target.h')
-rw-r--r--gold/target.h35
1 files changed, 19 insertions, 16 deletions
diff --git a/gold/target.h b/gold/target.h
index c2ccc63..a378120 100644
--- a/gold/target.h
+++ b/gold/target.h
@@ -246,17 +246,19 @@ class Target
reloc_addend(void* arg, unsigned int type, uint64_t addend) const
{ return this->do_reloc_addend(arg, type, addend); }
- // Return the PLT section to use for a global symbol. This is used
- // for STT_GNU_IFUNC symbols.
- Output_data*
- plt_section_for_global(const Symbol* sym) const
- { return this->do_plt_section_for_global(sym); }
-
- // Return the PLT section to use for a local symbol. This is used
- // for STT_GNU_IFUNC symbols.
- Output_data*
- plt_section_for_local(const Relobj* object, unsigned int symndx) const
- { return this->do_plt_section_for_local(object, symndx); }
+ // Return the PLT address to use for a global symbol. This is used
+ // for STT_GNU_IFUNC symbols. The symbol's plt_offset is relative
+ // to this PLT address.
+ uint64_t
+ plt_address_for_global(const Symbol* sym) const
+ { return this->do_plt_address_for_global(sym); }
+
+ // Return the PLT address to use for a local symbol. This is used
+ // for STT_GNU_IFUNC symbols. The symbol's plt_offset is relative
+ // to this PLT address.
+ uint64_t
+ plt_address_for_local(const Relobj* object, unsigned int symndx) const
+ { return this->do_plt_address_for_local(object, symndx); }
// Return whether this target can use relocation types to determine
// if a function's address is taken.
@@ -502,12 +504,12 @@ class Target
// Virtual functions that must be overridden by a target that uses
// STT_GNU_IFUNC symbols.
- virtual Output_data*
- do_plt_section_for_global(const Symbol*) const
+ virtual uint64_t
+ do_plt_address_for_global(const Symbol*) const
{ gold_unreachable(); }
- virtual Output_data*
- do_plt_section_for_local(const Relobj*, unsigned int) const
+ virtual uint64_t
+ do_plt_address_for_local(const Relobj*, unsigned int) const
{ gold_unreachable(); }
// Virtual function which may be overriden by the child class.
@@ -870,7 +872,8 @@ class Sized_target : public Target
// A target needs to implement this to support incremental linking.
virtual void
- register_global_plt_entry(unsigned int /* plt_index */,
+ register_global_plt_entry(Symbol_table*, Layout*,
+ unsigned int /* plt_index */,
Symbol*)
{ gold_unreachable(); }