I've applied this obvious patch to trunk to make mkoffloads work for C++. The equivalent is already on the gomp4 branch.

nathan
2015-07-15  Nathan Sidwell  <nat...@codesourcery.com>

	* config/nvptx/mkoffload.c (process): Add C++ protection to
	emitted code.

Index: config/nvptx/mkoffload.c
===================================================================
--- config/nvptx/mkoffload.c	(revision 225843)
+++ config/nvptx/mkoffload.c	(working copy)
@@ -867,7 +867,13 @@ process (FILE *in, FILE *out)
 		"func_mappings\n", nvars, nfuncs);
   fprintf (out, "};\n\n");
 
-  fprintf (out, "extern void GOMP_offload_register (const void *, int, void *);\n");
+  fprintf (out, "#ifdef __cplusplus\n"
+	   "extern \"C\" {\n"
+	   "#endif\n");
+  fprintf (out, "extern void GOMP_offload_register (void *, int, void *);\n");
+  fprintf (out, "#ifdef __cplusplus\n"
+	   "}\n"
+	   "#endif\n");
 
   fprintf (out, "extern void *__OFFLOAD_TABLE__[];\n\n");
   fprintf (out, "static __attribute__((constructor)) void init (void)\n{\n");

Reply via email to