[llvm-commits] [PATCH] GetPageSize on Cygwin

Chris Lattner clattner at apple.com
Fri May 22 12:56:04 PDT 2009


On May 21, 2009, at 4:29 AM, Jay Foad wrote:

> See this discussion:
>
> http://www.cygwin.com/ml/cygwin/2009-01/threads.html#00492
>
> 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?

Gross, but looks fine :)

-Chris



More information about the llvm-commits mailing list