From patchwork Mon Mar 13 20:45:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 66321 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8B1CB3858430 for ; Mon, 13 Mar 2023 20:45:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8B1CB3858430 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678740348; bh=12FDAz9iZy6WUeaeM8qBD6FR+Awb1mzQQ8vLHtw5gr0=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=R7qJvAW3imYvmSBpMUIwSzp2rJmf9+TDWCxg5lBIPbkNpujqLCctFBh17R0rh88SH g/+Ak1+IkjYKp8D9VDp757h824v0f0G3fM0kpOQquKOX9F0NciWL8ZIGb3aCdHs7Ah RWWsIY0vURLc+k8hoVULRawVTk7ONf0NmG7bErkU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by sourceware.org (Postfix) with ESMTPS id D217E3858D32 for ; Mon, 13 Mar 2023 20:45:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D217E3858D32 Received: by mail-pj1-x102b.google.com with SMTP id k18-20020a17090a591200b0023d36e30cb5so122099pji.1 for ; Mon, 13 Mar 2023 13:45:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678740318; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=12FDAz9iZy6WUeaeM8qBD6FR+Awb1mzQQ8vLHtw5gr0=; b=LlMYpkz4tNnSR+e9OgF5D3kkso4Bi2+DyFQ+1ZSvYz18ccHjPUVBR3K9RuT9Jgjy7k k7hatvkx+yDnSvQDipSgi3ZghdPAGD2fFcGEiOMQNiavOVcTP97uAzGR9qt/KW6xWpZk 0itLNC7PKrmXO/YZxoslKT3m9Tyc+L7Rj5ghSwGUvs1X9Nw2zK6ozLgn3+vGZp3ylGCL rKdw8R1LJXyl3uzbRZwRnZzfQ06yG3EodkPktyoABdSDHwiwvIJyPqkDjxqFX76KyFaQ QLmlWQU+qtaSTR2Q0fk1bZ/fQaeH9HdsXlZ52xnz/dgbri4vLwfa5cgWWRFLlK4cWQGO DhXA== X-Gm-Message-State: AO0yUKVAWQ9op8kBfrLa9xQAhI8WmhelfYqgtSLsR8AhT9vtwC6FOuyN Y7t+/ziPdFECaR7InA2DpLb5s7MqPS8= X-Google-Smtp-Source: AK7set+1eDUZHWt9kZPJxk0WB50JHjNR17+wyT64dcUFmi8qRKsNu2PaC1W91/S9/rX+CTaS8dKkBw== X-Received: by 2002:a17:903:2290:b0:19a:c65d:f90 with SMTP id b16-20020a170903229000b0019ac65d0f90mr45278922plh.44.1678740318350; Mon, 13 Mar 2023 13:45:18 -0700 (PDT) Received: from octofox.hsd1.ca.comcast.net ([2601:641:401:1d20:47c6:db6e:4562:ae83]) by smtp.gmail.com with ESMTPSA id u15-20020a17090a400f00b00233864f21a7sm248659pjc.51.2023.03.13.13.45.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Mar 2023 13:45:17 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Max Filippov Subject: [COMMITTED] xtensa: add .note.GNU-stack section on linux Date: Mon, 13 Mar 2023 13:45:10 -0700 Message-Id: <20230313204510.1908188-1-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, FROM_LOCAL_NOVOWEL, GIT_PATCH_0, HK_RANDOM_ENVFROM, HK_RANDOM_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Max Filippov via Gcc-patches From: Max Filippov Reply-To: Max Filippov Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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 | 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 dc4d547fc5fd..e684e7deebf9 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 b88df50207b6..637203500c41 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 7f271660f942..15c13ea03d0d 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 a3f17b6b2cbc..5baf2df1d20e 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 e038e41eb6f1..992f712238c4 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. */