https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98145

--- Comment #2 from Brecht Sanders <brechtsanders at users dot sourceforge.net> 
---
Did a bit more digging...
Seems COMPILER_PATH uses ';' as separator on Windows, not ':'.
So besides the .exe issue parse_env_var() also needs to separate the list by a
different separator.

Something like this:

# fix gcc/lto-wrapper.c (version >= 10.2.0)
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)
@@ -827,6 +833,6 @@
   char *suffix
-    = XALLOCAVEC (char, sizeof ("/accel//mkoffload") + strlen (target));
+    = XALLOCAVEC (char, sizeof ("/accel//mkoffload.exe") + strlen (target));
   strcpy (suffix, "/accel/");
   strcat (suffix, target);
-  strcat (suffix, "/mkoffload");
+  strcat (suffix, "/mkoffload.exe");

EOF

But still not there yet. Now my test results in:
mkoffload: fatal error: offload compiler
x86_64-w64-mingw32-accel-nvptx-none-gcc not found (consider using '-B')
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 1 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

So probably mkoffload needs similar fixes...
  • [Bug c/98145] New:... brechtsanders at users dot sourceforge.net via Gcc-bugs
    • [Bug c/98145]... brechtsanders at users dot sourceforge.net via Gcc-bugs
    • [Bug lto/9814... brechtsanders at users dot sourceforge.net via Gcc-bugs
    • [Bug lto/9814... brechtsanders at users dot sourceforge.net via Gcc-bugs

Reply via email to