[llvm-commits] [compiler-rt] r78545 - in /compiler-rt/trunk: ConfigureChecks.cmake lib/enable_execute_stack.c
Edward O'Callaghan
eocallaghan at auroraux.org
Sun Aug 9 17:56:47 PDT 2009
Author: evocallaghan
Date: Sun Aug 9 19:56:46 2009
New Revision: 78545
URL: http://llvm.org/viewvc/llvm-project?rev=78545&view=rev
Log:
Fix a FIXME for configure check for HAVE_SYSCONF.
Modified:
compiler-rt/trunk/ConfigureChecks.cmake
compiler-rt/trunk/lib/enable_execute_stack.c
Modified: compiler-rt/trunk/ConfigureChecks.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/ConfigureChecks.cmake?rev=78545&r1=78544&r2=78545&view=diff
==============================================================================
--- compiler-rt/trunk/ConfigureChecks.cmake (original)
+++ compiler-rt/trunk/ConfigureChecks.cmake Sun Aug 9 19:56:46 2009
@@ -11,4 +11,4 @@
CHECK_INCLUDE_FILE( sys/byteorder.h HAVE_SYS_BYTEORDER_H )
# FUNCTIONS
-#CHECK_FUNCTION_EXISTS( strlcpy HAVE_STRLCPY )
+CHECK_FUNCTION_EXISTS( sysconf HAVE_SYSCONF )
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=78545&r1=78544&r2=78545&view=diff
==============================================================================
--- compiler-rt/trunk/lib/enable_execute_stack.c (original)
+++ compiler-rt/trunk/lib/enable_execute_stack.c Sun Aug 9 19:56:46 2009
@@ -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);
More information about the llvm-commits
mailing list