[LLVMdev] cygwin mmap problem
Jay Foad
jay.foad at gmail.com
Fri Jan 16 09:55:23 PST 2009
A "heads up": if you build LLVM on cygwin, the mmap problem discussed here:
http://www.cygwin.com/ml/cygwin/2009-01/msg00501.html
can crash llc:
$ dd bs=1080K count=1 if=/dev/random of=x.bc
1+0 records in
1+0 records out
1105920 bytes (1.1 MB) copied, 0.167 s, 6.6 MB/s
$ llc x.bc
17418 [main] llc 3596 _cygtls::handle_exceptions: Error while
dumping state (probably corrupted stack)
Segmentation fault (core dumped)
The problem is that MemoryBuffer::getFile() uses getpagesize() to
determine whether it's OK to mmap() a file, but on cygwin mmap()
doesn't really obey the page size returned by getpagesize().
In my local LLVM tree I've worked around this in
sys::Process::getPageSize(), returning a hard-coded value of 4096
instead of calling getpagesize(). (Maybe it would be better to work
around it in MemoryBuffer::getFile() instead; I'm not sure.)
Jay.
More information about the llvm-dev
mailing list