* icf.h (is_section_foldable_candidate): Change type of parameter
to std::string.
* icf.cc (Icf::find_identical_sections): Change type of local variable
section_name to be std::string.
(is_function_ctor_or_dtor): Change type of parameter to std::string.
paramter to the call to gold::gc_process_relocs.
* i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
paramter to the call to gold::gc_process_relocs.
* x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
parameter to the call to gold::gc_process_relocs.
* powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
template parameter to the call to gold::gc_process_relocs.
* sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
paramter to the call to gold::gc_process_relocs.
* gc.h (get_embedded_addend_size): New function.
(gc_process_relocs): Save the size of the reloc for use by ICF.
* icf.cc (get_section_contents): Get the addend from the text section
for SHT_REL relocation sections.
* icf.h (Icf::Reloc_addend_size_info): New typedef.
(Icf::Reloc_info): Add new member reloc_addend_size_info.
* int_encoding.h (read_from_pointer): New overloaded function.
* testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
* testsuite/icf_sht_rel_addend_test.sh: New file.
* testsuite/icf_sht_rel_addend_test_1.cc: New file.
* testsuite/icf_sht_rel_addend_test_2.cc: New file.
* arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
(Target_arm::section_may_have_icf_unsafe_pointers): New method
definition.
(Target_arm::Scan::local_reloc_may_be_function_pointer,
Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
target hook to detect function points.
(Target_arm::Scan::possible_function_pointer_reloc): New method.
* icf.h (Icf::check_section_for_function_pointers): Change type of
parameter SECTION_NAME to const reference to std::string. Use
target hook to determine if section may have unsafe pointers.
* target.h (Target::section_may_have_icf_unsafe_pointers): New
method definition.
* gc.h (gc_process_relocs): Change vectors to point to the new list.
Add reloc offset information.
* icf.cc (get_section_contents): Change iterators to point to the new
vectors. Add reloc offset information to the contents.
* icf.h (Icf::Sections_reachable_info): New typedef.
(Icf::Sections_reachable_list): New typedef.
(Icf::Offset_info): New typedef.
(Icf::Reloc_info): New struct typedef.
(Icf::Reloc_info_list): New typedef.
(Icf::symbol_reloc_list): Delete method.
(Icf::addend_reloc_list): Delete method.
(Icf::section_reloc_list): Delete method.
(Icf::reloc_info_list): New method.
(Icf::reloc_info_list_): New member.
* arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
(Scan::global_reloc_may_be_function_pointer): New function.
* sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
(Scan::global_reloc_may_be_function_pointer): New function.
* powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
(Scan::global_reloc_may_be_function_pointer): New function.
* i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
(Scan::global_reloc_may_be_function_pointer): New function.
* x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
(Scan::global_reloc_may_be_function_pointer): New function.
(Scan::possible_function_pointer_reloc): New function.
(Target_x86_64::can_check_for_function_pointers): New function.
* gc.h (gc_process_relocs): Scan relocation types to determine if
function pointers were taken for targets that support it.
* icf.cc (Icf::find_identical_sections): Include functions for
folding in safe ICF whose pointer is not taken.
* icf.h (Secn_fptr_taken_set): New typedef.
(fptr_section_id_): New member.
(section_has_function_pointers): New function.
(set_section_has_function_pointers): New function.
(check_section_for_function_pointers): New function.
* options.h: Fix comment for safe ICF option.
* target.h (can_check_for_function_pointers): New function.
* testsuite/Makefile.am: Add icf_safe_so_test test case.
Modify icf_safe_test for X86-64.
* testsuite/Makefile.in: Regenerate.
* testsuite/icf_safe_so_test.cc: New file.
* testsuite/icf_safe_so_test.sh: New file.
* testsuite/icf_safe_test.cc (kept_func_3): New function.
(main): Change to take pointer to function kept_func_3.
* testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
folding is done correctly for X86-64.
* arm.cc (Target_arm::Arm_input_section_map): Change key type from
Input_section_specifier to Section_id.
(Target_arm::new_arm_input_section: Adjust code for change of key
type.
(Target_arm::find_arm_input_section): Ditto.
* gc.h (object.h): Include for Section_id nand Section_id_hash.
(Section_id): Remove.
(Garbage_collection::Section_id_hash): Remove.
* icf.h (object.h): Include for Section_id nand Section_id_hash.
(Section_id): Remove.
(Icf::Section_id_hash): Remove.
* object.h (Section_id, Const_section_id, Section_id_hash,
Const_section_id_hash): New type definitions.
* output.cc (Output_section::add_relaxed_input_section): Change to
use Const_section_id instead of Input_section_specifier as key type.
(Output_section::add_merge_input_section): Ditto.
(Output_section::build_relaxation_map): Change to use Section_id
instead of Input_section_specifier as key type.
(Output_section::convert_input_sections_in_list_to_relaxed_sections):
Ditto.
(Output_section::convert_input_sections_to_relaxed_sections): Change
to use Const_section_id instead of Input_section_specifier as key type.
(Output_section::find_merge_section): Ditto.
(Output_section::find_relaxed_input_section): Ditto.
* output.h (Input_section_specifier): Remove class.
(Output_section::Output_section_data_by_input_section_map): Change
key type to Const_section_id.
(Output_section::Output_relaxed_input_section_by_input_section_map):
Ditto.
(Output_section::Relaxation_map): Change key type to Section_id.
check for .text or .gnu.linkonce.t sections.
* icf.cc (Icf::find_identical_sections): Ditto.
Change the detection for mangled function name within the section
name.
* icf.h (is_section_foldable_candidate): New function.
* icf.cc (Icf::find_identical_sections): Unfold symbols that have
been maked as --keep-unique.
(Icf::unfold_section): New function.
* icf.h (Icf::unfold_section): New function.
* options.h (General_options::keep_unique): New option.
* testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
* testsuite/Makefile.in: Regenerate.
* testsuite/icf_keep_unique_test.sh: New file.
* testsuite/icf_keep_unique_test.cc: New file.