+2020-10-13 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR gold/21452
+ * x86_64.cc (Scan::local_reloc_may_be_function_pointer): Remove
+ check for shared library.
+ (Scan::global_reloc_may_be_function_pointer): Remove check for
+ shared library and symbol visibility.
+ * testsuite/icf_safe_so_test.cc (bar_static): New function.
+ (main): Take function address of bar_static and use it.
+ * testsuite/icf_safe_so_test.sh (arch_specific_safe_fold): Also
+ check fold on x86-64. Check bar_static isn't folded.
+
2020-10-13 H.J. Lu <hongjiu.lu@intel.com>
* icf.cc (Icf::find_identical_sections): Skip zero-sized sections.
unsigned int r_type,
const elfcpp::Sym<size, false>&)
{
- // When building a shared library, do not fold any local symbols as it is
- // not possible to distinguish pointer taken versus a call by looking at
- // the relocation types.
- if (parameters->options().shared())
- return true;
-
return possible_function_pointer_reloc(src_obj, src_indx,
reloc.get_r_offset(), r_type);
}
Output_section* ,
const elfcpp::Rela<size, false>& reloc,
unsigned int r_type,
- Symbol* gsym)
-{
- // When building a shared library, do not fold symbols whose visibility
- // is hidden, internal or protected.
- if (parameters->options().shared()
- && (gsym->visibility() == elfcpp::STV_INTERNAL
- || gsym->visibility() == elfcpp::STV_PROTECTED
- || gsym->visibility() == elfcpp::STV_HIDDEN))
- return true;
-
+ Symbol*)
+{
return possible_function_pointer_reloc(src_obj, src_indx,
reloc.get_r_offset(), r_type);
}