From ce97fa81e0c46d216b80b143ad8c02fff6906fef Mon Sep 17 00:00:00 2001 From: Sriraman Tallam Date: Tue, 20 Apr 2010 21:13:30 +0000 Subject: 2010-04-18 Sriraman Tallam * 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. --- gold/symtab.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'gold/symtab.cc') 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::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()) { -- cgit v1.1