https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90779
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Andrew Stubbs from comment #4)
> The problem is that the variables are added to the offload_var_table but not
> exported so that libgomp cannot find the symbol at load time. This causes a
> fatal error in a mutex-locked section, which causes libgomp's atexit handler
> to hang trying to take the same lock.
They should be in offload_var_table and should not be exported, it is like any
static filescope variable marked for offload.
Completely wild guess, does incremental:
@@ -65,6 +65,8 @@
#include "attribs.h"
#include "asan.h"
#include "dbgcnt.h"
+#include "omp-offload.h"
+#include "context.h"
/* Hash set of poisoned variables in a bind expr. */
static hash_set<tree> *asan_poisoned_variables = NULL;
@@ -1350,7 +1352,15 @@
= tree_cons (id, NULL_TREE, DECL_ATTRIBUTES (t));
varpool_node *node = varpool_node::get (t);
if (node)
- node->offloadable = 1;
+ {
+ node->offloadable = 1;
+ if (ENABLE_OFFLOADING && !DECL_EXTERNAL (t))
+ {
+ g->have_offload = true;
+ if (!in_lto_p)
+ vec_safe_push (offload_vars, t);
+ }
+ }
}
break;
}
patch help?