aboutsummaryrefslogtreecommitdiff
path: root/gold/output.cc
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2011-10-10 17:29:52 +0000
committerCary Coutant <ccoutant@google.com>2011-10-10 17:29:52 +0000
commit397b129b2a1e3d186e62ff37ecdbc329bf6bbc53 (patch)
tree201abe09b47a3367ca0ac89bcc64350e98d7e7b0 /gold/output.cc
parent79395f921c81a0a14e92512674fc57971d3a4e2b (diff)
downloadgdb-397b129b2a1e3d186e62ff37ecdbc329bf6bbc53.zip
gdb-397b129b2a1e3d186e62ff37ecdbc329bf6bbc53.tar.gz
gdb-397b129b2a1e3d186e62ff37ecdbc329bf6bbc53.tar.bz2
PR gold/13249
* gold/output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag. (Output_reloc::symbol_value): Return PLT offset if flag is set. * gold/output.h (class Output_reloc): Add use_plt_offset flag. (Output_reloc::type_): Adjust size of bit field. (Output_reloc::use_plt_offset_): New bit field. (class Output_data_reloc): Adjust all calls to Output_reloc_type. (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset flag. Adjust all callers. * gold/x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when creating RELATIVE relocations.
Diffstat (limited to 'gold/output.cc')
-rw-r--r--gold/output.cc34
1 files changed, 22 insertions, 12 deletions
diff --git a/gold/output.cc b/gold/output.cc
index 63f0109..d6bdaba 100644
--- a/gold/output.cc
+++ b/gold/output.cc
@@ -706,7 +706,7 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::Output_reloc(
bool is_symbolless)
: address_(address), local_sym_index_(GSYM_CODE), type_(type),
is_relative_(is_relative), is_symbolless_(is_symbolless),
- is_section_symbol_(false), shndx_(INVALID_CODE)
+ is_section_symbol_(false), use_plt_offset_(false), shndx_(INVALID_CODE)
{
// this->type_ is a bitfield; make sure TYPE fits.
gold_assert(this->type_ == type);
@@ -727,7 +727,7 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::Output_reloc(
bool is_symbolless)
: address_(address), local_sym_index_(GSYM_CODE), type_(type),
is_relative_(is_relative), is_symbolless_(is_symbolless),
- is_section_symbol_(false), shndx_(shndx)
+ is_section_symbol_(false), use_plt_offset_(false), shndx_(shndx)
{
gold_assert(shndx != INVALID_CODE);
// this->type_ is a bitfield; make sure TYPE fits.
@@ -749,10 +749,12 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::Output_reloc(
Address address,
bool is_relative,
bool is_symbolless,
- bool is_section_symbol)
+ bool is_section_symbol,
+ bool use_plt_offset)
: address_(address), local_sym_index_(local_sym_index), type_(type),
is_relative_(is_relative), is_symbolless_(is_symbolless),
- is_section_symbol_(is_section_symbol), shndx_(INVALID_CODE)
+ is_section_symbol_(is_section_symbol), use_plt_offset_(use_plt_offset),
+ shndx_(INVALID_CODE)
{
gold_assert(local_sym_index != GSYM_CODE
&& local_sym_index != INVALID_CODE);
@@ -773,10 +775,12 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::Output_reloc(
Address address,
bool is_relative,
bool is_symbolless,
- bool is_section_symbol)
+ bool is_section_symbol,
+ bool use_plt_offset)
: address_(address), local_sym_index_(local_sym_index), type_(type),
is_relative_(is_relative), is_symbolless_(is_symbolless),
- is_section_symbol_(is_section_symbol), shndx_(shndx)
+ is_section_symbol_(is_section_symbol), use_plt_offset_(use_plt_offset),
+ shndx_(shndx)
{
gold_assert(local_sym_index != GSYM_CODE
&& local_sym_index != INVALID_CODE);
@@ -799,7 +803,7 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::Output_reloc(
Address address)
: address_(address), local_sym_index_(SECTION_CODE), type_(type),
is_relative_(false), is_symbolless_(false),
- is_section_symbol_(true), shndx_(INVALID_CODE)
+ is_section_symbol_(true), use_plt_offset_(false), shndx_(INVALID_CODE)
{
// this->type_ is a bitfield; make sure TYPE fits.
gold_assert(this->type_ == type);
@@ -820,7 +824,7 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::Output_reloc(
Address address)
: address_(address), local_sym_index_(SECTION_CODE), type_(type),
is_relative_(false), is_symbolless_(false),
- is_section_symbol_(true), shndx_(shndx)
+ is_section_symbol_(true), use_plt_offset_(false), shndx_(shndx)
{
gold_assert(shndx != INVALID_CODE);
// this->type_ is a bitfield; make sure TYPE fits.
@@ -842,7 +846,7 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::Output_reloc(
Address address)
: address_(address), local_sym_index_(0), type_(type),
is_relative_(false), is_symbolless_(false),
- is_section_symbol_(false), shndx_(INVALID_CODE)
+ is_section_symbol_(false), use_plt_offset_(false), shndx_(INVALID_CODE)
{
// this->type_ is a bitfield; make sure TYPE fits.
gold_assert(this->type_ == type);
@@ -858,7 +862,7 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::Output_reloc(
Address address)
: address_(address), local_sym_index_(0), type_(type),
is_relative_(false), is_symbolless_(false),
- is_section_symbol_(false), shndx_(shndx)
+ is_section_symbol_(false), use_plt_offset_(false), shndx_(shndx)
{
gold_assert(shndx != INVALID_CODE);
// this->type_ is a bitfield; make sure TYPE fits.
@@ -877,7 +881,7 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::Output_reloc(
Address address)
: address_(address), local_sym_index_(TARGET_CODE), type_(type),
is_relative_(false), is_symbolless_(false),
- is_section_symbol_(false), shndx_(INVALID_CODE)
+ is_section_symbol_(false), use_plt_offset_(false), shndx_(INVALID_CODE)
{
// this->type_ is a bitfield; make sure TYPE fits.
gold_assert(this->type_ == type);
@@ -894,7 +898,7 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::Output_reloc(
Address address)
: address_(address), local_sym_index_(TARGET_CODE), type_(type),
is_relative_(false), is_symbolless_(false),
- is_section_symbol_(false), shndx_(shndx)
+ is_section_symbol_(false), use_plt_offset_(false), shndx_(shndx)
{
gold_assert(shndx != INVALID_CODE);
// this->type_ is a bitfield; make sure TYPE fits.
@@ -1121,6 +1125,12 @@ Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::symbol_value(
Sized_relobj_file<size, big_endian>* relobj =
this->u1_.relobj->sized_relobj();
gold_assert(relobj != NULL);
+ if (this->use_plt_offset_)
+ {
+ uint64_t plt_address =
+ parameters->target().plt_address_for_local(relobj, lsi);
+ return plt_address + relobj->local_plt_offset(lsi);
+ }
const Symbol_value<size>* symval = relobj->local_symbol(lsi);
return symval->value(relobj, addend);
}