[compiler-rt] r354632 - [sanitizer] Common macro for .note.GNU-stack directives (NFC)

Evgeniy Stepanov via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 21 14:59:29 PST 2019


Author: eugenis
Date: Thu Feb 21 14:59:29 2019
New Revision: 354632

URL: http://llvm.org/viewvc/llvm-project?rev=354632&view=rev
Log:
[sanitizer] Common macro for .note.GNU-stack directives (NFC)

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_asm.h
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_mips64.S
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_x86_64.S
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_aarch64.S
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_amd64.S

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_asm.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_asm.h?rev=354632&r1=354631&r2=354632&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_asm.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_asm.h Thu Feb 21 14:59:29 2019
@@ -55,3 +55,10 @@
 # define ASM_SYMBOL(symbol) _##symbol
 # define ASM_SYMBOL_INTERCEPTOR(symbol) _wrap_##symbol
 #endif
+
+#if defined(__ELF__) && (defined(__GNU__) || defined(__FreeBSD__) || \
+                         defined(__Fuchsia__) || defined(__linux__))
+#define NO_EXEC_STACK_DIRECTIVE .section .note.GNU-stack,"",%progbits // NOLINT
+#else
+#define NO_EXEC_STACK_DIRECTIVE
+#endif

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_mips64.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_mips64.S?rev=354632&r1=354631&r2=354632&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_mips64.S (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_mips64.S Thu Feb 21 14:59:29 2019
@@ -2,10 +2,10 @@
 // See https://llvm.org/LICENSE.txt for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
+#include "sanitizer_common/sanitizer_asm.h"
+
 // Avoid being marked as needing an executable stack:
-#if defined(__linux__) && defined(__ELF__)
-.section .note.GNU-stack,"",%progbits
-#endif
+NO_EXEC_STACK_DIRECTIVE
 
 // Further contents are mips64 only:
 #if defined(__linux__) && defined(__mips64)

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_x86_64.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_x86_64.S?rev=354632&r1=354631&r2=354632&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_x86_64.S (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_x86_64.S Thu Feb 21 14:59:29 2019
@@ -2,10 +2,10 @@
 // See https://llvm.org/LICENSE.txt for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
+#include "sanitizer_common/sanitizer_asm.h"
+
 // Avoid being marked as needing an executable stack:
-#if defined(__linux__) && defined(__ELF__)
-.section .note.GNU-stack,"",%progbits
-#endif
+NO_EXEC_STACK_DIRECTIVE
 
 // Further contents are x86_64-only:
 #if defined(__linux__) && defined(__x86_64__)

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_aarch64.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_aarch64.S?rev=354632&r1=354631&r2=354632&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_aarch64.S (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_aarch64.S Thu Feb 21 14:59:29 2019
@@ -335,9 +335,6 @@ ASM_SYMBOL_INTERCEPTOR(__sigsetjmp):
 ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(__sigsetjmp))
 #endif
 
-#if defined(__linux__)
-/* We do not need executable stack.  */
-.section        .note.GNU-stack,"", at progbits
-#endif
+NO_EXEC_STACK_DIRECTIVE
 
 #endif

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_amd64.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_amd64.S?rev=354632&r1=354631&r2=354632&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_amd64.S (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_amd64.S Thu Feb 21 14:59:29 2019
@@ -389,10 +389,6 @@ ASM_SYMBOL_INTERCEPTOR(__sigsetjmp):
 ASM_SIZE(ASM_SYMBOL_INTERCEPTOR(__sigsetjmp))
 #endif  // !defined(__APPLE__) && !defined(__NetBSD__)
 
-#if defined(__FreeBSD__) || defined(__linux__)
-/* We do not need executable stack.  */
-/* This note is not needed on NetBSD. */
-.section        .note.GNU-stack,"", at progbits
-#endif
+NO_EXEC_STACK_DIRECTIVE
 
 #endif




More information about the llvm-commits mailing list