diff options
author | Edward O'Callaghan <eocallaghan@auroraux.org> | 2009-08-10 00:56:46 +0000 |
---|---|---|
committer | Edward O'Callaghan <eocallaghan@auroraux.org> | 2009-08-10 00:56:46 +0000 |
commit | de1c6cfc90140c34469f78cba86040796ca4b98b (patch) | |
tree | 6e36eb04ab0c5f27506203ca872b0c2d704046e2 | |
parent | 166b783fa2b1bf6329db080b3a7f922f37914974 (diff) | |
download | compiler-rt-de1c6cfc90140c34469f78cba86040796ca4b98b.tar.gz compiler-rt-de1c6cfc90140c34469f78cba86040796ca4b98b.tar.bz2 compiler-rt-de1c6cfc90140c34469f78cba86040796ca4b98b.tar.xz |
Fix a FIXME for configure check for HAVE_SYSCONF.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@78545 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | ConfigureChecks.cmake | 2 | ||||
-rw-r--r-- | lib/enable_execute_stack.c | 14 |
2 files changed, 12 insertions, 4 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 57ae7909..8b027bc3 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -11,4 +11,4 @@ SET( SOURCEDIR ${CMAKE_SOURCE_DIR} ) CHECK_INCLUDE_FILE( sys/byteorder.h HAVE_SYS_BYTEORDER_H ) # FUNCTIONS -#CHECK_FUNCTION_EXISTS( strlcpy HAVE_STRLCPY ) +CHECK_FUNCTION_EXISTS( sysconf HAVE_SYSCONF ) diff --git a/lib/enable_execute_stack.c b/lib/enable_execute_stack.c index 6f17c9b9..07c1645c 100644 --- a/lib/enable_execute_stack.c +++ b/lib/enable_execute_stack.c @@ -10,9 +10,14 @@ #include <stdint.h> #include <sys/mman.h> + +/* #include "config.h" + * FIXME: CMake - include when cmake system is ready. + */ + #ifndef __APPLE__ #include <unistd.h> -#endif +#endif /* __APPLE__ */ /* @@ -25,13 +30,16 @@ void __enable_execute_stack(void* addr) { + #if __APPLE__ /* On Darwin, pagesize is always 4096 bytes */ const uintptr_t pageSize = 4096; +#elif !defined(HAVE_SYSCONF) +#error "HAVE_SYSCONF not defined! See enable_execute_stack.c" #else - /* FIXME: We should have a configure check for this. */ const uintptr_t pageSize = sysconf(_SC_PAGESIZE); -#endif +#endif /* __APPLE__ */ + const uintptr_t pageAlignMask = ~(pageSize-1); uintptr_t p = (uintptr_t)addr; unsigned char* startPage = (unsigned char*)(p & pageAlignMask); |