aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2022-09-09 17:43:12 +0200
committerTobias Burnus <tobias@codesourcery.com>2022-09-09 17:43:12 +0200
commitdfd75bf7e9017e92b59be650fca97d2b4b331a82 (patch)
tree3a49bcda089c75c1ef6c5a2cdf1d49cd18b4ed0a /gcc
parent0fcc0cf9dca9f11acbbc94c9437759bdfbd297f2 (diff)
downloadgcc-dfd75bf7e9017e92b59be650fca97d2b4b331a82.zip
gcc-dfd75bf7e9017e92b59be650fca97d2b4b331a82.tar.gz
gcc-dfd75bf7e9017e92b59be650fca97d2b4b331a82.tar.bz2
GCN: libgomp+mkoffload.cc: Prepare for reverse offload fn lookup
Add support to GCN for reverse lookup of function name to prepare for 'omp target device(ancestor:1)'. gcc/ChangeLog: * config/gcn/mkoffload.cc (process_asm): Create .offload_func_table, similar to pre-existing .offload_var_table. libgomp/ChangeLog: * plugin/plugin-gcn.c (GOMP_OFFLOAD_load_image): Read .offload_func_table to populate rev_fn_table when requested.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config/gcn/mkoffload.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/config/gcn/mkoffload.cc b/gcc/config/gcn/mkoffload.cc
index 4206448..24d3273 100644
--- a/gcc/config/gcn/mkoffload.cc
+++ b/gcc/config/gcn/mkoffload.cc
@@ -553,6 +553,7 @@ process_asm (FILE *in, FILE *out, FILE *cfile)
char *funcname;
if (sscanf (buf, "\t.8byte\t%ms\n", &funcname))
{
+ fputs (buf, out);
obstack_ptr_grow (&fns_os, funcname);
fn_count++;
continue;
@@ -577,7 +578,15 @@ process_asm (FILE *in, FILE *out, FILE *cfile)
out);
}
else if (sscanf (buf, " .section .gnu.offload_funcs%c", &dummy) > 0)
- state = IN_FUNCS;
+ {
+ state = IN_FUNCS;
+ /* Likewise for .gnu.offload_vars; used for reverse offload. */
+ fputs (buf, out);
+ fputs ("\t.global .offload_func_table\n"
+ "\t.type .offload_func_table, @object\n"
+ ".offload_func_table:\n",
+ out);
+ }
else if (sscanf (buf, " .amdgpu_metadata%c", &dummy) > 0)
{
state = IN_METADATA;