Re: [patch] compile: Fix MinGW build [Re: [mingw rfc] Add mkdtemp to gdb/gnulib/]

Pedro Alves
2014-12-18T18:00:02Z

On 12/18/2014 05:22 PM, Eli Zaretskii wrote:
>> Date: Wed, 17 Dec 2014 20:34:12 +0000
>> From: Pedro Alves <palves@redhat.com>
>> CC: brobecker@adacore.com, yao@codesourcery.com, gdb-patches@sourceware.org,
>> ktietz@redhat.com
>>
>> Note that set_gdbarch_infcall_mmap doesn't need to implement the
>> whole feature set of mmap. We only need to be able to carve out a
>> piece of memory. Should map trivially to VirtualAlloc.
>
> That's true, but if this feature will work by doing the equivalent of
> dlopen, then it will most probably only ever work on GNU/Linux. Even
> there, we cannot really hope to do all this stuff by hand, do it
> safely, and then track all the changes in the OS to keep this working
> for the years to come. And good luck being able to do it at all on
> proprietary systems such as Windows, where you cannot simply examine
> the sources of the DLL loader.

I don't think we'll need to. In fact, I have a feeling that on Windows
things will tend to be simpler, given PE is simpler/more contained
than ELF. But if it turns out that whoever tries to make this work on
Windows finds out that the LoadLibrary route is better for Windows, then
I don't see that as a problem. I'm sure we can fit that in by overriding
some hooks.

> I conclude that sadly this feature is extremely limited, and will
> probably die very soon, unless we change its implementation to
> something more portable and safe.

We shall see. :-)

Thanks,
Pedro Alves