LTO: Force externally_visible for offload_vars/funcs (PR97179) gcc/ChangeLog: PR lto/97179 * lto-cgraph.c (input_offload_tables): diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c index 93a99f3465b..1fb608705eb 100644 --- a/gcc/lto-cgraph.c +++ b/gcc/lto-cgraph.c @@ -1793,7 +1793,11 @@ input_offload_tables (bool do_force_output) may be no refs from the parent function to child_fn in offload LTO mode. */ if (do_force_output) - cgraph_node::get (fn_decl)->mark_force_output (); + { + cgraph_node *node = cgraph_node::get (fn_decl); + node->force_output = 1; + node->externally_visible = 1; + } } else if (tag == LTO_symtab_variable) { @@ -1804,7 +1808,11 @@ input_offload_tables (bool do_force_output) /* Prevent IPA from removing var_decl as unused, since there may be no refs to var_decl in offload LTO mode. */ if (do_force_output) - varpool_node::get (var_decl)->force_output = 1; + { + varpool_node *node = varpool_node::get (var_decl); + node->force_output = 1; + node->externally_visible = 1; + } } else fatal_error (input_location,