From 67589f89a73ce20ca3776859fb090356d1e589d208af6b8526fa1637f355cc83 Mon Sep 17 00:00:00 2001 From: Dominik Schmidt Date: Tue, 20 Dec 2011 14:29:33 +0000 Subject: [PATCH] - apply patch from trunk, that fixes crash on startup on certain systems OBS-URL: https://build.opensuse.org/package/show/windows:mingw:win32/mingw32-runtime?expand=0&rev=18 --- ...-w64-runtime-1.0.1-fix-startup-crash.patch | 51 +++++++++++++++++++ mingw32-runtime.changes | 5 ++ mingw32-runtime.spec | 10 ++-- 3 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 mingw-w64-runtime-1.0.1-fix-startup-crash.patch create mode 100644 mingw32-runtime.changes diff --git a/mingw-w64-runtime-1.0.1-fix-startup-crash.patch b/mingw-w64-runtime-1.0.1-fix-startup-crash.patch new file mode 100644 index 0000000..77c8fa3 --- /dev/null +++ b/mingw-w64-runtime-1.0.1-fix-startup-crash.patch @@ -0,0 +1,51 @@ +diff --git a/crt/pseudo-reloc.c b/crt/pseudo-reloc.c +index 308ecda..9c582b0 100644 +--- a/crt/pseudo-reloc.c ++++ b/crt/pseudo-reloc.c +@@ -252,15 +252,17 @@ restore_modified_sections (void) + static void + __write_memory (void *addr, const void *src, size_t len) + { +-#ifndef __MINGW64_VERSION_MAJOR + MEMORY_BASIC_INFORMATION b; + DWORD oldprot; +-#endif /* ! __MINGW64_VERSION_MAJOR */ ++ int call_unprotect = 0; + + if (!len) + return; + +-#ifndef __MINGW64_VERSION_MAJOR ++#ifdef __MINGW64_VERSION_MAJOR ++ mark_section_writable ((LPVOID) addr); ++#endif ++ + if (!VirtualQuery (addr, &b, sizeof(b))) + { + __report_error (" VirtualQuery failed for %d bytes at address %p", +@@ -269,19 +271,17 @@ __write_memory (void *addr, const void *src, size_t len) + + /* Temporarily allow write access to read-only protected memory. */ + if (b.Protect != PAGE_EXECUTE_READWRITE && b.Protect != PAGE_READWRITE) +- VirtualProtect (b.BaseAddress, b.RegionSize, PAGE_EXECUTE_READWRITE, +- &oldprot); +-#else /* ! __MINGW64_VERSION_MAJOR */ +- mark_section_writable ((LPVOID) addr); +-#endif /* __MINGW64_VERSION_MAJOR */ ++ { ++ call_unprotect = 1; ++ VirtualProtect (b.BaseAddress, b.RegionSize, PAGE_EXECUTE_READWRITE, ++ &oldprot); ++ } + + /* write the data. */ + memcpy (addr, src, len); + /* Restore original protection. */ +-#ifndef __MINGW64_VERSION_MAJOR +- if (b.Protect != PAGE_EXECUTE_READWRITE && b.Protect != PAGE_READWRITE) ++ if (call_unprotect && b.Protect != PAGE_EXECUTE_READWRITE && b.Protect != PAGE_READWRITE) + VirtualProtect (b.BaseAddress, b.RegionSize, oldprot, &oldprot); +-#endif /* !__MINGW64_VERSION_MAJOR */ + } + + #define RP_VERSION_V1 0 diff --git a/mingw32-runtime.changes b/mingw32-runtime.changes new file mode 100644 index 0000000..4624b7a --- /dev/null +++ b/mingw32-runtime.changes @@ -0,0 +1,5 @@ +------------------------------------------------------------------- +Tue Dec 20 16:21:59 UTC 2011 - dev@dominik-schmidt.de + +- apply patch from trunk, that fixes crash on startup on certain systems + diff --git a/mingw32-runtime.spec b/mingw32-runtime.spec index 04262e4..eead85c 100644 --- a/mingw32-runtime.spec +++ b/mingw32-runtime.spec @@ -16,10 +16,12 @@ URL: http://mingw-w64.sourceforge.net/ Source0: http://dl.sourceforge.net/sourceforge/mingw-w64/mingw-w64-runtime-%{version}.tar.bz2 Source100: %{name}-rpmlintrc Patch0: mingw-w64-runtime-1.0.1-vfw32mri.patch -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +# PATCH-FIX-UPSTREAM mingw-w64-runtime-1.0.1-fix-startup-crash.patch - patch taken from trunk, can be dropped with next release +Patch1: mingw-w64-runtime-1.0.1-fix-startup-crash.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildArch: noarch -#!BuildIgnore: post-build-checks +#!BuildIgnore: post-build-checks BuildRequires: mingw32-filesystem BuildRequires: mingw32-cross-binutils @@ -38,11 +40,11 @@ MinGW Win64 cross-compiler runtime, base libraries. %prep %setup -q -n mingw-w64-runtime-%{version} %patch0 -p0 - +%patch1 -p1 %build ./configure --host=%{_mingw32_target} --prefix=%{_prefix} --with-sysroot=%{_mingw32_sysroot} --enable-lib32 --disable-lib64 -make +make %install rm -rf $RPM_BUILD_ROOT