diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2015-07-16 17:17:31 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2015-07-16 17:17:31 +0000 |
commit | a4cb876dc96b5e400650422e16264f9d50b6751b (patch) | |
tree | 128ed56f500a026f899fa5ed513c1ce657b9cacf /gcc/config | |
parent | 38ef5e6add621c2d5052d4cd584bc6cd4d6002ee (diff) | |
download | gcc-a4cb876dc96b5e400650422e16264f9d50b6751b.zip gcc-a4cb876dc96b5e400650422e16264f9d50b6751b.tar.gz gcc-a4cb876dc96b5e400650422e16264f9d50b6751b.tar.bz2 |
plugin-nvptx.c (link_ptx): Constify string argument.
libgomp/
* plugin/plugin-nvptx.c (link_ptx): Constify string argument.
Workaround driver library const error.
(struct nvptx_tdata, nvptx_tdata_t): New.
(GOMP_OFFLOAD_load_image): Use struct for target_data's real
type.
gcc/
* config/nvptx/mkoffload.c (process): Constify mapping variables.
Define target data struct and initialize it.
From-SVN: r225897
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/nvptx/mkoffload.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/gcc/config/nvptx/mkoffload.c b/gcc/config/nvptx/mkoffload.c index 42cce3b..ca13e09 100644 --- a/gcc/config/nvptx/mkoffload.c +++ b/gcc/config/nvptx/mkoffload.c @@ -842,7 +842,6 @@ process (FILE *in, FILE *out) { const char *input = read_file (in); Token *tok = tokenize (input); - unsigned int nvars = 0, nfuncs = 0; do tok = parse_file (tok); @@ -853,19 +852,30 @@ process (FILE *in, FILE *out) write_stmts (out, rev_stmts (vars)); write_stmts (out, rev_stmts (fns)); fprintf (out, ";\n\n"); - fprintf (out, "static const char *var_mappings[] = {\n"); - for (id_map *id = var_ids; id; id = id->next, nvars++) + + fprintf (out, "static const char *const var_mappings[] = {\n"); + for (id_map *id = var_ids; id; id = id->next) fprintf (out, "\t\"%s\"%s\n", id->ptx_name, id->next ? "," : ""); fprintf (out, "};\n\n"); - fprintf (out, "static const char *func_mappings[] = {\n"); - for (id_map *id = func_ids; id; id = id->next, nfuncs++) + fprintf (out, "static const char *const func_mappings[] = {\n"); + for (id_map *id = func_ids; id; id = id->next) fprintf (out, "\t\"%s\"%s\n", id->ptx_name, id->next ? "," : ""); fprintf (out, "};\n\n"); - fprintf (out, "static const void *target_data[] = {\n"); - fprintf (out, " ptx_code, (void*) %u, var_mappings, (void*) %u, " - "func_mappings\n", nvars, nfuncs); - fprintf (out, "};\n\n"); + fprintf (out, + "static struct nvptx_tdata {\n" + " const char *ptx_src;\n" + " const char *const *var_names;\n" + " __SIZE_TYPE__ var_num;\n" + " const char *const *fn_names;\n" + " __SIZE_TYPE__ fn_num;\n" + "} target_data = {\n" + " ptx_code,\n" + " var_mappings," + " sizeof (var_mappings) / sizeof (var_mappings[0]),\n" + " func_mappings," + " sizeof (func_mappings) / sizeof (func_mappings[0])\n" + "};\n\n"); fprintf (out, "#ifdef __cplusplus\n" "extern \"C\" {\n" |