summaryrefslogtreecommitdiff
path: root/gold/symtab.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2010-01-09 00:13:48 +0000
committerIan Lance Taylor <ian@airs.com>2010-01-09 00:13:48 +0000
commit880cd20d40938ea13ff9d5dbb9393f80cfb98b75 (patch)
tree380dae82534c746a53caf0d5d08d89ff6242a524 /gold/symtab.cc
parentab422233046f4f06532d5a1d6ca0574d711164c5 (diff)
downloadbinutils-gdb-880cd20d40938ea13ff9d5dbb9393f80cfb98b75.tar.gz
PR 11108
* symtab.h (class Symbol): Remove fields is_target_special_ and has_plt_offset_. Add field is_defined_in_discarded_section_. (Symbol::is_defined_in_discarded_section): New function. (Symbol::set_is_defined_in_discarded_section): New function. (Symbol::has_plt_offset): Rewrite. (Symbol::set_plt_offset): Verify that new offset is not -1U. * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U. Don't initialize is_target_special_ or has_plt_offset_. Initialize is_defined_in_discarded_section_. (Symbol_table::add_from_relobj): If appropriate, set is_defined_in_discarded_section. * resolve.cc (Symbol::override_base_with_special): Don't test is_target_special_. Change has_plt_offset_ to has_plt_offset(). * target-reloc.h (relocate_section): Do special handling for symbols defined in discarded sections for global symbols as well as local symbols.
Diffstat (limited to 'gold/symtab.cc')
-rw-r--r--gold/symtab.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/gold/symtab.cc b/gold/symtab.cc
index 984843863e8..92a91bc1012 100644
--- a/gold/symtab.cc
+++ b/gold/symtab.cc
@@ -59,24 +59,23 @@ Symbol::init_fields(const char* name, const char* version,
this->symtab_index_ = 0;
this->dynsym_index_ = 0;
this->got_offsets_.init();
- this->plt_offset_ = 0;
+ this->plt_offset_ = -1U;
this->type_ = type;
this->binding_ = binding;
this->visibility_ = visibility;
this->nonvis_ = nonvis;
- this->is_target_special_ = false;
this->is_def_ = false;
this->is_forwarder_ = false;
this->has_alias_ = false;
this->needs_dynsym_entry_ = false;
this->in_reg_ = false;
this->in_dyn_ = false;
- this->has_plt_offset_ = false;
this->has_warning_ = false;
this->is_copied_from_dynobj_ = false;
this->is_forced_local_ = false;
this->is_ordinary_shndx_ = false;
this->in_real_elf_ = false;
+ this->is_defined_in_discarded_section_ = false;
}
// Return the demangled version of the symbol's name, but only
@@ -1070,10 +1069,14 @@ Symbol_table::add_from_relobj(
// A symbol defined in a section which we are not including must
// be treated as an undefined symbol.
+ bool is_defined_in_discarded_section = false;
if (st_shndx != elfcpp::SHN_UNDEF
&& is_ordinary
&& !relobj->is_section_included(st_shndx))
- st_shndx = elfcpp::SHN_UNDEF;
+ {
+ st_shndx = elfcpp::SHN_UNDEF;
+ is_defined_in_discarded_section = true;
+ }
// In an object file, an '@' in the name separates the symbol
// name from the version name. If there are two '@' characters,
@@ -1190,6 +1193,9 @@ Symbol_table::add_from_relobj(
if (is_forced_local)
this->force_local(res);
+ if (is_defined_in_discarded_section)
+ res->set_is_defined_in_discarded_section();
+
(*sympointers)[i] = res;
}
}