[RFA] Invalid mmap(2) assumption in pch (ggc-common.c)

Stuart Hastings stuart@apple.com
Sun Apr 24 03:15:00 GMT 2005


On Apr 23, 2005, at 5:42 PM, Matt Thomas wrote:

> Running the libstdc++ testsuite on NetBSD/sparc or NetBSD/sparc64
> results in most tests failing like:
>
> <command line>:1: fatal error: had to relocate PCH
> compilation terminated.
> compiler exited with status 1
>
> This is due to a misassumption in ggc-common.c:654
> (mmap_gt_pch_use_address):
>
>    This version assumes that the kernel honors the START operand of 
> mmap
>    even without MAP_FIXED if START through START+SIZE are not currently
>    mapped with something.
>
> That is not true for NetBSD.  Due to MMU idiosyncracies, some 
> architecures
> (like sparc and sparc64) will align mmap requests that don't have 
> MAP_FIXED
> set for architecture specific reasons).
>
> Is there a reason why MAP_FIXED isn't used even though it probably
> should be?

I can't speak directly to your question, but you might try the version 
in config/host-darwin.[ch].  This implementation statically allocates a 
1G array in the bss, unmaps it, and maps the PCH there.  As the 
commentary indicates, it looks kludgy, but it does seem to make PCH 
more reliable.

I'm not absolutely clear on the details anymore, but I think you need 
host-darwin.c in your link, and host-darwin.h must be #included 
wherever you initialize your host langhooks.

(You could also try MAP_FIXED yourself; that's certainly easier than my 
suggestion above.  :-)

stuart hastings
Apple Computer



More information about the Gcc mailing list