public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Max Filippov <jcmvbkbc@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-6644] xtensa: add .note.GNU-stack section on linux
Date: Mon, 13 Mar 2023 20:44:19 +0000 (GMT)	[thread overview]
Message-ID: <20230313204419.9CFCD3858412@sourceware.org> (raw)

https://gcc.gnu.org/g:6360bf9a2d08f08c151464c77c0da53cd702ff25

commit r13-6644-g6360bf9a2d08f08c151464c77c0da53cd702ff25
Author: Max Filippov <jcmvbkbc@gmail.com>
Date:   Thu Mar 2 09:45:41 2023 -0800

    xtensa: add .note.GNU-stack section on linux
    
    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.

Diff:
---
 gcc/config/xtensa/linux.h        | 2 ++
 libgcc/config/xtensa/crti.S      | 6 ++++++
 libgcc/config/xtensa/crtn.S      | 6 ++++++
 libgcc/config/xtensa/lib1funcs.S | 6 ++++++
 libgcc/config/xtensa/lib2funcs.S | 6 ++++++
 5 files changed, 26 insertions(+)

diff --git a/gcc/config/xtensa/linux.h b/gcc/config/xtensa/linux.h
index dc4d547fc5f..e684e7deebf 100644
--- a/gcc/config/xtensa/linux.h
+++ b/gcc/config/xtensa/linux.h
@@ -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
diff --git a/libgcc/config/xtensa/crti.S b/libgcc/config/xtensa/crti.S
index b88df50207b..637203500c4 100644
--- a/libgcc/config/xtensa/crti.S
+++ b/libgcc/config/xtensa/crti.S
@@ -26,6 +26,12 @@
 
 #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
diff --git a/libgcc/config/xtensa/crtn.S b/libgcc/config/xtensa/crtn.S
index 7f271660f94..15c13ea03d0 100644
--- a/libgcc/config/xtensa/crtn.S
+++ b/libgcc/config/xtensa/crtn.S
@@ -27,6 +27,12 @@
 
 #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
diff --git a/libgcc/config/xtensa/lib1funcs.S b/libgcc/config/xtensa/lib1funcs.S
index a3f17b6b2cb..5baf2df1d20 100644
--- a/libgcc/config/xtensa/lib1funcs.S
+++ b/libgcc/config/xtensa/lib1funcs.S
@@ -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.  */
 
diff --git a/libgcc/config/xtensa/lib2funcs.S b/libgcc/config/xtensa/lib2funcs.S
index e038e41eb6f..992f712238c 100644
--- a/libgcc/config/xtensa/lib2funcs.S
+++ b/libgcc/config/xtensa/lib2funcs.S
@@ -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.  */

                 reply	other threads:[~2023-03-13 20:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230313204419.9CFCD3858412@sourceware.org \
    --to=jcmvbkbc@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).