[PATCH] llvm/llvm-gcc broken on mingw32

Hello,

Since 2.5 is near, I have been trying to build llvm and llvm-gcc for MingW, but
hit several problem (using the current trunk).

First issue is that unittests don't build for MingW, the attached patch
should fix it.

Second issue is that llvm-gcc fails for me with the following error:

/c/cygwin/home/jlerouge/buildbot/llvm-test/gcc-build/./gcc/xgcc -B/c/cygwin/home/jlerouge/buildbot/llvm-test/gcc-build/./gcc/ -L/c/cygwin/home/jlerouge/buildbot/llvm-test/gcc-build/i686-pc-mingw32/winsup/mingw -L/c/cygwin/home/jlerouge/buildbot/llvm-test/gcc-build/i686-pc-mingw32/winsup/w32api/lib -isystem /c/cygwin/home/jlerouge/buildbot/llvm-gcc4.2-src/winsup/mingw/include -isystem /c/cygwin/home/jlerouge/buildbot/llvm-gcc4.2-src/winsup/w32api/include -Bc:/cygwin/home/jlerouge/buildbot/llvm-test/i686-pc-mingw32/bin/ -Bc:/cygwin/home/jlerouge/buildbot/llvm-test/i686-pc-mingw32/lib/ -isystem c:/cygwin/home/jlerouge/buildbot/llvm-test/i686-pc-mingw32/include -isystem c:/cygwin/home/jlerouge/buildbot/llvm-test/i686-pc-mingw32/sys-include -c -DHAVE_CONFIG_H -O2 -g -O2 -I. -I../../../../llvm-gcc4.2-src/libiberty/../include -W -Wall -pedantic -Wwrite-strings -Wstrict-prototypes -Wc++-compat ../../../../llvm-gcc4.2-src/libiberty/pex-win32.c -o pex-win32.o
../../../../llvm-gcc4.2-src/libiberty/pex-win32.c: In function 'argv_to_cmdline':
../../../../llvm-gcc4.2-src/libiberty/pex-win32.c:365: warning: request for implicit conversion from 'void *' to 'char *' not permitted in C++
../../../../llvm-gcc4.2-src/libiberty/pex-win32.c: In function 'find_executable':
../../../../llvm-gcc4.2-src/libiberty/pex-win32.c:440: warning: request for implicit conversion from 'void *' to 'char *' not permitted in C++
../../../../llvm-gcc4.2-src/libiberty/pex-win32.c: In function 'win32_spawn':
../../../../llvm-gcc4.2-src/libiberty/pex-win32.c:566: warning: request for implicit conversion from 'void *' to 'char **' not permitted in C++
../../../../llvm-gcc4.2-src/libiberty/pex-win32.c:573: warning: request for implicit conversion from 'void *' to 'char *' not permitted in C++
../../../../llvm-gcc4.2-src/libiberty/pex-win32.c: At top level:
../../../../llvm-gcc4.2-src/libiberty/pex-win32.c:900: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:Bug Reporting - Apple Developer> for instructions.
make[2]: *** [pex-win32.o] Error 1
make[2]: Leaving directory `/c/cygwin/home/jlerouge/buildbot/llvm-test/gcc-build/i686-pc-mingw32/libiberty'
make[1]: *** [all-target-libiberty] Error 2
make[1]: Leaving directory `/c/cygwin/home/jlerouge/buildbot/llvm-test/gcc-build'
make: *** [all] Error 2

The regression seems to have been introduced between revision 61201 (last known
working) and 61242 (first known non working).

I'll try to find out the smallest diff, but I thought running this by the list
first couldn't hurt :wink:

Thanks,
Julien

mingw-googletest.diff (2.67 KB)

Hello, Julien

First issue is that unittests don't build for MingW, the attached patch
should fix it.

Looks ok for me, however, use __MINGW32__ - this is how it's in all LLVM tree nowadays.

working) and 61242 (first known non working).

Are you running bootstrap build?

Hello, Julien

> First issue is that unittests don't build for MingW, the attached
> patch
> should fix it.
Looks ok for me, however, use __MINGW32__ - this is how it's in all
LLVM tree nowadays.

Ok, there was already a __MINGW__ in the original code, so I thought it
would be better to keep it around. I'll remove it.

> working) and 61242 (first known non working).
Are you running bootstrap build?

No, this is not a bootstrap build.

Thanks,
Julien

I filed http://llvm.org/bugs/show_bug.cgi?id=3552 to track this.

I found two issues that prevent non bootstrap build of llvm-gcc, the
first one was introduced in 61207 and the second one in 61215. I think
it affects the 2.5 branch as well.

Thanks,
Julien