A couple more details:
> The pseudo reloc code does not output any errors when the address overflows; would probably be worth a pull request
I actually did this, to make it error out cleanly instead of having to debug this very non-obvious issue, quite recently: https://github.com/mingw-w64/mingw-w64/commit/ca35236d9799af...
(It's not in any stable release yet, but MSYS2 might be packaging recent git snapshots that could contain it.)
> Check to see if your MinGW program has unexpected imports to kernel32.VirtualProtect!
The runtime pseudo relocation fixing code ends up linked into your executables even if the executable doesn't use any runtime pseudo relocations - so essentially all MinGW programs will end up importing this function. That doesn't mean it does get called though.
I actually did look into fixing it, to make it only be pulled in when something needs it. It would need changes both to the linkers (binutils ld.bfd and lld) and mingw-w64-crt. I do have WIP patches for this for lld and mingw-w64-crt, but I'm not familiar with with the ld.bfd internals to take on fixing that. Plus that changing it would break older versions of the linker, so it would require quite a bit of a transition phase.
> The pseudo reloc code does not output any errors when the address overflows; would probably be worth a pull request
I actually did this, to make it error out cleanly instead of having to debug this very non-obvious issue, quite recently: https://github.com/mingw-w64/mingw-w64/commit/ca35236d9799af...
(It's not in any stable release yet, but MSYS2 might be packaging recent git snapshots that could contain it.)
> Check to see if your MinGW program has unexpected imports to kernel32.VirtualProtect!
The runtime pseudo relocation fixing code ends up linked into your executables even if the executable doesn't use any runtime pseudo relocations - so essentially all MinGW programs will end up importing this function. That doesn't mean it does get called though.
I actually did look into fixing it, to make it only be pulled in when something needs it. It would need changes both to the linkers (binutils ld.bfd and lld) and mingw-w64-crt. I do have WIP patches for this for lld and mingw-w64-crt, but I'm not familiar with with the ld.bfd internals to take on fixing that. Plus that changing it would break older versions of the linker, so it would require quite a bit of a transition phase.