|
From: <sv...@va...> - 2015-09-30 20:30:59
|
Author: florian
Date: Wed Sep 30 21:30:48 2015
New Revision: 15692
Log:
Make sure no executable stack gets created.
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 <zz...@ge...>.
Modified:
trunk/coregrind/m_cpuid.S
trunk/coregrind/m_dispatch/dispatch-amd64-darwin.S
trunk/coregrind/m_dispatch/dispatch-amd64-linux.S
trunk/coregrind/m_dispatch/dispatch-amd64-solaris.S
trunk/coregrind/m_dispatch/dispatch-arm-linux.S
trunk/coregrind/m_dispatch/dispatch-arm64-linux.S
trunk/coregrind/m_dispatch/dispatch-mips32-linux.S
trunk/coregrind/m_dispatch/dispatch-mips64-linux.S
trunk/coregrind/m_dispatch/dispatch-ppc32-linux.S
trunk/coregrind/m_dispatch/dispatch-ppc64be-linux.S
trunk/coregrind/m_dispatch/dispatch-ppc64le-linux.S
trunk/coregrind/m_dispatch/dispatch-s390x-linux.S
trunk/coregrind/m_dispatch/dispatch-tilegx-linux.S
trunk/coregrind/m_dispatch/dispatch-x86-darwin.S
trunk/coregrind/m_dispatch/dispatch-x86-linux.S
trunk/coregrind/m_dispatch/dispatch-x86-solaris.S
trunk/coregrind/m_mach/mach_traps-amd64-darwin.S
trunk/coregrind/m_mach/mach_traps-x86-darwin.S
trunk/coregrind/m_syswrap/syscall-amd64-darwin.S
trunk/coregrind/m_syswrap/syscall-amd64-linux.S
trunk/coregrind/m_syswrap/syscall-amd64-solaris.S
trunk/coregrind/m_syswrap/syscall-arm-linux.S
trunk/coregrind/m_syswrap/syscall-arm64-linux.S
trunk/coregrind/m_syswrap/syscall-mips32-linux.S
trunk/coregrind/m_syswrap/syscall-mips64-linux.S
trunk/coregrind/m_syswrap/syscall-ppc32-linux.S
trunk/coregrind/m_syswrap/syscall-ppc64be-linux.S
trunk/coregrind/m_syswrap/syscall-ppc64le-linux.S
trunk/coregrind/m_syswrap/syscall-s390x-linux.S
trunk/coregrind/m_syswrap/syscall-tilegx-linux.S
trunk/coregrind/m_syswrap/syscall-x86-darwin.S
trunk/coregrind/m_syswrap/syscall-x86-linux.S
trunk/coregrind/m_syswrap/syscall-x86-solaris.S
trunk/coregrind/m_trampoline.S
trunk/include/pub_tool_basics_asm.h
Modified: trunk/coregrind/m_cpuid.S
==============================================================================
--- trunk/coregrind/m_cpuid.S (original)
+++ trunk/coregrind/m_cpuid.S Wed Sep 30 21:30:48 2015
@@ -151,10 +151,8 @@
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 ---*/
Modified: trunk/coregrind/m_dispatch/dispatch-amd64-darwin.S
==============================================================================
--- trunk/coregrind/m_dispatch/dispatch-amd64-darwin.S (original)
+++ trunk/coregrind/m_dispatch/dispatch-amd64-darwin.S Wed Sep 30 21:30:48 2015
@@ -29,9 +29,10 @@
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 @@
#endif // defined(VGP_amd64_darwin)
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_dispatch/dispatch-amd64-linux.S
==============================================================================
--- trunk/coregrind/m_dispatch/dispatch-amd64-linux.S (original)
+++ trunk/coregrind/m_dispatch/dispatch-amd64-linux.S Wed Sep 30 21:30:48 2015
@@ -29,9 +29,10 @@
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 @@
.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 ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_dispatch/dispatch-amd64-solaris.S
==============================================================================
--- trunk/coregrind/m_dispatch/dispatch-amd64-solaris.S (original)
+++ trunk/coregrind/m_dispatch/dispatch-amd64-solaris.S Wed Sep 30 21:30:48 2015
@@ -29,9 +29,10 @@
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 @@
#endif // defined(VGP_amd64_solaris)
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_dispatch/dispatch-arm-linux.S
==============================================================================
--- trunk/coregrind/m_dispatch/dispatch-arm-linux.S (original)
+++ trunk/coregrind/m_dispatch/dispatch-arm-linux.S Wed Sep 30 21:30:48 2015
@@ -29,10 +29,11 @@
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 @@
.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 ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_dispatch/dispatch-arm64-linux.S
==============================================================================
--- trunk/coregrind/m_dispatch/dispatch-arm64-linux.S (original)
+++ trunk/coregrind/m_dispatch/dispatch-arm64-linux.S Wed Sep 30 21:30:48 2015
@@ -29,9 +29,10 @@
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 @@
.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 ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_dispatch/dispatch-mips32-linux.S
==============================================================================
--- trunk/coregrind/m_dispatch/dispatch-mips32-linux.S (original)
+++ trunk/coregrind/m_dispatch/dispatch-mips32-linux.S Wed Sep 30 21:30:48 2015
@@ -29,10 +29,10 @@
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 @@
.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 ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_dispatch/dispatch-mips64-linux.S
==============================================================================
--- trunk/coregrind/m_dispatch/dispatch-mips64-linux.S (original)
+++ trunk/coregrind/m_dispatch/dispatch-mips64-linux.S Wed Sep 30 21:30:48 2015
@@ -29,10 +29,10 @@
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 @@
.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 ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_dispatch/dispatch-ppc32-linux.S
==============================================================================
--- trunk/coregrind/m_dispatch/dispatch-ppc32-linux.S (original)
+++ trunk/coregrind/m_dispatch/dispatch-ppc32-linux.S Wed Sep 30 21:30:48 2015
@@ -28,10 +28,11 @@
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 @@
.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 ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_dispatch/dispatch-ppc64be-linux.S
==============================================================================
--- trunk/coregrind/m_dispatch/dispatch-ppc64be-linux.S (original)
+++ trunk/coregrind/m_dispatch/dispatch-ppc64be-linux.S Wed Sep 30 21:30:48 2015
@@ -28,9 +28,10 @@
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 @@
.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 ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_dispatch/dispatch-ppc64le-linux.S
==============================================================================
--- trunk/coregrind/m_dispatch/dispatch-ppc64le-linux.S (original)
+++ trunk/coregrind/m_dispatch/dispatch-ppc64le-linux.S Wed Sep 30 21:30:48 2015
@@ -28,9 +28,10 @@
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 @@
.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 ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_dispatch/dispatch-s390x-linux.S
==============================================================================
--- trunk/coregrind/m_dispatch/dispatch-s390x-linux.S (original)
+++ trunk/coregrind/m_dispatch/dispatch-s390x-linux.S Wed Sep 30 21:30:48 2015
@@ -267,11 +267,11 @@
.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 ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_dispatch/dispatch-tilegx-linux.S
==============================================================================
--- trunk/coregrind/m_dispatch/dispatch-tilegx-linux.S (original)
+++ trunk/coregrind/m_dispatch/dispatch-tilegx-linux.S Wed Sep 30 21:30:48 2015
@@ -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 @@
.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 ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_dispatch/dispatch-x86-darwin.S
==============================================================================
--- trunk/coregrind/m_dispatch/dispatch-x86-darwin.S (original)
+++ trunk/coregrind/m_dispatch/dispatch-x86-darwin.S Wed Sep 30 21:30:48 2015
@@ -29,9 +29,10 @@
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 @@
#endif // defined(VGP_x86_darwin)
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_dispatch/dispatch-x86-linux.S
==============================================================================
--- trunk/coregrind/m_dispatch/dispatch-x86-linux.S (original)
+++ trunk/coregrind/m_dispatch/dispatch-x86-linux.S Wed Sep 30 21:30:48 2015
@@ -29,9 +29,10 @@
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 @@
.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 ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_dispatch/dispatch-x86-solaris.S
==============================================================================
--- trunk/coregrind/m_dispatch/dispatch-x86-solaris.S (original)
+++ trunk/coregrind/m_dispatch/dispatch-x86-solaris.S Wed Sep 30 21:30:48 2015
@@ -29,9 +29,10 @@
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 @@
#endif // defined(VGP_x86_solaris)
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_mach/mach_traps-amd64-darwin.S
==============================================================================
--- trunk/coregrind/m_mach/mach_traps-amd64-darwin.S (original)
+++ trunk/coregrind/m_mach/mach_traps-amd64-darwin.S Wed Sep 30 21:30:48 2015
@@ -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 @@
#endif // defined(VGP_amd64_darwin)
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_mach/mach_traps-x86-darwin.S
==============================================================================
--- trunk/coregrind/m_mach/mach_traps-x86-darwin.S (original)
+++ trunk/coregrind/m_mach/mach_traps-x86-darwin.S Wed Sep 30 21:30:48 2015
@@ -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 @@
#endif // defined(VGP_x86_darwin)
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_syswrap/syscall-amd64-darwin.S
==============================================================================
--- trunk/coregrind/m_syswrap/syscall-amd64-darwin.S (original)
+++ trunk/coregrind/m_syswrap/syscall-amd64-darwin.S Wed Sep 30 21:30:48 2015
@@ -28,9 +28,10 @@
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 @@
#endif // defined(VGP_amd64_darwin)
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_syswrap/syscall-amd64-linux.S
==============================================================================
--- trunk/coregrind/m_syswrap/syscall-amd64-linux.S (original)
+++ trunk/coregrind/m_syswrap/syscall-amd64-linux.S Wed Sep 30 21:30:48 2015
@@ -28,9 +28,10 @@
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_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 ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_syswrap/syscall-amd64-solaris.S
==============================================================================
--- trunk/coregrind/m_syswrap/syscall-amd64-solaris.S (original)
+++ trunk/coregrind/m_syswrap/syscall-amd64-solaris.S Wed Sep 30 21:30:48 2015
@@ -28,9 +28,10 @@
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 @@
#endif // defined(VGP_amd64_solaris)
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_syswrap/syscall-arm-linux.S
==============================================================================
--- trunk/coregrind/m_syswrap/syscall-arm-linux.S (original)
+++ trunk/coregrind/m_syswrap/syscall-arm-linux.S Wed Sep 30 21:30:48 2015
@@ -27,9 +27,10 @@
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_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 ---*/
Modified: trunk/coregrind/m_syswrap/syscall-arm64-linux.S
==============================================================================
--- trunk/coregrind/m_syswrap/syscall-arm64-linux.S (original)
+++ trunk/coregrind/m_syswrap/syscall-arm64-linux.S Wed Sep 30 21:30:48 2015
@@ -28,9 +28,10 @@
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_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 ---*/
Modified: trunk/coregrind/m_syswrap/syscall-mips32-linux.S
==============================================================================
--- trunk/coregrind/m_syswrap/syscall-mips32-linux.S (original)
+++ trunk/coregrind/m_syswrap/syscall-mips32-linux.S Wed Sep 30 21:30:48 2015
@@ -28,9 +28,10 @@
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_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 ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_syswrap/syscall-mips64-linux.S
==============================================================================
--- trunk/coregrind/m_syswrap/syscall-mips64-linux.S (original)
+++ trunk/coregrind/m_syswrap/syscall-mips64-linux.S Wed Sep 30 21:30:48 2015
@@ -28,9 +28,10 @@
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_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 ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_syswrap/syscall-ppc32-linux.S
==============================================================================
--- trunk/coregrind/m_syswrap/syscall-ppc32-linux.S (original)
+++ trunk/coregrind/m_syswrap/syscall-ppc32-linux.S Wed Sep 30 21:30:48 2015
@@ -27,9 +27,10 @@
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_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 ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_syswrap/syscall-ppc64be-linux.S
==============================================================================
--- trunk/coregrind/m_syswrap/syscall-ppc64be-linux.S (original)
+++ trunk/coregrind/m_syswrap/syscall-ppc64be-linux.S Wed Sep 30 21:30:48 2015
@@ -27,9 +27,10 @@
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_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 ---*/
Modified: trunk/coregrind/m_syswrap/syscall-ppc64le-linux.S
==============================================================================
--- trunk/coregrind/m_syswrap/syscall-ppc64le-linux.S (original)
+++ trunk/coregrind/m_syswrap/syscall-ppc64le-linux.S Wed Sep 30 21:30:48 2015
@@ -27,9 +27,10 @@
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_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 ---*/
Modified: trunk/coregrind/m_syswrap/syscall-s390x-linux.S
==============================================================================
--- trunk/coregrind/m_syswrap/syscall-s390x-linux.S (original)
+++ trunk/coregrind/m_syswrap/syscall-s390x-linux.S Wed Sep 30 21:30:48 2015
@@ -162,11 +162,11 @@
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 ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_syswrap/syscall-tilegx-linux.S
==============================================================================
--- trunk/coregrind/m_syswrap/syscall-tilegx-linux.S (original)
+++ trunk/coregrind/m_syswrap/syscall-tilegx-linux.S Wed Sep 30 21:30:48 2015
@@ -28,9 +28,10 @@
/* 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_(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 ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_syswrap/syscall-x86-darwin.S
==============================================================================
--- trunk/coregrind/m_syswrap/syscall-x86-darwin.S (original)
+++ trunk/coregrind/m_syswrap/syscall-x86-darwin.S Wed Sep 30 21:30:48 2015
@@ -28,9 +28,10 @@
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_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 ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_syswrap/syscall-x86-linux.S
==============================================================================
--- trunk/coregrind/m_syswrap/syscall-x86-linux.S (original)
+++ trunk/coregrind/m_syswrap/syscall-x86-linux.S Wed Sep 30 21:30:48 2015
@@ -28,9 +28,10 @@
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_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 ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_syswrap/syscall-x86-solaris.S
==============================================================================
--- trunk/coregrind/m_syswrap/syscall-x86-solaris.S (original)
+++ trunk/coregrind/m_syswrap/syscall-x86-solaris.S Wed Sep 30 21:30:48 2015
@@ -28,9 +28,10 @@
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 @@
#endif // defined(VGP_x86_solaris)
+/* Let the linker know we don't need an executable stack */
+MARK_STACK_NO_EXEC
+
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/m_trampoline.S
==============================================================================
--- trunk/coregrind/m_trampoline.S (original)
+++ trunk/coregrind/m_trampoline.S Wed Sep 30 21:30:48 2015
@@ -1599,14 +1599,8 @@
#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 ---*/
Modified: trunk/include/pub_tool_basics_asm.h
==============================================================================
--- trunk/include/pub_tool_basics_asm.h (original)
+++ trunk/include/pub_tool_basics_asm.h Wed Sep 30 21:30:48 2015
@@ -58,6 +58,20 @@
# 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 */
/*--------------------------------------------------------------------*/
|