xtensa: add .note.GNU-stack section on linux
authorMax Filippov <jcmvbkbc@gmail.com>
Thu, 2 Mar 2023 17:45:41 +0000 (09:45 -0800)
committerMax Filippov <jcmvbkbc@gmail.com>
Mon, 13 Mar 2023 20:42:18 +0000 (13:42 -0700)
gcc/
* config/xtensa/linux.h (TARGET_ASM_FILE_END): New macro.

libgcc/
* config/xtensa/crti.S: Add .note.GNU-stack section on linux.
* config/xtensa/crtn.S: Likewise.
* config/xtensa/lib1funcs.S: Likewise.
* config/xtensa/lib2funcs.S: Likewise.

gcc/config/xtensa/linux.h
libgcc/config/xtensa/crti.S
libgcc/config/xtensa/crtn.S
libgcc/config/xtensa/lib1funcs.S
libgcc/config/xtensa/lib2funcs.S

index dc4d547..e684e7d 100644 (file)
@@ -69,3 +69,5 @@ along with GCC; see the file COPYING3.  If not see
 #define XTENSA_ALWAYS_PIC 1
 
 #undef DEBUGGER_REGNO
+
+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
index b88df50..6372035 100644 (file)
 
 #include "xtensa-config-builtin.h"
 
+/* An executable stack is *not* required for these functions.  */
+#if defined(__ELF__) && defined(__linux__)
+.section .note.GNU-stack,"",%progbits
+.previous
+#endif
+
        .section .init
        .globl _init
        .type _init,@function
index 7f27166..15c13ea 100644 (file)
 
 #include "xtensa-config-builtin.h"
 
+/* An executable stack is *not* required for these functions.  */
+#if defined(__ELF__) && defined(__linux__)
+.section .note.GNU-stack,"",%progbits
+.previous
+#endif
+
        .section .init
 #if XCHAL_HAVE_WINDOWED && !__XTENSA_CALL0_ABI__
        retw
index a3f17b6..5baf2df 100644 (file)
@@ -25,6 +25,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 #include "xtensa-config-builtin.h"
 
+/* An executable stack is *not* required for these functions.  */
+#if defined(__ELF__) && defined(__linux__)
+.section .note.GNU-stack,"",%progbits
+.previous
+#endif
+
 /* Define macros for the ABS and ADDX* instructions to handle cases
    where they are not included in the Xtensa processor configuration.  */
 
index e038e41..992f712 100644 (file)
@@ -25,6 +25,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 #include "xtensa-config-builtin.h"
 
+/* An executable stack is *not* required for these functions.  */
+#if defined(__ELF__) && defined(__linux__)
+.section .note.GNU-stack,"",%progbits
+.previous
+#endif
+
 /* __xtensa_libgcc_window_spill: This function flushes out all but the
    current register window.  This is used to set up the stack so that
    arbitrary frames can be accessed.  */