ntdll: prevent test from crashing on amd64

Peter Beutner p.beutner at gmx.net
Mon Nov 13 01:54:33 CST 2006


Putting code in the .data section means it will be mapped RW only, causing
segfaults when trying to execute it (at least on NX-capable systems).

As a quick workaround mark it const, i.e. put it into the .rodata section
which seems to be always mapped executable for ELF files(for whatever reasons).

(It still doesn't work though if you crosscompile the test.)
---
 dlls/ntdll/tests/exception.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c
index a87cadf..0437661 100644
--- a/dlls/ntdll/tests/exception.c
+++ b/dlls/ntdll/tests/exception.c
@@ -241,7 +241,7 @@ static DWORD dreg_handler( EXCEPTION_REC
     return ExceptionContinueExecution;
 }
 
-static BYTE code[5] = {
+const static BYTE code[5] = {
 	0x31, 0xc0, /* xor    %eax,%eax */
 	0x8f, 0x00, /* popl   (%eax) - cause exception */
         0xc3        /* ret */
@@ -292,7 +292,7 @@ static DWORD single_step_handler( EXCEPT
     return ExceptionContinueExecution;
 }
 
-static BYTE single_stepcode[] = {
+const static BYTE single_stepcode[] = {
     0x9c,		/* pushf */
     0x58,		/* pop   %eax */
     0x0d,0,1,0,0,	/* or    $0x100,%eax */
@@ -325,7 +325,7 @@ static void test_single_step(void)
 }
 
 /* Test the alignment check (AC) flag handling. */
-static BYTE align_check_code[] = {
+const static BYTE align_check_code[] = {
     0x55,                  	/* push   %ebp */
     0x89,0xe5,             	/* mov    %esp,%ebp */
     0x9c,                  	/* pushf   */
-- 
1.4.3.4




More information about the wine-patches mailing list