]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Make sure no executable stack gets created.
authorFlorian Krohm <florian@eich-krohm.de>
Wed, 30 Sep 2015 20:30:48 +0000 (20:30 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Wed, 30 Sep 2015 20:30:48 +0000 (20:30 +0000)
Explanation by Matthias Schwarzott:

The linker will request an executable stack as soon as at least one
object file, that is linked in, wants an executable stack.
And the absence of the
      .section .note.GNU-stack."",@progbits
is enough to tell the linker that an executable stack is needed.
So even an empty asm-file must at least contain this statement to not
force executable stacks on the whole executable.

* Define a helper macro MARK_STACK_NO_EXEC that disables the
  executable stack.
* Instantiate this macro unconditionally at the end of each asm file.

Patch by Matthias Schwarzott <zzam@gentoo.org>.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15692

35 files changed:
coregrind/m_cpuid.S
coregrind/m_dispatch/dispatch-amd64-darwin.S
coregrind/m_dispatch/dispatch-amd64-linux.S
coregrind/m_dispatch/dispatch-amd64-solaris.S
coregrind/m_dispatch/dispatch-arm-linux.S
coregrind/m_dispatch/dispatch-arm64-linux.S
coregrind/m_dispatch/dispatch-mips32-linux.S
coregrind/m_dispatch/dispatch-mips64-linux.S
coregrind/m_dispatch/dispatch-ppc32-linux.S
coregrind/m_dispatch/dispatch-ppc64be-linux.S
coregrind/m_dispatch/dispatch-ppc64le-linux.S
coregrind/m_dispatch/dispatch-s390x-linux.S
coregrind/m_dispatch/dispatch-tilegx-linux.S
coregrind/m_dispatch/dispatch-x86-darwin.S
coregrind/m_dispatch/dispatch-x86-linux.S
coregrind/m_dispatch/dispatch-x86-solaris.S
coregrind/m_mach/mach_traps-amd64-darwin.S
coregrind/m_mach/mach_traps-x86-darwin.S
coregrind/m_syswrap/syscall-amd64-darwin.S
coregrind/m_syswrap/syscall-amd64-linux.S
coregrind/m_syswrap/syscall-amd64-solaris.S
coregrind/m_syswrap/syscall-arm-linux.S
coregrind/m_syswrap/syscall-arm64-linux.S
coregrind/m_syswrap/syscall-mips32-linux.S
coregrind/m_syswrap/syscall-mips64-linux.S
coregrind/m_syswrap/syscall-ppc32-linux.S
coregrind/m_syswrap/syscall-ppc64be-linux.S
coregrind/m_syswrap/syscall-ppc64le-linux.S
coregrind/m_syswrap/syscall-s390x-linux.S
coregrind/m_syswrap/syscall-tilegx-linux.S
coregrind/m_syswrap/syscall-x86-darwin.S
coregrind/m_syswrap/syscall-x86-linux.S
coregrind/m_syswrap/syscall-x86-solaris.S
coregrind/m_trampoline.S
include/pub_tool_basics_asm.h

index 48d6cf4915ff88f97d51bc89a26d58e689e42d5f..9ba75ecc371bf97377c23d96aafd26543ea75d28 100644 (file)
         ret
 #endif
 
-#if defined(VGP_x86_linux) || defined(VGP_amd64_linux)
 /* Let the linker know we don't need an executable stack */
-.section .note.GNU-stack,"",@progbits
-#endif
+MARK_STACK_NO_EXEC
 
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
index ee97ce33de0f96f7588a67d9205acc67d76b5ea0..dd7f117041ab2b95995238da1506ee41e9d7b6e2 100644 (file)
   The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
+
 #if defined(VGP_amd64_darwin)
 
-#include "pub_core_basics_asm.h"
 #include "pub_core_dispatch_asm.h"
 #include "pub_core_transtab_asm.h"
 #include "libvex_guest_offsets.h"      /* for OFFSET_amd64_RIP */
@@ -250,6 +251,9 @@ VG_(disp_cp_evcheck_fail):
 
 #endif // defined(VGP_amd64_darwin)
 
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index 9d5d993213a70e4c5f93d3b67670e445c5420385..bb7a0378c0c7899539b4aac98544de64849730c3 100644 (file)
   The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
+
 #if defined(VGP_amd64_linux)
 
-#include "pub_core_basics_asm.h"
 #include "pub_core_dispatch_asm.h"
 #include "pub_core_transtab_asm.h"
 #include "libvex_guest_offsets.h"      /* for OFFSET_amd64_RIP */
@@ -249,11 +250,11 @@ VG_(disp_cp_evcheck_fail):
 
 .size VG_(disp_run_translations), .-VG_(disp_run_translations)
 
-/* Let the linker know we don't need an executable stack */
-.section .note.GNU-stack,"",@progbits
-
 #endif // defined(VGP_amd64_linux)
 
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index 5a3dd81f902c9a8574da97d3a273bc8a22b86d42..3750693480237d704b8fad4a18d39486733dbc6e 100644 (file)
   The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
+
 #if defined(VGP_amd64_solaris)
 
-#include "pub_core_basics_asm.h"
 #include "pub_core_dispatch_asm.h"
 #include "pub_core_transtab_asm.h"
 #include "libvex_guest_offsets.h"      /* for OFFSET_amd64_RIP */
@@ -251,6 +252,9 @@ VG_(disp_cp_evcheck_fail):
 
 #endif // defined(VGP_amd64_solaris)
 
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index 6c5a5fe7bf39e7765fec91ef8fad9cca1faf8415..c21e5e4fb49bd5f78e1d597fea55d4dfb115595a 100644 (file)
   The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
+
 #if defined(VGP_arm_linux)
        .fpu vfp
 
-#include "pub_core_basics_asm.h"
 #include "pub_core_dispatch_asm.h"
 #include "pub_core_transtab_asm.h"
 #include "libvex_guest_offsets.h"      /* for OFFSET_arm_R* */
@@ -206,11 +207,11 @@ VG_(disp_cp_evcheck_fail):
 
 .size VG_(disp_run_translations), .-VG_(disp_run_translations)
 
-/* Let the linker know we don't need an executable stack */
-.section .note.GNU-stack,"",%progbits
-
 #endif // defined(VGP_arm_linux)
 
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
 /*--------------------------------------------------------------------*/
 /*--- end                                     dispatch-arm-linux.S ---*/
 /*--------------------------------------------------------------------*/
index a5443fb86682b542e2f86834b933f764f77a0cbc..2e8e0cd9fa3a11b2945ff6da53c6682c37364ad7 100644 (file)
   The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
+
 #if defined(VGP_arm64_linux)
 
-#include "pub_core_basics_asm.h"
 #include "pub_core_dispatch_asm.h"
 #include "pub_core_transtab_asm.h"
 #include "libvex_guest_offsets.h"      /* for OFFSET_arm_R* */
@@ -231,11 +232,11 @@ VG_(disp_cp_evcheck_fail):
 
 .size VG_(disp_run_translations), .-VG_(disp_run_translations)
 
-/* Let the linker know we don't need an executable stack */
-.section .note.GNU-stack,"",%progbits
-
 #endif // defined(VGP_arm64_linux)
 
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
 /*--------------------------------------------------------------------*/
 /*--- end                                   dispatch-arm64-linux.S ---*/
 /*--------------------------------------------------------------------*/
index 26b067d33193c7b67c600cbfcdadbfcd7f6636fd..22b6b382aa84476a3dc89cb737b08831419ca48b 100644 (file)
   The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
 
 #if defined(VGP_mips32_linux)
 
-#include "pub_core_basics_asm.h"
 #include "pub_core_dispatch_asm.h"
 #include "pub_core_transtab_asm.h"
 #include "libvex_guest_offsets.h"      /* for OFFSET_mips_PC */
@@ -235,11 +235,11 @@ VG_(disp_cp_evcheck_fail):
 
 .size VG_(disp_run_translations), .-VG_(disp_run_translations)
 
+#endif // defined(VGP_mips32_linux)
 
-/* Let the linker know we do not need an executable stack */
-.section .note.GNU-stack,"",@progbits
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
 
-#endif // defined(VGP_mips32_linux)
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index 8af39898f0b5054f2f1741c0ace9d2f3110a7d50..5e5afee060ee3cca3bd3d9617c99d6b81682c8b0 100644 (file)
   The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
 
 #if defined(VGP_mips64_linux)
 
-#include "pub_core_basics_asm.h"
 #include "pub_core_dispatch_asm.h"
 #include "pub_core_transtab_asm.h"
 #include "libvex_guest_offsets.h"      /* for OFFSET_mips_PC */
@@ -235,11 +235,11 @@ VG_(disp_cp_evcheck_fail):
 
 .size VG_(disp_run_translations), .-VG_(disp_run_translations)
 
+#endif // defined(VGP_mips64_linux)
 
-/* Let the linker know we do not need an executable stack */
-.section .note.GNU-stack,"",@progbits
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
 
-#endif // defined(VGP_mips64_linux)
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index 364326d0ed014aadc35ad69167dc027c58be1f19..0c9374f31d780e85892ebc476fa84ef6046e44fd 100644 (file)
   The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
+
 #if defined(VGP_ppc32_linux)
 
 #include "config.h"
-#include "pub_core_basics_asm.h"
 #include "pub_core_dispatch_asm.h"
 #include "pub_core_transtab_asm.h"
 #include "libvex_guest_offsets.h"      /* for OFFSET_ppc32_CIA */
@@ -495,11 +496,11 @@ VG_(disp_cp_evcheck_fail):
         
 .size VG_(disp_run_translations), .-VG_(disp_run_translations)
 
-/* Let the linker know we don't need an executable stack */
-.section .note.GNU-stack,"",@progbits
-
 #endif // defined(VGP_ppc32_linux)
 
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index 46dce2d74a3469739be8bfcb258ba10e2890520a..64e192a460994d8421599f23e56070b8d60205de 100644 (file)
   The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
+
 #if defined(VGP_ppc64be_linux)
 
-#include "pub_core_basics_asm.h"
 #include "pub_core_dispatch_asm.h"
 #include "pub_core_transtab_asm.h"
 #include "libvex_guest_offsets.h"      /* for OFFSET_ppc64_CIA */
@@ -527,11 +528,11 @@ VG_(disp_cp_evcheck_fail):
         
 .size .VG_(disp_run_translations), .-.VG_(disp_run_translations)
 
-/* Let the linker know we don't need an executable stack */
-.section .note.GNU-stack,"",@progbits
-
 #endif // defined(VGP_ppc64be_linux)
 
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index 5da71a6ae5fe08e9803e00841a0f84d94632af37..177228341edd2fd3a943a04938978b837a0b27e7 100644 (file)
   The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
+
 #if  defined(VGP_ppc64le_linux)
 
-#include "pub_core_basics_asm.h"
 #include "pub_core_dispatch_asm.h"
 #include "pub_core_transtab_asm.h"
 #include "libvex_guest_offsets.h"      /* for OFFSET_ppc64_CIA */
@@ -620,11 +621,11 @@ VG_(disp_cp_evcheck_fail):
 
 .size .VG_(disp_run_translations), .-.VG_(disp_run_translations)
 
-/* Let the linker know we don't need an executable stack */
-.section .note.GNU-stack,"",@progbits
-
 #endif // defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)
 
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index 30b2d13f5f450159a34fee9124f78fbb53b5fb3a..aec65ba40554b184475cc3c30d57be6cab36b02b 100644 (file)
@@ -267,11 +267,11 @@ VG_(disp_cp_evcheck_fail):
 
         .size VG_(disp_run_translations), .-VG_(disp_run_translations)
 
-/* Let the linker know we don't need an executable stack */
-        .section .note.GNU-stack,"",@progbits
-
 #endif /* VGA_s390x */
 
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
 /*--------------------------------------------------------------------*/
 /*--- end                                   dispatch-s390x-linux.S ---*/
 /*--------------------------------------------------------------------*/
index 8afa2b4d7bd59996db221ae2fd64c4e1afc61ab5..b3114efce80b6b00d808d77205bafcdc54540a57 100644 (file)
@@ -29,8 +29,9 @@
 
 /* Contributed by Zhi-Gang Liu <zliu at tilera dot com> */
 
-#if defined(VGP_tilegx_linux)
 #include "pub_core_basics_asm.h"
+
+#if defined(VGP_tilegx_linux)
 #include "pub_core_dispatch_asm.h"
 #include "pub_core_transtab_asm.h"
 #include "libvex_guest_offsets.h"       /* for OFFSET_tilegx_PC */
@@ -297,11 +298,11 @@ fast_lookup_failed:
 
         .size VG_(disp_run_translations), .-VG_(disp_run_translations)
 
+#endif /* defined(VGP_tilegx_linux) */
 
-        /* Let the linker know we do not need an executable stack */
-        .section .note.GNU-stack,"",@progbits
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
 
-#endif /* defined(VGP_tilegx_linux) */
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index e636baefd7bd8cd106714a8523cc6acbf84c8c16..d5edbab9f53a022f1a091b2f87b09625cbb939f2 100644 (file)
   The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
+
 #if defined(VGP_x86_darwin)
 
-#include "pub_core_basics_asm.h"
 #include "pub_core_dispatch_asm.h"
 #include "pub_core_transtab_asm.h"
 #include "libvex_guest_offsets.h"      /* for OFFSET_x86_EIP */
@@ -239,6 +240,9 @@ VG_(disp_cp_evcheck_fail):
 
 #endif // defined(VGP_x86_darwin)
 
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index 9b93261960bb48283377f43549607d89aec83b4f..6845911b31036e2a70f494964a09e66002c6952a 100644 (file)
   The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
+
 #if defined(VGP_x86_linux)
 
-#include "pub_core_basics_asm.h"
 #include "pub_core_dispatch_asm.h"
 #include "pub_core_transtab_asm.h"
 #include "libvex_guest_offsets.h"      /* for OFFSET_x86_EIP */
@@ -240,11 +241,11 @@ VG_(disp_cp_evcheck_fail):
 
 .size VG_(disp_run_translations), .-VG_(disp_run_translations)
 
-/* Let the linker know we don't need an executable stack */
-.section .note.GNU-stack,"",@progbits
-
 #endif // defined(VGP_x86_linux)
 
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index 3c7762b768cc4de9ce4bf30bf9f218ad8ccd2774..88f796c2a19241a831c1e74eb94d10323d411c3f 100644 (file)
   The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
+
 #if defined(VGP_x86_solaris)
 
-#include "pub_core_basics_asm.h"
 #include "pub_core_dispatch_asm.h"
 #include "pub_core_transtab_asm.h"
 #include "libvex_guest_offsets.h"      /* for OFFSET_x86_EIP */
@@ -242,6 +243,9 @@ VG_(disp_cp_evcheck_fail):
 
 #endif // defined(VGP_x86_solaris)
 
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index 692fb522804217d02aa385221ff32fe0174c88c3..e5b393c9472023464ff1c15de39fd3ce22c5752c 100644 (file)
@@ -27,6 +27,8 @@
    The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
+
 #if defined(VGP_amd64_darwin)
 
 #include "vki/vki-scnums-darwin.h"
@@ -134,6 +136,9 @@ _semaphore_wait_signal:
 
 #endif // defined(VGP_amd64_darwin)
 
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index 0a23b9af927982394a32dea44bec56b1241474fe..55640603379115cd8b9e57552447c729ac78bb17 100644 (file)
@@ -27,6 +27,8 @@
    The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
+
 #if defined(VGP_x86_darwin)
 
 // DDD: should use __NR_ constants in here instead of the trap numbers
@@ -124,6 +126,9 @@ _semaphore_wait_signal:
 
 #endif // defined(VGP_x86_darwin)
 
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index d82ea164fa0e0007ddf6c7ea3ca76680e908bc48..6f1652b6ace1898a63315f07cf292d27a77c44ea 100644 (file)
   The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
+
 #if defined(VGP_amd64_darwin)
 
-#include "pub_core_basics_asm.h"
 #include "pub_core_vkiscnums_asm.h"
 #include "libvex_guest_offsets.h"
 
@@ -251,6 +252,9 @@ ML_(blksys_finished_UNIX):  .quad MK_L_SCCLASS_N(UNIX,5)
 
 #endif // defined(VGP_amd64_darwin)
 
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index e2c61b4e50cdfd517f18b95e00c4bf8c5d20bb54..80cc75cfc71267159a420056ea1c4f3595f3fe79 100644 (file)
   The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
+
 #if defined(VGP_amd64_linux)
 
-#include "pub_core_basics_asm.h"
 #include "pub_core_vkiscnums_asm.h"
 #include "libvex_guest_offsets.h"
 
@@ -244,11 +245,11 @@ ML_(blksys_committed):    .quad 4b
 ML_(blksys_finished):  .quad 5b
 .previous
 
-/* Let the linker know we don't need an executable stack */
-.section .note.GNU-stack,"",@progbits
-
 #endif // defined(VGP_amd64_linux)
 
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index a34cf9c586800e211c1406384b2cac0f950f2e51..e04503e11f10934e77f8386d4db0393f6c42b4bb 100644 (file)
   The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
+
 #if defined(VGP_amd64_solaris)
 
-#include "pub_core_basics_asm.h"
 #include "pub_core_vkiscnums_asm.h"
 #include "libvex_guest_offsets.h"
 
@@ -273,6 +274,9 @@ ML_(blksys_finished_DRET):  .quad 4b
 
 #endif // defined(VGP_amd64_solaris)
 
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index e2517db20b83e45aee29869cdf82fa8e7c348732..9e020f946a355d5cbb95d5d9644147f0e6292678 100644 (file)
   The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
+
 #if defined(VGP_arm_linux)
 
-#include "pub_core_basics_asm.h"
 #include "pub_core_vkiscnums_asm.h"
 #include "libvex_guest_offsets.h"
       
@@ -141,12 +142,10 @@ ML_(blksys_complete):   .long 3b
 ML_(blksys_committed):  .long 4b
 ML_(blksys_finished):   .long 5b
 
-/* Let the linker know we don't need an executable stack */
-.section .note.GNU-stack,"",%progbits
-
-.previous
-
 #endif // defined(VGP_arm_linux)
+
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
    
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
index 80839962a4d5149ddb1b8a15ad0f8cae36bd4321..2306ade58e05023feb6d19115c97219da26a0ce4 100644 (file)
   The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
+
 #if defined(VGP_arm64_linux)
 
-#include "pub_core_basics_asm.h"
 #include "pub_core_vkiscnums_asm.h"
 #include "libvex_guest_offsets.h"
       
@@ -169,12 +170,10 @@ ML_(blksys_complete):   .quad 3b
 ML_(blksys_committed):  .quad 4b
 ML_(blksys_finished):   .quad 5b
 
-/* Let the linker know we don't need an executable stack */
-.section .note.GNU-stack,"",%progbits
-
-.previous
-
 #endif // defined(VGP_arm_linux)
+
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
    
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
index 9b14daa02552349cb0eafdcff7ff4b57d76c02ad..85459763bdb78df9aa089b5ef7a55766ae646df4 100644 (file)
    The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
+
 #if defined(VGP_mips32_linux)
 
-#include "pub_core_basics_asm.h"
 #include "pub_core_vkiscnums_asm.h"
 #include "libvex_guest_offsets.h"
 
@@ -202,14 +203,12 @@ ML_(blksys_restart):    .long 2b
 ML_(blksys_complete):   .long 3b
 ML_(blksys_committed):  .long 4b
 ML_(blksys_finished):   .long 5b
-.previous
-/* Let the linker know we don't need an executable stack */
-.section .note.GNU-stack,"",%progbits
 
+#endif // defined(VGP_mips32_linux)
 
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
 
-#endif // defined(VGP_mips32_linux)
-   
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index 32ccfede88627785772cc120fa0c44d0e3a48257..660087850f4c6040b12314a2629872682e389c0e 100644 (file)
    The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
+
 #if defined(VGP_mips64_linux)
 
-#include "pub_core_basics_asm.h"
 #include "pub_core_vkiscnums_asm.h"
 #include "libvex_guest_offsets.h"
 
@@ -144,12 +145,12 @@ ML_(blksys_restart):    .quad 2b
 ML_(blksys_complete):   .quad 3b
 ML_(blksys_committed):  .quad 4b
 ML_(blksys_finished):   .quad 5b
-.previous
-/* Let the linker know we don't need an executable stack */
-.section .note.GNU-stack,"",%progbits
 
 #endif // defined(VGP_mips64_linux)
 
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index 86946b46e03be220ec2bb4958a131f9246fff59c..6213922c7d3084ca8f4136b3127796d3c9156923 100644 (file)
   The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
+
 #if defined(VGP_ppc32_linux)
 
-#include "pub_core_basics_asm.h"
 #include "pub_core_vkiscnums_asm.h"
 #include "libvex_guest_offsets.h"
                
@@ -153,13 +154,11 @@ ML_(blksys_complete):  .long 3b
 ML_(blksys_committed): .long 4b
 ML_(blksys_finished):  .long 5b
 
-.previous
-               
-/* Let the linker know we don't need an executable stack */
-.section .note.GNU-stack,"",@progbits
-
 #endif // defined(VGP_ppc32_linux)
 
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index 0634abc55855e58dfcb279226d89d0bc4dd2aada..9c42f3ebe95583a81a7a1a3b238f56fd6bd885c4 100644 (file)
   The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
+
 #if defined(VGP_ppc64be_linux)
 
-#include "pub_core_basics_asm.h"
 #include "pub_core_vkiscnums_asm.h"
 #include "libvex_guest_offsets.h"
                
@@ -161,11 +162,10 @@ ML_(blksys_complete):  .quad 3b
 ML_(blksys_committed): .quad 4b
 ML_(blksys_finished):  .quad 5b
 
+#endif // defined(VGP_ppc64be_linux)
 
 /* Let the linker know we don't need an executable stack */
-.section .note.GNU-stack,"",@progbits
-
-#endif // defined(VGP_ppc64be_linux)
+MARK_STACK_NO_EXEC
 
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
index 8b615091793171b0d0b17df95283cfd203f9c6d7..b469cc4014b66f485ce48fc434e4efcc2d3f2aed 100644 (file)
   The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
+
 #if defined(VGP_ppc64le_linux)
 
-#include "pub_core_basics_asm.h"
 #include "pub_core_vkiscnums_asm.h"
 #include "libvex_guest_offsets.h"
                
@@ -178,11 +179,10 @@ ML_(blksys_complete):  .quad 3b
 ML_(blksys_committed): .quad 4b
 ML_(blksys_finished):  .quad 5b
 
+#endif // defined(VGP_ppc64le_linux)
 
 /* Let the linker know we don't need an executable stack */
-.section .note.GNU-stack,"",@progbits
-
-#endif // defined(VGP_ppc64le_linux)
+MARK_STACK_NO_EXEC
 
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
index 72231f2c87577d4a8ca9c1721d5fab92413e0257..b8a93813d57808cca0c1e643e4206d30d86ccbad 100644 (file)
@@ -162,11 +162,11 @@ ML_(blksys_committed): .quad 4b
 ML_(blksys_finished):  .quad 5b
 .previous
 
-/* Let the linker know we don't need an executable stack */
-.section .note.GNU-stack,"",@progbits
-
 #endif /* VGA_s390x */
 
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index 0bd3756abef1aecb36340815e1bb4487ce54d4e5..7be2f6a9acf8fe881b15bca1e26fd55f49004cce 100644 (file)
 
 /* Contributed by Zhi-Gang Liu <zliu at tilera dot com> */
 
+#include "pub_core_basics_asm.h"
+
 #if defined(VGP_tilegx_linux)
 
-#include "pub_core_basics_asm.h"
 #include "pub_core_vkiscnums_asm.h"
 #include "libvex_guest_offsets.h"
 
@@ -180,11 +181,12 @@ ML_(do_syscall_for_client_WRK):
     ML_(blksys_committed):  .quad 4b
     ML_(blksys_finished):   .quad 5b
     .previous
-    /* Let the linker know we don't need an executable stack */
-    .section .note.GNU-stack,"",%progbits
 
 #endif /* defined(VGP_tilegx_linux) */
 
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index 4f7bac7f0fe51934830ccb5f6d284f134fbe611a..823c9b47eee9cbc9cad88fefa189e5961be0ef9d 100644 (file)
   The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
+
 #if defined(VGP_x86_darwin)
 
-#include "pub_core_basics_asm.h"
 #include "pub_core_vkiscnums_asm.h"
 #include "libvex_guest_offsets.h"
                
@@ -248,7 +249,10 @@ ML_(blksys_committed_UNIX):        .long MK_L_SCCLASS_N(UNIX,4)
 ML_(blksys_finished_UNIX):     .long MK_L_SCCLASS_N(UNIX,5)
 
 #endif // defined(VGP_x86_darwin)
+
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index 30cb23e45d04a978cdd7f77eb7ab4c42aefc39af..e4c6a0a5d3ea6764e4deb5c68cbc5200ac9d5167 100644 (file)
   The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
+
 #if defined(VGP_x86_linux)
 
-#include "pub_core_basics_asm.h"
 #include "pub_core_vkiscnums_asm.h"
 #include "libvex_guest_offsets.h"
                
@@ -183,12 +184,12 @@ ML_(blksys_complete):     .long 3b
 ML_(blksys_committed): .long 4b
 ML_(blksys_finished):  .long 5b
 .previous
-       
-/* Let the linker know we don't need an executable stack */
-.section .note.GNU-stack,"",@progbits
 
 #endif // defined(VGP_x86_linux)
 
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index 654aa84347ad55501dcc31276426836b72be2bf9..c0df3d8ed7e716e38e912a028f9041fa906f190e 100644 (file)
   The GNU General Public License is contained in the file COPYING.
 */
 
+#include "pub_core_basics_asm.h"
+
 #if defined(VGP_x86_solaris)
 
-#include "pub_core_basics_asm.h"
 #include "pub_core_vkiscnums_asm.h"
 #include "libvex_guest_offsets.h"
 
@@ -270,6 +271,9 @@ ML_(blksys_finished_DRET):  .long 4b
 
 #endif // defined(VGP_x86_solaris)
 
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index 5d46b1567cb68e8b8616a67bdd4ffc426af7ae8a..cac22889962b5a45b009a1fef6ca719cdf516957 100644 (file)
@@ -1599,14 +1599,8 @@ VG_(trampoline_stuff_end):
 #endif
 #endif
 
-#if defined(VGO_linux)
 /* Let the linker know we don't need an executable stack */
-#  if defined(VGP_arm_linux)
-   .section .note.GNU-stack,"",%progbits
-#  else        
-   .section .note.GNU-stack,"",@progbits
-#  endif
-#endif
+MARK_STACK_NO_EXEC
 
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
index becf918446aca96942736492ac1ae5298623bed6..d73c91e93956f78660a71a0da77cfca5c59774ee 100644 (file)
 #  error Unknown OS
 #endif
 
+/* Let the linker know we don't need an executable stack.
+   The call to MARK_STACK_NO_EXEC should be put unconditionally
+   at the end of all asm source files.
+*/
+#if defined(VGO_linux)
+#  if defined(VGA_arm)
+#    define MARK_STACK_NO_EXEC .section .note.GNU-stack,"",%progbits
+#  else
+#    define MARK_STACK_NO_EXEC .section .note.GNU-stack,"",@progbits
+#  endif
+#else
+#  define MARK_STACK_NO_EXEC
+#endif
+
 #endif /* __PUB_TOOL_BASICS_ASM_H */
 
 /*--------------------------------------------------------------------*/