Okay, I was wrong about __MINGW64_VERSION_MAJOR: it *was* defined. What apparently happens is that the VirtualQuery() call that follows mark_section_writable(), returns page protection status of 0x80 (PAGE_EXECUTE_WRITECOPY), which is unexpected by the relocator code, so it falls back to calling VirtualProtect() per relocation entry.
I am not entirely sure how this situation comes about, but here you go... On Fri, Aug 15, 2014 at 1:01 AM, Vadim Chugunov <vadi...@gmail.com> wrote: > Hi, > I am trying to figure out the cause of a slow application startup, and the > evidence I have so far, points to mingw's _pei386_runtime_relocator() > routine as the culprit. When I start my app under debugger, I see this > function calling VirtualProtect() about a zillion times in a row. > > Looking at the source, I see that __pei386_runtime_relocator() is supposed > to change memory protection just once per executable section, but only if > __MINGW64_VERSION_MAJOR is defined at compilation time. Otherwise, it > reverts to changing protection once per relocation entry, for compatibility > (?). > Unfortunately, I don't see any headers included by pseudo-reloc.c that > would define this symbol. And, indeed, the behavior I am seeing at runtime > indicates that if was not defined... > > Am I reading this right? > > Thanks! > Vadim > > (mingw version = i686-4.9.0-win32-dwarf-rt_v3-rev2) >
------------------------------------------------------------------------------
_______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public