Matt Thomas <[EMAIL PROTECTED]> writes: > 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?
Because on many systems MAP_FIXED causes the new mapping to silently displace any existing mapping. That will break gcc, as the the displaced mapped pages will most likely have been allocated by the garbage collector. My reading of uvm_mmap() in uvm_mmap.c is that NetBSD is such a system. There are two possible fixes, either appropriate for config/host-netbsd.c or perhaps config/host-bsd.c. The first possible fix is to copy the approach used in config/host-linux.c, and pick a specific address for each supported architecture which gcc can reasonably expect to be available. The second possible fix is to copy the approach used on config/host-solaris.c, and use mincore to check whether any pages will be silently displaced before using MAP_FIXED. Ian