Hi. The patch prevents a ifunc alias from removal in remove unreachable nodes. Note that ifunc alias lives in a COMDAT section and so that cgraph_node::can_remove_if_no_direct_calls_and_refs_p returned true for it.
Patch can bootstrap on x86_64-linux-gnu and survives regression tests. I was unable to create a lto test-case where a linked binary could be scanned for assembly. Ready to be installed? Thanks, Martin gcc/ChangeLog: 2020-04-20 Martin Liska <mli...@suse.cz> PR lto/94659 * cgraph.h (cgraph_node::can_remove_if_no_direct_calls_and_refs_p): Do not remove ifunc_resolvers in remove unreachable nodes in LTO. --- gcc/cgraph.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/cgraph.h b/gcc/cgraph.h index 43de3b4a8ac..5ddeb65269b 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -3162,7 +3162,7 @@ cgraph_node::can_remove_if_no_direct_calls_and_refs_p (void) return false; /* Only COMDAT functions can be removed if externally visible. */ if (externally_visible - && (!DECL_COMDAT (decl) + && ((!DECL_COMDAT (decl) || ifunc_resolver) || forced_by_abi || used_from_object_file_p ())) return false;