On 9/23/20 3:10 PM, Richard Biener wrote:
On Wed, 23 Sep 2020, Richard Biener wrote:
LTRANS usually makes the symbols hidden, not local.
Could also be – whatever the 'nm' output means.
So are you
sure this isn't a target bug (hidden symbols not implemented
but the host compiler obviously having checked that but assuming
the target behaves the same as the host) or a linker bug?
Unlikely, I assume the Linux x86-64 linker is rather well tested.
As written this is the host – just the offloading symbol table is
device specific.
See lto/lto-partition.c:promote_symbol btw.
Thanks for the pointer; it pointed me to node->externally_visible,
which does the trick :-)
Thus, next try – which a patch I like much better!
Tobias
-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander
Walter
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,