[Patch] Fix crtstuff.c compilation with mingw build.

Steve Ellcey sellcey@mips.com
Thu Apr 24 17:10:00 GMT 2014


I sent an earlier patch to change how GCC configure was setting default
values of caddr_t and ssize_t.  That patch fixed a build problem I had
when building GCC for Windows using the mingw tools but only because my
patch was wrong.  Here is a new patch to fix the problem.

The problem was that crtstuff.c would not compile because it saw two
different (incompatible) definitions of caddr_t, one coming from
auto-host.h (set by the configure script) and one coming from the
sys/types.h system header file (part of glibc in my case).

Since crtstuff.c doesn't actually need or use caddr_t my patch
undef's it after including auto-host.h in the same way that
pid_t, rlim_t, ssize_t, and vfork are already undef'ed.

Note that there is a FIXME in crtstuff that says including auto-host
is wrong, but I don't have a fix for that larger issue.

Tested with my mingw build and a linux based mips toolchain.

OK to checkin?

Steve Ellcey
sellcey@mips.com


2014-04-24  Steve Ellcey  <sellcey@mips.com>

	* crtstuff.c: Undef caddr_t.


diff --git a/libgcc/crtstuff.c b/libgcc/crtstuff.c
index 12bed4b..d09455f 100644
--- a/libgcc/crtstuff.c
+++ b/libgcc/crtstuff.c
@@ -54,6 +54,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "auto-host.h"
 #undef pid_t
 #undef rlim_t
+#undef caddr_t
 #undef ssize_t
 #undef vfork
 #include "tconfig.h"



More information about the Gcc-patches mailing list