[compiler-rt] r182303 - [nolibc] Move GetPageSize to the individual platforms.

Kostya Serebryany kcc at google.com
Mon May 20 23:19:28 PDT 2013


I've submitted 182351 to fix the build on Power.
We may need to find another solution. Note that the page size is generally
not a constant, even on x86.
We do need to get it from some libc call or some such.


On Tue, May 21, 2013 at 9:56 AM, Kostya Serebryany <kcc at google.com> wrote:

> This broke asan on PowerPC linux, where the page size
> (sysconf(_SC_PAGESIZE)) is 64K, but for some reason EXEC_PAGESIZE is 4K
>
>
>
> On Mon, May 20, 2013 at 9:05 PM, Peter Collingbourne <peter at pcc.me.uk>wrote:
>
>> Author: pcc
>> Date: Mon May 20 12:05:29 2013
>> New Revision: 182303
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=182303&view=rev
>> Log:
>> [nolibc] Move GetPageSize to the individual platforms.
>>
>> GetPageSize wraps sysconf(_SC_PAGESIZE) on POSIX platforms, but
>> sysconf resides in libc.  To make this libc-independent on Linux,
>> move the wrapper to sanitizer_mac.cc and return the Linux-specific
>> constant EXEC_PAGESIZE in the sanitizer_linux.cc implementation.
>>
>> Modified:
>>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
>>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
>>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc
>>
>> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc?rev=182303&r1=182302&r2=182303&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc (original)
>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc Mon May 20
>> 12:05:29 2013
>> @@ -613,6 +613,10 @@ bool ThreadLister::GetDirectoryEntries()
>>    return true;
>>  }
>>
>> +uptr GetPageSize() {
>> +  return EXEC_PAGESIZE;
>> +}
>> +
>>  // Match full names of the form /path/to/base_name{-,.}*
>>  bool LibraryNameIs(const char *full_name, const char *base_name) {
>>    const char *name = full_name;
>>
>> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc?rev=182303&r1=182302&r2=182303&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc (original)
>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc Mon May 20
>> 12:05:29 2013
>> @@ -170,6 +170,10 @@ void PrepareForSandboxing() {
>>    // Nothing here for now.
>>  }
>>
>> +uptr GetPageSize() {
>> +  return sysconf(_SC_PAGESIZE);
>> +}
>> +
>>  // ----------------- sanitizer_procmaps.h
>>
>>  MemoryMappingLayout::MemoryMappingLayout(bool cache_enabled) {
>>
>> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc?rev=182303&r1=182302&r2=182303&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc (original)
>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc Mon May 20
>> 12:05:29 2013
>> @@ -35,10 +35,6 @@
>>  namespace __sanitizer {
>>
>>  // ------------- sanitizer_common.h
>> -uptr GetPageSize() {
>> -  return sysconf(_SC_PAGESIZE);
>> -}
>> -
>>  uptr GetMmapGranularity() {
>>    return GetPageSize();
>>  }
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130521/2a82bf8f/attachment.html>


More information about the llvm-commits mailing list