[llvm-commits] [PATCH] GetPageSize on Cygwin

Jay Foad jay.foad at gmail.com
Thu May 21 04:29:43 PDT 2009

See this discussion:


On Cygwin, getpagesize() returns 64k, but the page size for the
purposes of memory protection and mmap() is really 4k. An unpleasant
effect of this is that LLVM tools can crash on Cygwin if you give them
an input file that happens to be a multiple of 4k (but not a multiple
of 64k) in size:

$ dd bs=68K count=1 if=/dev/random of=x.bc
1+0 records in
1+0 records out
69632 bytes (70 kB) copied, 0.012 s, 5.8 MB/s

$ ./llc x.bc
Stack dump:
0.      Program arguments: ./llc x.bc
      4 [main] llc 496 _cygtls::handle_exceptions: Error while dumping state (pr
obably corrupted stack)
Segmentation fault (core dumped)

The attached patch bodges sys::Process::GetPageSize() for Cygwin. OK to apply?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.pagesize
Type: application/octet-stream
Size: 709 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090521/595aadf5/attachment.obj>

More information about the llvm-commits mailing list