2011/3/28 Arnaud Charlet <char...@adacore.com>: >> this patch fixes some nits about MSG_WAITALL for mingw(-w64) targets. >> Additionally it improves multilib configury for windows native >> targets. > > Can you please split this patch in two, since the MSG_WAITALL is one thing, > and the multilib is a completely different patch.
Hello Arno, I split patch into two. ada_w_multi.txt contains just the gcc-interface/Makefile.in change and the ada_wt.txt the MSG_WAITALL patch. ChangeLog gcc/ada (ada_wt.txt) 2011-03-28 Kai Tietz * raise-gcc.c (PERSONALITY_FUNCTION): Add prototype to prevent warning. * g-socthi-mingw.adb (C_Recvmsg): Handle MSG_WAITALL for windows native targets. * s-oscons-tmplt.c (MSG_WAITALL): Define it for native windows targets to flag value. ChangeLog gcc/ada (ada_w_multi.txt) 2011-03-28 Kai Tietz * gcc-interface/Makefile.in (SO_LIB): Handle multilib build for native windows targets. (EH_MECHANISM): Make sure we use gcc's exception mechanism for 64-bit native windows target. > > Also, can you explain the setting of SO_LIB in more details? The issue is that on creation of .dll the linker has to know for multilib for which target it should work. By specifying to frontend the -m32/-m64 the internal spec-file takes care that proper options are passed to ld. > Concerning the setting of EH_MECHANISM, it's time to set ZCX to True by > default on Windows 32bits as well, and set EH_MECHANISM=-gcc on all > Windows variants IMO. Well, here I am not that sure. As mingw.org is still using the dw2-unwinding, but there is also the sjlj one, I am a bit concerned to make EH_MECHANISM=-gcc default. Same is the case for the ZCX flag, but I might overlook here something obvious. Regards, Kai
Index: gcc/gcc/ada/gcc-interface/Makefile.in =================================================================== --- gcc.orig/gcc/ada/gcc-interface/Makefile.in 2011-03-28 10:29:44.000000000 +0200 +++ gcc/gcc/ada/gcc-interface/Makefile.in 2011-03-28 10:32:28.890727300 +0200 @@ -1638,17 +1638,23 @@ ifeq ($(strip $(filter-out cygwin32% min ifeq ($(strip $(MULTISUBDIR)),/32) LIBGNAT_TARGET_PAIRS += \ system.ads<system-mingw.ads + SO_OPTS= -m32 -Wl,-soname, else LIBGNAT_TARGET_PAIRS += \ system.ads<system-mingw-x86_64.ads + EH_MECHANISM=-gcc + SO_OPTS = -m64 -Wl,-soname, endif else ifeq ($(strip $(MULTISUBDIR)),/64) LIBGNAT_TARGET_PAIRS += \ system.ads<system-mingw-x86_64.ads + EH_MECHANISM=-gcc + SO_OPTS = -m64 -Wl,-soname, else LIBGNAT_TARGET_PAIRS += \ system.ads<system-mingw.ads + SO_OPTS = -m32 -Wl,-soname, endif endif
Index: gcc/gcc/ada/g-socthi-mingw.adb =================================================================== --- gcc.orig/gcc/ada/g-socthi-mingw.adb 2010-09-09 16:07:42.000000000 +0200 +++ gcc/gcc/ada/g-socthi-mingw.adb 2011-03-28 09:42:45.039326300 +0200 @@ -277,7 +277,8 @@ package body GNAT.Sockets.Thin is use type C.size_t; Fill : constant Boolean := - (C.unsigned (Flags) and SOSC.MSG_WAITALL) /= 0; + SOSC.MSG_WAITALL /= -1 + and then (C.unsigned (Flags) and SOSC.MSG_WAITALL) /= 0; -- Is the MSG_WAITALL flag set? If so we need to fully fill all vectors Res : C.int; Index: gcc/gcc/ada/raise-gcc.c =================================================================== --- gcc.orig/gcc/ada/raise-gcc.c 2010-10-28 22:36:06.000000000 +0200 +++ gcc/gcc/ada/raise-gcc.c 2011-03-28 09:11:43.053384100 +0200 @@ -1065,6 +1065,11 @@ typedef _Unwind_Action phases_arg_t; #endif _Unwind_Reason_Code +PERSONALITY_FUNCTION (version_arg_t, phases_arg_t, + _Unwind_Exception_Class, _Unwind_Exception *, + _Unwind_Context *); + +_Unwind_Reason_Code PERSONALITY_FUNCTION (version_arg_t version_arg, phases_arg_t phases_arg, _Unwind_Exception_Class uw_exception_class, Index: gcc/gcc/ada/s-oscons-tmplt.c =================================================================== --- gcc.orig/gcc/ada/s-oscons-tmplt.c 2010-12-24 11:41:57.000000000 +0100 +++ gcc/gcc/ada/s-oscons-tmplt.c 2011-03-28 09:15:39.683932300 +0200 @@ -1084,6 +1084,10 @@ CND(MSG_PEEK, "Peek at incoming data") CND(MSG_EOR, "Send end of record") #ifndef MSG_WAITALL +#ifdef __MINWGW32__ +/* We use it on windows native targets, so set to flag value. */ +# define MSG_WAITALL (1 << 2) +#else # define MSG_WAITALL -1 #endif CND(MSG_WAITALL, "Wait for full reception")