aboutsummaryrefslogtreecommitdiff
path: root/gold/symtab.cc
diff options
context:
space:
mode:
authorSriraman Tallam <tmsriram@google.com>2010-04-20 21:13:30 +0000
committerSriraman Tallam <tmsriram@google.com>2010-04-20 21:13:30 +0000
commitce97fa81e0c46d216b80b143ad8c02fff6906fef (patch)
tree539a9d93c76d2113b92da17405b144eba8fa92c5 /gold/symtab.cc
parentec31cde5942e935e74f6ff919ffc480dfa2f1bac (diff)
downloadgdb-ce97fa81e0c46d216b80b143ad8c02fff6906fef.zip
gdb-ce97fa81e0c46d216b80b143ad8c02fff6906fef.tar.gz
gdb-ce97fa81e0c46d216b80b143ad8c02fff6906fef.tar.bz2
2010-04-18 Sriraman Tallam <tmsriram@google.com>
* icf.cc (get_section_contents): Check for preemptible functions. Ignore addend when appropriate. * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for section folded. (add_from_relobj): Check for section folded. (set_dynsym_indexes): Fix call to should_add_dynsym_entry. * symtab.h (should_add_dynsym_entry): Add new parameter. * target-reloc.h (scan_relocs): Check for section folded. * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc): Check reloc types for function pointers in shared objects. * testsuite/Makefile.am (icf_virtual_function_folding_test): New test case. (icf_preemptible_functions_test): New test case. (icf_string_merge_test): New test case. * testsuite.Makefile.in: Regenerate. * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and bar_glob. Refactor code. * testsuite/icf_preemptible_functions_test.cc: New file. * testsuite/icf_preemptible_functions_test.sh: New file. * testsuite/icf_string_merge_test.cc: New file. * testsuite/icf_string_merge_test.sh: New file. * testsuite/icf_virtual_function_folding_test.cc: New file. * testsuite/icf_virtual_function_folding_test.sh: New file.
Diffstat (limited to 'gold/symtab.cc')
-rw-r--r--gold/symtab.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/gold/symtab.cc b/gold/symtab.cc
index c2a811f..3f85f6c 100644
--- a/gold/symtab.cc
+++ b/gold/symtab.cc
@@ -306,7 +306,7 @@ Sized_symbol<size>::allocate_common(Output_data* od, Value_type value)
// table.
inline bool
-Symbol::should_add_dynsym_entry() const
+Symbol::should_add_dynsym_entry(Symbol_table* symtab) const
{
// If the symbol is used by a dynamic relocation, we need to add it.
if (this->needs_dynsym_entry())
@@ -324,7 +324,8 @@ Symbol::should_add_dynsym_entry() const
bool is_ordinary;
unsigned int shndx = this->shndx(&is_ordinary);
if (is_ordinary && shndx != elfcpp::SHN_UNDEF
- && !relobj->is_section_included(shndx))
+ && !relobj->is_section_included(shndx)
+ && !symtab->is_section_folded(relobj, shndx))
return false;
}
@@ -1072,7 +1073,8 @@ Symbol_table::add_from_relobj(
bool is_defined_in_discarded_section = false;
if (st_shndx != elfcpp::SHN_UNDEF
&& is_ordinary
- && !relobj->is_section_included(st_shndx))
+ && !relobj->is_section_included(st_shndx)
+ && !this->is_section_folded(relobj, st_shndx))
{
st_shndx = elfcpp::SHN_UNDEF;
is_defined_in_discarded_section = true;
@@ -2253,7 +2255,7 @@ Symbol_table::set_dynsym_indexes(unsigned int index,
// some symbols appear more than once in the symbol table, with
// and without a version.
- if (!sym->should_add_dynsym_entry())
+ if (!sym->should_add_dynsym_entry(this))
sym->set_dynsym_index(-1U);
else if (!sym->has_dynsym_index())
{