Index: base/applications/games/solitaire/solitaire.cpp =================================================================== --- base/applications/games/solitaire/solitaire.cpp (revision 44318) +++ base/applications/games/solitaire/solitaire.cpp (working copy) @@ -196,8 +196,6 @@ SaveSettings(); - try { throw 0; } catch (int i) { } /* HACK */ - return msg.wParam; } Index: base/applications/games/spider/spider.cpp =================================================================== --- base/applications/games/spider/spider.cpp (revision 44318) +++ base/applications/games/spider/spider.cpp (working copy) @@ -154,9 +154,6 @@ DispatchMessage(&msg); } } - - try { throw 0; } catch (int i) { } /* HACK */ - return msg.wParam; } Index: dll/directx/ddraw/ddraw.rbuild =================================================================== --- dll/directx/ddraw/ddraw.rbuild (revision 44318) +++ dll/directx/ddraw/ddraw.rbuild (working copy) @@ -70,6 +70,4 @@ DirectD3D3_Vtable.c DirectD3D7_Vtable.c - - -fno-unit-at-a-time Index: dll/directx/wine/ddraw/ddraw.rbuild =================================================================== --- dll/directx/wine/ddraw/ddraw.rbuild (revision 44318) +++ dll/directx/wine/ddraw/ddraw.rbuild (working copy) @@ -42,7 +42,4 @@ viewport.c wineheaders - - - -fno-unit-at-a-time Index: dll/win32/actxprxy/actxprxy.rbuild =================================================================== --- dll/win32/actxprxy/actxprxy.rbuild (revision 44318) +++ dll/win32/actxprxy/actxprxy.rbuild (working copy) @@ -16,7 +16,6 @@ rpcrt4 pseh usrmarshal.c - -fno-unit-at-a-time actxprxy_servprov.idl Index: dll/win32/advapi32/advapi32.rbuild =================================================================== --- dll/win32/advapi32/advapi32.rbuild (revision 44318) +++ dll/win32/advapi32/advapi32.rbuild (working copy) @@ -60,5 +60,4 @@ token.c advapi32.rc - -fno-unit-at-a-time Index: dll/win32/crypt32/crypt32.rbuild =================================================================== --- dll/win32/crypt32/crypt32.rbuild (revision 44318) +++ dll/win32/crypt32/crypt32.rbuild (working copy) @@ -43,6 +43,4 @@ message.c crypt32.rc version.rc - - -fno-unit-at-a-time Index: dll/win32/gdi32/gdi32.rbuild =================================================================== --- dll/win32/gdi32/gdi32.rbuild (revision 44318) +++ dll/win32/gdi32/gdi32.rbuild (working copy) @@ -9,11 +9,9 @@ pseh dxguid ntdll - dllmain.c @@ -50,6 +48,4 @@ path.c gdi32.rc - - -fno-unit-at-a-time Index: dll/win32/kernel32/kernel32.rbuild =================================================================== --- dll/win32/kernel32/kernel32.rbuild (revision 44318) +++ dll/win32/kernel32/kernel32.rbuild (working copy) @@ -13,12 +13,8 @@ 0x0600 errcodes - - - -fno-unit-at-a-time -fno-exceptions -fno-rtti Index: dll/win32/ole32/ole32.rbuild =================================================================== --- dll/win32/ole32/ole32.rbuild (revision 44318) +++ dll/win32/ole32/ole32.rbuild (working copy) @@ -64,8 +64,6 @@ dcom.idl irot.idl . - - -fno-unit-at-a-time irot.idl Index: dll/win32/psapi/psapi.rbuild =================================================================== --- dll/win32/psapi/psapi.rbuild (revision 44318) +++ dll/win32/psapi/psapi.rbuild (working copy) @@ -6,12 +6,8 @@ pseh ntdll kernel32 - malloc.c psapi.c psapi.rc - - -fno-unit-at-a-time Index: dll/win32/qmgrprxy/qmgrprxy.rbuild =================================================================== --- dll/win32/qmgrprxy/qmgrprxy.rbuild (revision 44318) +++ dll/win32/qmgrprxy/qmgrprxy.rbuild (working copy) @@ -16,7 +16,6 @@ rpcrt4 pseh version.rc - -fno-unit-at-a-time qmgrprxy.idl Index: dll/win32/rpcrt4/rpcrt4.rbuild =================================================================== --- dll/win32/rpcrt4/rpcrt4.rbuild (revision 44318) +++ dll/win32/rpcrt4/rpcrt4.rbuild (working copy) @@ -40,8 +40,6 @@ rpcrt4.rc epm.idl . - - -fno-unit-at-a-time epm.idl Index: dll/win32/setupapi/setupapi.rbuild =================================================================== --- dll/win32/setupapi/setupapi.rbuild (revision 44318) +++ dll/win32/setupapi/setupapi.rbuild (working copy) @@ -40,6 +40,4 @@ stubs.c rpc.c setupapi.rc - - -fno-unit-at-a-time Index: dll/win32/syssetup/syssetup.rbuild =================================================================== --- dll/win32/syssetup/syssetup.rbuild (revision 44318) +++ dll/win32/syssetup/syssetup.rbuild (working copy) @@ -21,6 +21,4 @@ logfile.c wizard.c syssetup.rc - - -fno-unit-at-a-time Index: dll/win32/user32/user32.rbuild =================================================================== --- dll/win32/user32/user32.rbuild (revision 44318) +++ dll/win32/user32/user32.rbuild (working copy) @@ -12,11 +12,9 @@ pseh ntdll -fms-extensions - button.c combo.c @@ -77,6 +75,4 @@ winpos.c user32.rc - - -fno-unit-at-a-time Index: dll/win32/wintrust/wintrust.rbuild =================================================================== --- dll/win32/wintrust/wintrust.rbuild (revision 44318) +++ dll/win32/wintrust/wintrust.rbuild (working copy) @@ -19,6 +19,4 @@ asn.c softpub.c version.rc - - -fno-unit-at-a-time Index: dll/win32/wlanapi/wlanapi.rbuild =================================================================== --- dll/win32/wlanapi/wlanapi.rbuild (revision 44318) +++ dll/win32/wlanapi/wlanapi.rbuild (working copy) @@ -9,6 +9,4 @@ pseh ntdll main.c - - -fno-unit-at-a-time Index: drivers/input/kbdclass/kbdclass.rbuild =================================================================== --- drivers/input/kbdclass/kbdclass.rbuild (revision 44318) +++ drivers/input/kbdclass/kbdclass.rbuild (working copy) @@ -9,6 +9,4 @@ misc.c setup.c kbdclass.rc - - -fno-unit-at-a-time Index: drivers/input/mouclass/mouclass.rbuild =================================================================== --- drivers/input/mouclass/mouclass.rbuild (revision 44318) +++ drivers/input/mouclass/mouclass.rbuild (working copy) @@ -8,6 +8,4 @@ misc.c mouclass.c mouclass.rc - - -fno-unit-at-a-time Index: drivers/network/afd/afd.rbuild =================================================================== --- drivers/network/afd/afd.rbuild (revision 44318) +++ drivers/network/afd/afd.rbuild (working copy) @@ -8,9 +8,7 @@ ntoskrnl hal - bind.c @@ -27,6 +25,4 @@ write.c afd.rc - - -fno-unit-at-a-time Index: drivers/network/tcpip/tcpip.rbuild =================================================================== --- drivers/network/tcpip/tcpip.rbuild (revision 44318) +++ drivers/network/tcpip/tcpip.rbuild (working copy) @@ -13,11 +13,9 @@ chew ntoskrnl hal - lan.c @@ -40,6 +38,4 @@ wait.c tcpip.rc - - -fno-unit-at-a-time Index: lib/rtl/rtl.rbuild =================================================================== --- lib/rtl/rtl.rbuild (revision 44318) +++ lib/rtl/rtl.rbuild (working copy) @@ -96,9 +96,5 @@ version.c wait.c workitem.c - - - -fno-unit-at-a-time Index: ntoskrnl/ntoskrnl-generic.rbuild =================================================================== --- ntoskrnl/ntoskrnl-generic.rbuild (revision 44318) +++ ntoskrnl/ntoskrnl-generic.rbuild (working copy) @@ -30,11 +30,9 @@ bootvid wdmguid bugcodes - @@ -505,7 +503,4 @@ ntoskrnl.rc ntoskrnl_$(ARCH).lnk - - - -fno-unit-at-a-time Index: ReactOS-generic.rbuild =================================================================== --- ReactOS-generic.rbuild (revision 44318) +++ ReactOS-generic.rbuild (working copy) @@ -122,11 +122,6 @@ -Wno-strict-aliasing -Wpointer-arith -Wno-multichar - Index: subsystems/win32/win32k/objects/gdiobj.c =================================================================== --- subsystems/win32/win32k/objects/gdiobj.c (revision 44318) +++ subsystems/win32/win32k/objects/gdiobj.c (working copy) @@ -30,7 +30,7 @@ #include "gdidbg.c" -/* static */ /* FIXME: -fno-unit-at-a-time breaks this */ +static BOOL INTERNAL_CALL GDI_CleanupDummy(PVOID ObjectBody); /** GLOBALS *******************************************************************/ @@ -87,7 +87,7 @@ /* * Dummy GDI Cleanup Callback */ -/* static */ /* FIXME: -fno-unit-at-a-time breaks this */ +static BOOL INTERNAL_CALL GDI_CleanupDummy(PVOID ObjectBody) { Index: subsystems/win32/win32k/win32k.rbuild =================================================================== --- subsystems/win32/win32k/win32k.rbuild (revision 44318) +++ subsystems/win32/win32k/win32k.rbuild (working copy) @@ -20,9 +20,7 @@ /wd4276 - dib8gen.c @@ -205,8 +203,5 @@ stubs.c umpdstubs.c - - - -fno-unit-at-a-time Index: tools/rbuild/backend/mingw/compilers/gcc.mak =================================================================== --- tools/rbuild/backend/mingw/compilers/gcc.mak (revision 44318) +++ tools/rbuild/backend/mingw/compilers/gcc.mak (working copy) @@ -9,7 +9,7 @@ # FIXME: disabled until RosBE stops sucking # BUILTIN_CPPFLAGS+= -nostdinc -BUILTIN_CFLAGS+= -fno-optimize-sibling-calls +BUILTIN_CFLAGS+= -fno-optimize-sibling-calls -fno-set-stack-executable BUILTIN_CXXFLAGS+= -fno-optimize-sibling-calls #(module, source, dependencies, cflags, output) Index: tools/rbuild/backend/mingw/linkers/ld.mak =================================================================== --- tools/rbuild/backend/mingw/linkers/ld.mak (revision 44318) +++ tools/rbuild/backend/mingw/linkers/ld.mak (working copy) @@ -5,6 +5,8 @@ LDFLAG_WINDOWS:=--subsystem=windows LDFLAG_NATIVE:=--subsystem=native +LDFLAG_EXCLUDE_ALL_SYMBOLS=-exclude-all-symbols + #~ #(module, objs, deps, ldflags, output, def, libs, entry, base) #(module, objs, deps, ldflags, output, def, libs, entry, base, extralibs) define RBUILD_LINK @@ -40,7 +42,7 @@ $(5): ${call RBUILD_intermediate_dir,$(5)}$$(SEP)$(1)_objs.rsp $(7) $(3) $$(RSYM_TARGET) $$(PEFIXUP_TARGET) | ${call RBUILD_dir,$(5)} $$(ECHO_LD) #~ $${ld} --entry=$(8) --image-base=$(9) @${call RBUILD_intermediate_dir,$(5)}$$(SEP)$(1)_objs.rsp $(7) ${call RBUILD_ldflags,$(1),$(4)} -o $$@ - $${ld} --entry=$(8) --image-base=$(9) @${call RBUILD_intermediate_dir,$(5)}$$(SEP)$(1)_objs.rsp $(10) $(7) $(10) ${call RBUILD_ldflags,$(1),$(4)} -o $$@ + $${ld} --entry=$(8) --image-base=$(9) @${call RBUILD_intermediate_dir,$(5)}$$(SEP)$(1)_objs.rsp --start-group $(10) $(7) --end-group ${call RBUILD_ldflags,$(1),$(4)} -o $$@ ifneq ($(or $(6),$$(MODULETYPE$$($(1)_TYPE)_KMODE)),) $$(ECHO_PEFIXUP) $$(Q)$$(PEFIXUP_TARGET) $$@ $(if $(6),-exports) $$(if $$(MODULETYPE$($(1)_TYPE)_KMODE),-sections) Index: tools/rbuild/backend/mingw/mingw.cpp =================================================================== --- tools/rbuild/backend/mingw/mingw.cpp (revision 44318) +++ tools/rbuild/backend/mingw/mingw.cpp (working copy) @@ -480,8 +480,11 @@ fputs ( "BUILTIN_CXXINCLUDES+= $(TARGET_CPPFLAGS)\n", fMakefile ); fprintf ( fMakefile, "PROJECT_CCLIBS := \"$(shell ${TARGET_CC} -print-libgcc-file-name)\"\n" ); - fprintf ( fMakefile, "PROJECT_CXXLIBS := \"$(shell ${TARGET_CPP} -print-file-name=libstdc++.a)\" \"$(shell ${TARGET_CPP} -print-file-name=libgcc.a)\" \"$(shell ${TARGET_CPP} -print-file-name=libmingw32.a)\" \"$(shell ${TARGET_CPP} -print-file-name=libmingwex.a)\" \"$(shell ${TARGET_CPP} -print-file-name=libcoldname.a)\"\n" ); - + + // We use our proprietary "ofmt_stub.a" to implement a stub for "_get_output_format" required by "libmingwex.a". + // This archive just contains the compiled "ofmt_stub.s" supplied with the MinGW Runtime sources. + fprintf ( fMakefile, "PROJECT_CXXLIBS := \"$(shell ${TARGET_CPP} -print-file-name=libstdc++.a)\" \"$(shell ${TARGET_CPP} -print-libgcc-file-name)\" \"$(shell ${TARGET_CPP} -print-file-name=libmingw32.a)\" \"$(shell ${TARGET_CPP} -print-file-name=libmingwex.a)\" \"$(shell ${TARGET_CPP} -print-file-name=ofmt_stub.a)\" \"$(shell ${TARGET_CPP} -print-file-name=libcoldname.a)\"\n" ); + /* hack to get libgcc_eh.a, should check mingw version or something */ if (Environment::GetArch() == "amd64") { @@ -844,7 +847,7 @@ buffer[i] = '\0'; pclose ( fp ); - char separators[] = " ()"; + char separators[] = " ()\n"; char *token; char *prevtoken = NULL; @@ -908,7 +911,7 @@ bool MingwBackend::IsSupportedCompilerVersion ( const string& compilerVersion ) { - if ( strcmp ( compilerVersion.c_str (), "3.4.2") < 0 ) + if ( strcmp ( compilerVersion.c_str (), "4.4.2") < 0 ) return false; else return true; @@ -970,27 +973,32 @@ bool MingwBackend::IsSupportedBinutilsVersion ( const string& binutilsVersion ) { - if ( manualBinutilsSetting ) return true; - - /* linux */ - if ( binutilsVersion.find('.') != std::string::npos ) + int digit = binutilsVersion.find_last_of("."); + if(digit == -1) { - /* TODO: blacklist versions on version number instead of date */ - return true; + printf("Unable to detect binutils version!\n"); + return false; } - - /* - * - Binutils older than 2003/10/01 have broken windres which can't handle - * icons with alpha channel. - * - Binutils between 2004/09/02 and 2004/10/08 have broken handling of - * forward exports in dlltool. - */ - if ( ( ( strcmp ( binutilsVersion.c_str (), "20040902") >= 0 ) && - ( strcmp ( binutilsVersion.c_str (), "20041008") <= 0 ) ) || - ( strcmp ( binutilsVersion.c_str (), "20031001") < 0 ) ) - return false; + + string date = string(binutilsVersion, digit + 1); + if(date.length() == 8) + { + /* This is a real date in the format YYYYMMDD. + Check whether we have at least Binutils 20091017 (older versions + don't support the -exclude-all-symbols option we use). */ + if(strcmp(date.c_str(), "20091017") < 0) + return false; + } else - return true; + { + /* This is no date, so binutilsVersion should just contain the version + number. + Binutils 2.20 will hopefully contain the required features. */ + if(strcmp(binutilsVersion.c_str(), "2.20") < 0) + return false; + } + + return true; } void Index: tools/rbuild/backend/mingw/modulehandler.cpp =================================================================== --- tools/rbuild/backend/mingw/modulehandler.cpp (revision 44318) +++ tools/rbuild/backend/mingw/modulehandler.cpp (working copy) @@ -1782,6 +1782,12 @@ &module.linkerFlags, used_defs ); + /* LD automatically exports all symbols by default if -shared is specified. Prevent it from doing + this by adding the option -exclude-all-symbols (available since Binutils 20091017). */ + // FIXME: Should only be applied for -shared modules, when there's a smart way to check for them. + if ( ModuleHandlerInformations[module.type].DefaultHost == HostFalse && !module.importLibrary ) + fprintf ( fMakefile, "%s_LDFLAGS+=$(LDFLAG_EXCLUDE_ALL_SYMBOLS)\n", module.name.c_str() ); + fprintf ( fMakefile, "\n\n" ); } Index: tools/rbuild/backend/mingw/rules.mak =================================================================== --- tools/rbuild/backend/mingw/rules.mak (revision 44318) +++ tools/rbuild/backend/mingw/rules.mak (working copy) @@ -259,7 +259,7 @@ $$(ECHO_WIDL) $$(Q)$$(widl_TARGET) ${call RBUILD_midlflags,$(1),$(4),-I${call RBUILD_dir,$(2)}} -h -H ${call RBUILD_intermediate_path_noext,$(2)}_c.h -c -C ${call RBUILD_intermediate_path_noext,$(2)}_c.c $(2) -${call RBUILD_CC,$(1),${call RBUILD_intermediate_path_noext,$(2)}_c.c,,-fno-unit-at-a-time,${call RBUILD_intermediate_path_noext,$(2)}_c.o} +${call RBUILD_CC,$(1),${call RBUILD_intermediate_path_noext,$(2)}_c.c,,,${call RBUILD_intermediate_path_noext,$(2)}_c.o} endef @@ -272,7 +272,7 @@ $$(ECHO_WIDL) $$(Q)$$(widl_TARGET) ${call RBUILD_midlflags,$(1),$(4),-I${call RBUILD_dir,$(2)}} -h -H ${call RBUILD_intermediate_path_noext,$(2)}_s.h -s -S ${call RBUILD_intermediate_path_noext,$(2)}_s.c $(2) -${call RBUILD_CC,$(1),${call RBUILD_intermediate_path_noext,$(2)}_s.c,,-fno-unit-at-a-time,${call RBUILD_intermediate_path_noext,$(2)}_s.o} +${call RBUILD_CC,$(1),${call RBUILD_intermediate_path_noext,$(2)}_s.c,,,${call RBUILD_intermediate_path_noext,$(2)}_s.o} endef @@ -285,7 +285,7 @@ $$(ECHO_WIDL) $$(Q)$$(widl_TARGET) ${call RBUILD_midlflags,$(1),$(4),-I${call RBUILD_dir,$(2)}} -h -H ${call RBUILD_intermediate_path_noext,$(2)}_p.h -p -P ${call RBUILD_intermediate_path_noext,$(2)}_p.c $(2) -${call RBUILD_CC,$(1),${call RBUILD_intermediate_path_noext,$(2)}_p.c,,-fno-unit-at-a-time,${call RBUILD_intermediate_path_noext,$(2)}_p.o} +${call RBUILD_CC,$(1),${call RBUILD_intermediate_path_noext,$(2)}_p.c,,,${call RBUILD_intermediate_path_noext,$(2)}_p.o} endef @@ -298,7 +298,7 @@ $$(ECHO_WIDL) $$(Q)$$(widl_TARGET) ${call RBUILD_midlflags,$(1),$(4),-I${call RBUILD_dir,$(2)}} -u -U $$@ $$< -${call RBUILD_CC,$(1),${call RBUILD_intermediate_path_noext,$(2)}_i.c,,-fno-unit-at-a-time,${call RBUILD_intermediate_path_noext,$(2)}_i.o} +${call RBUILD_CC,$(1),${call RBUILD_intermediate_path_noext,$(2)}_i.c,,,${call RBUILD_intermediate_path_noext,$(2)}_i.o} endef