This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch lto-plugin]: Don't use sys/wait.h for mingw targets


2010/12/2 Kai Tietz <ktietz70@googlemail.com>:
> 2010/12/2 alsp <alansparkstar@gmail.com>:
>>
>>>>>> Tested for x86_64-w64-mingw32, i686-pc-mingw32, and i686-pc-cygwin. Ok
>>>>>> for apply?
>>
>> Hi,
>>
>> I've been trying to compile GCC on MinGW for the past few days and was stuck
>> on the wait.h problem until I luckily came across this post. It has resolved
>> that particular issue but now I'm getting a different error:
>>
>> /bin/sh ./libtool --tag=CC ? --mode=compile mingw32-gcc -DHAVE_CONFIG_H -I.
>> -I..
>> /../src/lto-plugin ?-I../../src/lto-plugin/../include -DHAVE_CONFIG_H ?-Wall
>> -We
>> rror -g -O2 -D__USE_MINGW_ACCESS -c -o lto-plugin.lo
>> ../../src/lto-plugin/lto-pl
>> ugin.c
>> libtool: compile: ?mingw32-gcc -DHAVE_CONFIG_H -I. -I../../src/lto-plugin
>> -I../.
>> ./src/lto-plugin/../include -DHAVE_CONFIG_H -Wall -Werror -g -O2
>> -D__USE_MINGW_A
>> CCESS -c ../../src/lto-plugin/lto-plugin.c -o lto-plugin.o
>> cc1.exe: warnings being treated as errors
>> ../../src/lto-plugin/lto-plugin.c: In function 'exec_lto_wrapper':
>> ../../src/lto-plugin/lto-plugin.c:556:3: error: implicit declaration of
>> function
>> ?'WIFEXITED'
>> ../../src/lto-plugin/lto-plugin.c:556:3: error: implicit declaration of
>> function
>> ?'WEXITSTATUS'
>> make[2]: *** [lto-plugin.lo] Error 1
>>
>> I've installed MSYS, MinGW, Binutils, Flex, Bison, GMP, MPFR, MPC and am
>> running Windows 7 32-bit.
>>
>> Not sure what other details may be useful - let me know if there are any
>> other details that I can provide.
>>
>> Thanks,
>> Alan
>
> Alan,
>
> sorry for that. I have the following defines in my local headers
> (which aren't standard) and I will prepare a patch for lto-plugin.c
> for this.
> If you define '#define WEXITSTATUS(w) ? ?(((w) >> 8) & 0xff)' and
> '#define WIFEXITED(w) ? ? ?(((w) & 0xff) == 0)', the build will be
> then successful.
>
> For win32 the result of status can be SIGABRT in the lower 8-bits (if
> child got a signal), or in the upper 8 bit the exit-code.
>
> Regards,
> Kai
>

Please could you verify that the following patch works for you? (I
have at the moment no environment up for building a native compiler
for mingw).

ChangeLog

2010-12-02  Kai Tietz

        * lto-plugin.c (exec_lto_wrapper): Special case check without
        sys/wait.h header.


Ok for apply, if test is successful?

Regards,
Kai

Index: lto-plugin.c
===================================================================
--- lto-plugin.c        (revision 167365)
+++ lto-plugin.c        (working copy)
@@ -553,9 +553,12 @@

   t = pex_get_status (pex, 1, &status);
   check (t == 1, LDPL_FATAL, "could not get lto-wrapper exit status");
+#ifdef HAVE_SYS_WAIT_H
   check (WIFEXITED (status) && WEXITSTATUS (status) == 0, LDPL_FATAL,
          "lto-wrapper failed");
-
+#else
+  check (!status, LDPL_FATAL, "lto-wrapper failed");
+#endif
   pex_free (pex);

   free (at_args);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]