From: Mike Frysinger <vapier@gentoo.org>
authorRyan C. Gordon <icculus@icculus.org>
Mon, 12 Dec 2005 09:13:12 +0000
changeset 1199 2d6dc7de1145
parent 1198 b616ac4f39d1
child 1200 8f418dce02b2
From: Mike Frysinger <vapier@gentoo.org> To: sdl@libsdl.org Date: Sun, 11 Dec 2005 22:57:37 -0500 Subject: [SDL] exec stack in libsdl update i posted back in September a patch to remove executable stacks: http://www.devolution.com/pipermail/sdl/2005-September/070626.html later in November, a similar patch was merged it seems: http://www.libsdl.org/cgi/cvsweb.cgi/SDL12/src/hermes/mmx_main.asm however, this lacks the additional output format checks that i posted in my patch ... this isnt a problem if the hermes asm code is only ever used to produce ELF objects, but if this is not true, then the additional checks in my original patch will need to be merged -mike
src/hermes/mmx_main.asm
src/hermes/mmxp2_32.asm
src/hermes/x86_main.asm
src/hermes/x86p_16.asm
src/hermes/x86p_32.asm
--- a/src/hermes/mmx_main.asm	Thu Dec 08 14:48:21 2005 +0000
+++ b/src/hermes/mmx_main.asm	Mon Dec 12 09:13:12 2005 +0000
@@ -12,8 +12,6 @@
 GLOBAL _ConvertMMX
 GLOBAL _mmxreturn
 
-
-SECTION .note.GNU-stack noalloc progbits noexec nowrite
 SECTION .text
 		
 ;; _ConvertMMX:	 
@@ -71,5 +69,6 @@
 	
 	ret		
 
-
-
+%ifidn __OUTPUT_FORMAT__,elf
+section .note.GNU-stack noalloc noexec nowrite progbits
+%endif
--- a/src/hermes/mmxp2_32.asm	Thu Dec 08 14:48:21 2005 +0000
+++ b/src/hermes/mmxp2_32.asm	Mon Dec 12 09:13:12 2005 +0000
@@ -29,7 +29,6 @@
 
 EXTERN _mmxreturn
  
-SECTION .note.GNU-stack noalloc progbits noexec nowrite
 SECTION .data
 	
 ALIGN 8
@@ -383,5 +382,6 @@
 .L4:		
 	jmp _mmxreturn
 
-
-
+%ifidn __OUTPUT_FORMAT__,elf
+section .note.GNU-stack noalloc noexec nowrite progbits
+%endif
--- a/src/hermes/x86_main.asm	Thu Dec 08 14:48:21 2005 +0000
+++ b/src/hermes/x86_main.asm	Mon Dec 12 09:13:12 2005 +0000
@@ -16,7 +16,6 @@
 	
 GLOBAL _Hermes_X86_CPU
 
-SECTION .note.GNU-stack noalloc progbits noexec nowrite
 SECTION .data
 	
 cpu_flags dd 0
@@ -123,3 +122,7 @@
 
 .L1:	
 	ret
+
+%ifidn __OUTPUT_FORMAT__,elf
+section .note.GNU-stack noalloc noexec nowrite progbits
+%endif
--- a/src/hermes/x86p_16.asm	Thu Dec 08 14:48:21 2005 +0000
+++ b/src/hermes/x86p_16.asm	Mon Dec 12 09:13:12 2005 +0000
@@ -27,11 +27,8 @@
 EXTERN _ConvertX86
 EXTERN _x86return
 
-SECTION .note.GNU-stack noalloc progbits noexec nowrite
 SECTION .text
 
-
-
 _ConvertX86p16_16BGR565:
 
     ; check short
@@ -494,3 +491,6 @@
 .L7 pop ebp
     jmp _x86return
 
+%ifidn __OUTPUT_FORMAT__,elf
+section .note.GNU-stack noalloc noexec nowrite progbits
+%endif
--- a/src/hermes/x86p_32.asm	Thu Dec 08 14:48:21 2005 +0000
+++ b/src/hermes/x86p_32.asm	Mon Dec 12 09:13:12 2005 +0000
@@ -25,10 +25,8 @@
 
 EXTERN _x86return
 	
-SECTION .note.GNU-stack noalloc progbits noexec nowrite
 SECTION .text
 
-
 ;; _Convert_*
 ;; Paramters:	
 ;;   ESI = source 
@@ -1042,3 +1040,7 @@
 	
 .L4:	
 	jmp _x86return
+
+%ifidn __OUTPUT_FORMAT__,elf
+section .note.GNU-stack noalloc noexec nowrite progbits
+%endif