https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98145
--- Comment #3 from Brecht Sanders <brechtsanders at users dot sourceforge.net> --- Fixing gcc/config/nvptx/mkoffload.c got me one step further, but now the parameters seem to be the issue: lto1.exe: error: unrecognized command-line option '-mgomp' lto1.exe: error: '-foffload-abi' option can be specified only for offload compiler mkoffload: fatal error: D:\Prog\winlibs64-10.2.0-8.0.0\mingw64\bin/x86_64-w64-mingw32-accel-nvptx-none-gcc.exe returned 1 exit status compilation terminated. lto-wrapper.exe: fatal error: d:/prog/winlibs64-10.2.0-8.0.0/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/10.2.0//accel/nvptx-none/mkoffload.exe returned 5 exit status compilation terminated. d:/prog/winlibs64-10.2.0-8.0.0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: error: lto-wrapper failed collect2.exe: error: ld returned 1 exit status The command line being run was: g++ -Wall -O2 -g -fno-exceptions -fopenmp testomp.cpp kernelomp.o HybridOMP.o -o testomp from the Makefile in https://github.com/matthiasdiener/omptest/ The patches to get up to this point (which don't break other platforms) are: patch -ulbf gcc/lto-wrapper.c << EOF @@ -548,4 +548,10 @@ /* Parse STR, saving found tokens into PVALUES and return their number. - Tokens are assumed to be delimited by ':'. If APPEND is non-null, - append it to every token we find. */ + Tokens are assumed to be delimited by ':' (or ';' on Windows). + If APPEND is non-null, append it to every token we find. */ + +#ifdef _WIN32 +#define PATH_LIST_SEPARATOR ';' +#else +#define PATH_LIST_SEPARATOR ':' +#endif @@ -558,3 +564,3 @@ - curval = strchr (str, ':'); + curval = strchr (str, PATH_LIST_SEPARATOR); while (curval) @@ -562,3 +568,3 @@ num++; - curval = strchr (curval + 1, ':'); + curval = strchr (curval + 1, PATH_LIST_SEPARATOR); } @@ -567,3 +573,3 @@ curval = str; - nextval = strchr (curval, ':'); + nextval = strchr (curval, PATH_LIST_SEPARATOR); if (nextval == NULL) @@ -581,3 +587,3 @@ curval = nextval + 1; - nextval = strchr (curval, ':'); + nextval = strchr (curval, PATH_LIST_SEPARATOR); if (nextval == NULL) @@ -816,2 +822,8 @@ +#ifdef _WIN32 +#define BIN_EXT ".exe" +#else +#define BIN_EXT "" +#endif + static char * @@ -827,6 +839,6 @@ char *suffix - = XALLOCAVEC (char, sizeof ("/accel//mkoffload") + strlen (target)); + = XALLOCAVEC (char, sizeof ("/accel//mkoffload" BIN_EXT) + strlen (target)); strcpy (suffix, "/accel/"); strcat (suffix, target); - strcat (suffix, "/mkoffload"); + strcat (suffix, "/mkoffload" BIN_EXT); EOF patch -ulbf gcc/config/nvptx/mkoffload.c << EOF @@ -160,3 +160,10 @@ /* Parse STR, saving found tokens into PVALUES and return their number. - Tokens are assumed to be delimited by ':'. */ + Tokens are assumed to be delimited by ':' (or ';' on Windows). */ + +#ifdef _WIN32 +#define PATH_LIST_SEPARATOR ';' +#else +#define PATH_LIST_SEPARATOR ':' +#endif + static unsigned @@ -168,3 +175,3 @@ - curval = strchr (str, ':'); + curval = strchr (str, PATH_LIST_SEPARATOR); while (curval) @@ -172,3 +179,3 @@ num++; - curval = strchr (curval + 1, ':'); + curval = strchr (curval + 1, PATH_LIST_SEPARATOR); } @@ -177,3 +184,3 @@ curval = str; - nextval = strchr (curval, ':'); + nextval = strchr (curval, PATH_LIST_SEPARATOR); if (nextval == NULL) @@ -188,3 +195,3 @@ curval = nextval + 1; - nextval = strchr (curval, ':'); + nextval = strchr (curval, PATH_LIST_SEPARATOR); if (nextval == NULL) @@ -393,2 +400,8 @@ +#ifdef _WIN32 +#define BIN_EXT ".exe" +#else +#define BIN_EXT "" +#endif + int @@ -413,3 +426,3 @@ size_t len = (strlen (gcc_path) + 1 - + strlen (GCC_INSTALL_NAME) + + strlen (GCC_INSTALL_NAME BIN_EXT) + 1); @@ -425,3 +438,3 @@ driver_used = sprintf (driver, "%s/", gcc_path); - sprintf (driver + driver_used, "%s", GCC_INSTALL_NAME); + sprintf (driver + driver_used, "%s", GCC_INSTALL_NAME BIN_EXT); @@ -442,5 +455,5 @@ { - len = strlen (paths[i]) + 1 + strlen (GCC_INSTALL_NAME) + 1; + len = strlen (paths[i]) + 1 + strlen (GCC_INSTALL_NAME BIN_EXT) + 1; driver = XRESIZEVEC (char, driver, len); - sprintf (driver, "%s/%s", paths[i], GCC_INSTALL_NAME); + sprintf (driver, "%s/%s", paths[i], GCC_INSTALL_NAME BIN_EXT); if (access_check (driver, X_OK) == 0) @@ -457,3 +470,3 @@ "offload compiler %s not found (consider using %<-B%>)", - GCC_INSTALL_NAME); + GCC_INSTALL_NAME BIN_EXT); EOF