[libunwind] r277868 - unwind: disable executable stacks

Saleem Abdulrasool via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 5 14:35:28 PDT 2016


Author: compnerd
Date: Fri Aug  5 16:35:28 2016
New Revision: 277868

URL: http://llvm.org/viewvc/llvm-project?rev=277868&view=rev
Log:
unwind: disable executable stacks

Similar to compiler-rt, ensure that we disable executable stacks for the custom
assembly.

Modified:
    libunwind/trunk/src/UnwindRegistersRestore.S
    libunwind/trunk/src/UnwindRegistersSave.S
    libunwind/trunk/src/assembly.h

Modified: libunwind/trunk/src/UnwindRegistersRestore.S
URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindRegistersRestore.S?rev=277868&r1=277867&r2=277868&view=diff
==============================================================================
--- libunwind/trunk/src/UnwindRegistersRestore.S (original)
+++ libunwind/trunk/src/UnwindRegistersRestore.S Fri Aug  5 16:35:28 2016
@@ -488,3 +488,6 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li
    l.nop
 
 #endif
+
+NO_EXEC_STACK_DIRECTIVE
+

Modified: libunwind/trunk/src/UnwindRegistersSave.S
URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindRegistersSave.S?rev=277868&r1=277867&r2=277868&view=diff
==============================================================================
--- libunwind/trunk/src/UnwindRegistersSave.S (original)
+++ libunwind/trunk/src/UnwindRegistersSave.S Fri Aug  5 16:35:28 2016
@@ -468,3 +468,6 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext
   l.sw     120(r3), r30
   l.sw     124(r3), r31
 #endif
+
+NO_EXEC_STACK_DIRECTIVE
+

Modified: libunwind/trunk/src/assembly.h
URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/assembly.h?rev=277868&r1=277867&r2=277868&view=diff
==============================================================================
--- libunwind/trunk/src/assembly.h (original)
+++ libunwind/trunk/src/assembly.h Fri Aug  5 16:35:28 2016
@@ -35,19 +35,34 @@
 #define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name)
 
 #if defined(__APPLE__)
+
 #define SYMBOL_IS_FUNC(name)
+#define NO_EXEC_STACK_DIRECTIVE
+
 #elif defined(__ELF__)
+
 #if defined(__arm__)
 #define SYMBOL_IS_FUNC(name) .type name,%function
 #else
 #define SYMBOL_IS_FUNC(name) .type name, at function
 #endif
+
+#if defined(__GNU__) || defined(__ANDROID__) || defined(__FreeBSD__)
+#define NO_EXEC_STACK_DIRECTIVE .section .note.GNU-stack,"",%progbits
+#else
+#define NO_EXEC_STACK_DIRECTIVE
+#endif
+
 #else
+
 #define SYMBOL_IS_FUNC(name)                                                   \
   .def name SEPARATOR                                                          \
     .scl 2 SEPARATOR                                                           \
     .type 32 SEPARATOR                                                         \
   .endef
+
+#define NO_EXEC_STACK_DIRECTIVE
+
 #endif
 
 #define DEFINE_LIBUNWIND_FUNCTION(name)                   \




More information about the cfe-commits mailing list