+
+#elif defined (_WIN32)
+ size_t filelen;
+
+ /* PR 25713: Handle extra long path names.
+ For relative paths, convert them to absolute, in case that version is too long. */
+ if (! IS_ABSOLUTE_PATH (filename) && (strstr (filename, ".o") != NULL))
+ {
+ char cwd[1024];
+
+ getcwd (cwd, sizeof (cwd));
+ filelen = strlen (cwd) + 1;
+ strncat (cwd, "\\", sizeof (cwd) - filelen);
+ ++ filelen;
+ strncat (cwd, filename, sizeof (cwd) - filelen);
+
+ filename = cwd;
+ }
+
+ filelen = strlen (filename) + 1;
+
+ if (filelen > MAX_PATH - 1)
+ {
+ FILE * file;
+ char * fullpath;
+ int i;
+
+ fullpath = (char *) malloc (filelen + 8);
+
+ /* Add a Microsoft recommended prefix that
+ will allow the extra-long path to work. */
+ strcpy (fullpath, "\\\\?\\");
+ strcat (fullpath, filename);
+
+ /* Convert any UNIX style path separators into the DOS form. */
+ for (i = 0; fullpath[i]; i++)
+ {
+ if (IS_UNIX_DIR_SEPARATOR (fullpath[i]))
+ fullpath[i] = '\\';
+ }
+
+ file = close_on_exec (fopen (fullpath, modes));
+ free (fullpath);
+ return file;
+ }
+
+#elif defined (HAVE_FOPEN64)