[llvm-commits] [compiler-rt] r78538 - in /compiler-rt/trunk/lib: enable_execute_stack.c endianness.h

Edward O'Callaghan eocallaghan at auroraux.org
Sun Aug 9 13:02:17 PDT 2009


Attached is what I was thinking.

Cheers,
Edward O'Callaghan.

2009/8/9 Edward O'Callaghan <eocallaghan at auroraux.org>:
> Hi,
>
> Just a few things.
>
>> -        const uintptr_t pageSize = getpagesize();
>> +        const uintptr_t pageSize = sysconf(_SC_PAGESIZE);
>
> Looks worrying to me, here is my reasoning:
>
> * sysconf returns a long not uintptr_t.
> * sysconf could return a -1 ( I'm not sure about _SC_PAGESIZE but we
> get a -1 when we have no limit *or* the limit name is invaild. ) which
> is unchecked.
>
> Side note, The /* FIXME .. */ comment can now be removed.
>
> Perhaps drop the Apple pre-processor checks and instead rely on the
> sysconf() result or default to 4096 if we get a -1 returned, seems
> much cleaner?
>
> Cheers,
> Edward O'Callaghan.
>
> 2009/8/9 Nuno Lopes <nunoplopes at sapo.pt>:
>> Author: nlopes
>> Date: Sun Aug  9 13:59:21 2009
>> New Revision: 78538
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=78538&view=rev
>> Log:
>> fix build on linux
>>
>> Modified:
>>    compiler-rt/trunk/lib/enable_execute_stack.c
>>    compiler-rt/trunk/lib/endianness.h
>>
>> Modified: compiler-rt/trunk/lib/enable_execute_stack.c
>> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/enable_execute_stack.c?rev=78538&r1=78537&r2=78538&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/enable_execute_stack.c (original)
>> +++ compiler-rt/trunk/lib/enable_execute_stack.c Sun Aug  9 13:59:21 2009
>> @@ -30,7 +30,7 @@
>>        const uintptr_t pageSize = 4096;
>>  #else
>>         /* FIXME: We should have a configure check for this. */
>> -        const uintptr_t pageSize = getpagesize();
>> +        const uintptr_t pageSize = sysconf(_SC_PAGESIZE);
>>  #endif
>>        const uintptr_t pageAlignMask = ~(pageSize-1);
>>        uintptr_t p = (uintptr_t)addr;
>>
>> Modified: compiler-rt/trunk/lib/endianness.h
>> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/endianness.h?rev=78538&r1=78537&r2=78538&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/endianness.h (original)
>> +++ compiler-rt/trunk/lib/endianness.h Sun Aug  9 13:59:21 2009
>> @@ -72,7 +72,7 @@
>>
>>  /* .. */
>>
>> -#if defined(__Linux__)
>> +#if defined(__linux__)
>>  #include <endian.h>
>>
>>  #if __BYTE_ORDER == __BIG_ENDIAN
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
>
>
> --
> --
> Edward O'Callaghan
> http://www.auroraux.org/
> eocallaghan at auroraux dot org
>



-- 
-- 
Edward O'Callaghan
http://www.auroraux.org/
eocallaghan at auroraux dot org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ees.patch
Type: application/octet-stream
Size: 1101 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090809/ad7a2fe6/attachment.obj>


More information about the llvm-commits mailing list