gold work on mingw/mingw64 support

Vladimir Simonov sv@sw.ru
Wed Apr 13 09:46:00 GMT 2011


On 04/12/2011 10:06 PM, Ian Lance Taylor wrote:
> Vladimir Simonov<sv@sw.ru>  writes:
>
>> On 01/04/2011 08:35 PM, Ian Lance Taylor wrote:
>>> Vladimir Simonov<sv@sw.ru>   writes:
>>>
>>>> IMO mremap.c, pread.c, etc. are a kind of such library.
>>>> Analysis of target OS capabilities is overkill here, we
>>>> know in advance - mingw doesn't have mmap and most probably
>>>> won't have it.
>>>
>>> Sure, but there are other systems that also don't have mmap.  We don't
>>> want to test for all of them.
>>>
>>>> If __MINGW32__ looks too OS specific it may be
>>>> replaced with HAVE_NO_MMAP, HAVE_NO_CLOEXEC defined
>>>> in config/mh-mingw. Really __MINGW32__ looks quite strange
>>>> in the middle of descriptors.cc but I don't know how to do it
>>>> better - fake function in mremap.h would be also strange,
>>>> new fcntl.c - the same...
>>>
>>> I'm complaining in part about the __MINGW32__ and in part about the
>>> #ifdef.  Apart from ENABLE_THREADS, the only #ifdefs in gold are very
>>> small ones at the top of a few .cc files.  Let's keep it that way.
>>>
>>> Ian
>>>
>>
>> OK. Here is a version without __MINGW32__, with sys/mman.h and mmap
>> function presence detection and new mmap.h/mmap.c.
>> It is larger but should satisfy you requirements.
>> Could you comment?
>
> Thanks.
>
> I decided to go a different route.  It seems that mmap could in general
> fail for a file which can nevertheless be read.  So I decided to go
> ahead and change gold to handle the case of mmap failing.  This then
> turns the mingw32 code into a matter of supporting systems which don't
> provide mmap by providing a stub mmap which always fails.
>
> I committed the appended patch.  Let me know if you find problems with
> it.  This patch also cleans up mremap a bit even on systems which
> provide mmap.
>
> Ian
>

Thank you. I'll check the patch in couple days and report.

The only I can say from the first glance - chunk from top-level
config/mh-mingw about CXXFLAGS += -D__USE_MINGW_ACCESS is missed.
It is below.
Cause gold is the only c++ program in binutils
I see no reasons against it.

Best regards
Vladimir

--- binutils-2.21.orig/config/mh-mingw	2008-11-27 20:22:09.000000000 +0300
+++ binutils-2.21/config/mh-mingw	2011-01-05 14:01:25.012653500 +0300
@@ -2,5 +2,6 @@
  # Vista (see PR33281 for details).
  BOOT_CFLAGS += -D__USE_MINGW_ACCESS -Wno-pedantic-ms-format
  CFLAGS += -D__USE_MINGW_ACCESS
+CXXFLAGS += -D__USE_MINGW_ACCESS
  # Increase stack limit to same as Linux default.
  LDFLAGS += -Wl,--stack,8388608



More information about the Binutils mailing list