[PATCH] Fix mingw32 bootstrap regression.

Carlos O'Donell carlos@codesourcery.com
Wed Dec 20 16:39:00 GMT 2006

The following patch fixes the boostrap regression for mingw32.

We only do the substitution if the path prefix matches the configured
prefix, otherwise we add the path as before (instead of asserting).

To bootstrap a mingw32 toolchain you use either msys or cygwin. Both of
these environments build gcc with cygwin style paths. Therefore --prefix
is "/c/mingw" while the compiler, a native mingw32 executable, thinks
the prefix is "c:/mingw".  A simple string comparison does not work.

Danny, Christopher, Do you see anything else that might be a problem on

This patch was used by Bob Rossi <bob_rossi@cox.net> to bootstrap
i386-pc-mingw32. I bootstrapped an x86_64-unknown-linux-gnu toolchain.

OK for mainline?

Carlos O'Donell
(650) 331-3385 x716

2006-12-19  Carlos O'Donell  <carlos@codesourcery.com>

	PR bootstrap/30242
	* gcc/c-incpath.c (add_standard_paths): Only relocate paths that 
	begin with the configured prefix. 

Index: gcc/c-incpath.c
--- gcc/c-incpath.c	(revision 120053)
+++ gcc/c-incpath.c	(working copy)
@@ -164,13 +164,12 @@ add_standard_paths (const char *sysroot,
 	  /* Should this directory start with the sysroot?  */
 	  if (sysroot && p->add_sysroot)
 	    str = concat (sysroot, p->fname, NULL);
-	  else if (!p->add_sysroot && relocated)
+	  else if (!p->add_sysroot && relocated
+		   && strncmp (p->fname, cpp_PREFIX, cpp_PREFIX_len) == 0)
 	      /* If the compiler is relocated, and this is a configured 
 		 prefix relative path, then we use gcc_exec_prefix instead 
 		 of the configured prefix.  */
-	      gcc_assert (strncmp (p->fname, cpp_PREFIX,
-				     cpp_PREFIX_len) == 0);
 	      str = concat (gcc_exec_prefix, p->fname
 			      + cpp_PREFIX_len, NULL);
 	      str = update_path (str, p->component);

More information about the Gcc-patches mailing list