On Thu, Sep 24, 2020 at 11:41:00AM +0200, Tobias Burnus wrote: > Following Jakub's suggestion, I also added > __attribute__((used)) > to the tree belonging to both tables in omp-offload.c's omp_finish > but that did not help, either.
That is really DECL_PRESERVED_P, the attribute is turned into that, so no need to have attribute around after setting it. That is needed (but already done), but clearly not sufficient. What we need to emulate is the effect of all those decls being referenced from a single (preserved) initializer, which would need to refer to their names too. Except we don't really have such a var and initializer constructed early enough probably. Now, for vars with initializers I think there is record_references_in_initializer to remember those references, so do we need to emulate that behavior? Or, see what effects it has on the partitioning, and if it means forcing all the referenced decls that aren't TREE_PUBLIC into the same partition, do it for the offloading funcs and vars too? Jakub