[llvm-commits] [compiler-rt] r100036 - /compiler-rt/trunk/lib/enable_execute_stack.c

Nick Kledzik kledzik at apple.com
Wed Mar 31 12:52:01 PDT 2010


Author: kledzik
Date: Wed Mar 31 14:52:01 2010
New Revision: 100036

URL: http://llvm.org/viewvc/llvm-project?rev=100036&view=rev
Log:
<rdar://problem/7813254> check enable_execute_stack implementation

Modified:
    compiler-rt/trunk/lib/enable_execute_stack.c

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=100036&r1=100035&r2=100036&view=diff
==============================================================================
--- compiler-rt/trunk/lib/enable_execute_stack.c (original)
+++ compiler-rt/trunk/lib/enable_execute_stack.c Wed Mar 31 14:52:01 2010
@@ -21,6 +21,11 @@
 #include <unistd.h>
 #endif /* __APPLE__ */
 
+#if __LP64__
+	#define TRAMPOLINE_SIZE 48
+#else
+	#define TRAMPOLINE_SIZE 40
+#endif
 
 /*
  * The compiler generates calls to __enable_execute_stack() when creating 
@@ -45,7 +50,7 @@
 	const uintptr_t pageAlignMask = ~(pageSize-1);
 	uintptr_t p = (uintptr_t)addr;
 	unsigned char* startPage = (unsigned char*)(p & pageAlignMask);
-	unsigned char* endPage = (unsigned char*)((p+48+pageSize) & pageAlignMask);
+	unsigned char* endPage = (unsigned char*)((p+TRAMPOLINE_SIZE+pageSize) & pageAlignMask);
 	size_t length = endPage - startPage;
 	(void) mprotect((void *)startPage, length, PROT_READ | PROT_WRITE | PROT_EXEC);
 }





More information about the llvm-commits mailing list