[llvm-commits] [compiler-rt] r85397 - in /compiler-rt/trunk/test/Unit: clear_cache_test.c enable_execute_stack_test.c
Shantonu Sen
ssen at apple.com
Wed Oct 28 08:54:05 PDT 2009
Author: ssen
Date: Wed Oct 28 10:54:04 2009
New Revision: 85397
URL: http://llvm.org/viewvc/llvm-project?rev=85397&view=rev
Log:
Work around strictness in gcc 4.4.1 casting a function pointer to void *
Modified:
compiler-rt/trunk/test/Unit/clear_cache_test.c
compiler-rt/trunk/test/Unit/enable_execute_stack_test.c
Modified: compiler-rt/trunk/test/Unit/clear_cache_test.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/Unit/clear_cache_test.c?rev=85397&r1=85396&r2=85397&view=diff
==============================================================================
--- compiler-rt/trunk/test/Unit/clear_cache_test.c (original)
+++ compiler-rt/trunk/test/Unit/clear_cache_test.c Wed Oct 28 10:54:04 2009
@@ -42,16 +42,16 @@
return 1;
// verify you can copy and execute a function
- memcpy(execution_buffer, &func1, 128);
+ memcpy(execution_buffer, (void *)(uintptr_t)&func1, 128);
__clear_cache(execution_buffer, &execution_buffer[128]);
- pfunc f1 = (pfunc)execution_buffer;
+ pfunc f1 = (pfunc)(uintptr_t)execution_buffer;
if ( (*f1)() != 1 )
return 1;
// verify you can overwrite a function with another
- memcpy(execution_buffer, &func2, 128);
+ memcpy(execution_buffer, (void *)(uintptr_t)&func2, 128);
__clear_cache(execution_buffer, &execution_buffer[128]);
- pfunc f2 = (pfunc)execution_buffer;
+ pfunc f2 = (pfunc)(uintptr_t)execution_buffer;
if ( (*f2)() != 2 )
return 1;
Modified: compiler-rt/trunk/test/Unit/enable_execute_stack_test.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/Unit/enable_execute_stack_test.c?rev=85397&r1=85396&r2=85397&view=diff
==============================================================================
--- compiler-rt/trunk/test/Unit/enable_execute_stack_test.c (original)
+++ compiler-rt/trunk/test/Unit/enable_execute_stack_test.c Wed Oct 28 10:54:04 2009
@@ -35,21 +35,21 @@
int main()
{
- unsigned char execution_buffer[128];
- // mark stack page containing execution_buffer to be executable
- __enable_execute_stack(execution_buffer);
+ unsigned char execution_buffer[128];
+ // mark stack page containing execution_buffer to be executable
+ __enable_execute_stack(execution_buffer);
// verify you can copy and execute a function
- memcpy(execution_buffer, &func1, 128);
+ memcpy(execution_buffer, (void *)(uintptr_t)&func1, 128);
__clear_cache(execution_buffer, &execution_buffer[128]);
- pfunc f1 = (pfunc)execution_buffer;
+ pfunc f1 = (pfunc)(uintptr_t)execution_buffer;
if ( (*f1)() != 1 )
return 1;
// verify you can overwrite a function with another
- memcpy(execution_buffer, &func2, 128);
+ memcpy(execution_buffer, (void *)(uintptr_t)&func2, 128);
__clear_cache(execution_buffer, &execution_buffer[128]);
- pfunc f2 = (pfunc)execution_buffer;
+ pfunc f2 = (pfunc)(uintptr_t)execution_buffer;
if ( (*f2)() != 2 )
return 1;
More information about the llvm-commits
mailing list