From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id 73C823858D37 for ; Thu, 31 Aug 2023 09:05:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 73C823858D37 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1c0d0bf18d7so4076105ad.0 for ; Thu, 31 Aug 2023 02:05:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1693472754; x=1694077554; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=WtiuR0+VPj+8gEFO0YFVIkPmz70t1lCrzEdepKu0XhE=; b=m71c3ozkD/hiWEXgEYn2cg9etiVcTkbhJqfrV1wTYfxdbK6hpHbHwUIBNq07paDlVJ e7owwpXbSMid/qsIwH55VyazJHV1TIv2OM2ucbGwJcXIWUHM2HH0cHw+MB1W9Cm+CPwe o03gk1b1CdzorZQ7vAsZs6T2mNLch7cJ9+ZopTPY3nwhB2e+/ienwLkgTVSdlxH+qxqk qgixzKvBYG3JnOGTzyMYi7k7+uhSMa1fvzSOsMvF+NYA3MyOuYBzk12Wh8guPRnlNyZt qCM5CGA/jVrx9k0kRv9K6pc8FXoyNsHat+YRLfJ49t6M+/hZKJrYerUPc3E+9snBQMbK 1DJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693472754; x=1694077554; 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=WtiuR0+VPj+8gEFO0YFVIkPmz70t1lCrzEdepKu0XhE=; b=JurCSwysksNxlWPQyli8NxteetSretoUCdFR0tRtTmLQQSYAhr93+5MMMI11x6VTZa IW15G3OZR99aiHmtlB6Mz6nADZKXoU49gL1LpvMB74xqBrlhcnuvFb2PuOIvslB/RJ8C tWmHnIGIDe/WHM4vjBmWKA7BtHly+Rs2Keg8eiQl2WE2SJDCUXYe0srrgpiIav9gs4Wg kQc4WQX9LnQ5HsSQjvRu9cw0ztAnLkYRcAujOGaE4Bmbt6maCnkphvT1RE6CFSI1l7mO UvSuAn01w8zc2SK4xmRofH3MltBkKOjPUiKEMG59/iUkXoEY6lwKcIrRKP5t+je0t56E 65mA== X-Gm-Message-State: AOJu0Yxcs/em2yZghS1jSI+0lHFNgqT4HplHni3y2z1MpUsLzCclE6nb uv/jK9S9hJVVUrsIvxjzMHjumoXMMX2PoQlxHZ1mti977FLyAfg22lhjCOGDr22kDZPQL5SZiH0 MEAcp8cjaSL8T88+jyNq4TKXkgmxB/wox4L2xGYsxPKijTGPCyp5WJxnnMKe3l4z2ZPBHi5wuz9 YQFf8= X-Google-Smtp-Source: AGHT+IH+QLVIBHtYZW616o0dXu0mHeIw6SZqDWnBoTZ5vbquZ22BO4C9O/4Q+9YI7BqzeT+TLtasPg== X-Received: by 2002:a17:903:18e:b0:1bb:891b:8bd with SMTP id z14-20020a170903018e00b001bb891b08bdmr4777732plg.34.1693472754083; Thu, 31 Aug 2023 02:05:54 -0700 (PDT) Received: from hsinchu02.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id l11-20020a170902f68b00b001b3bf8001a9sm831012plg.48.2023.08.31.02.05.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Aug 2023 02:05:53 -0700 (PDT) From: Kito Cheng To: gcc-patches@gcc.gnu.org, kito.cheng@gmail.com, palmer@dabbelt.com, jeffreyalaw@gmail.com Cc: Kito Cheng Subject: [PATCH] RISC-V: Emit .note.GNU-stack for non-linux target as well Date: Thu, 31 Aug 2023 17:05:47 +0800 Message-Id: <20230831090547.71737-1-kito.cheng@sifive.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,URIBL_BLACK autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: We only emit that on linux target before, that not problem before, however Qemu has fix a bug to make qemu user mode honor PT_GNU_STACK[1], that will cause problem when we test baremetal with qemu. So the straightforward is enable that as well for non-linux toolchian, the price is that will increase few bytes for each binary. [1] https://github.com/qemu/qemu/commit/872f3d046f2381e3f416519e82df96bd60818311 gcc/ChangeLog: * config/riscv/linux.h (TARGET_ASM_FILE_END): Move ... * config/riscv/riscv.cc (TARGET_ASM_FILE_END): to here. --- gcc/config/riscv/linux.h | 2 -- gcc/config/riscv/riscv.cc | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h index 3e625e0f867..7323ff30f70 100644 --- a/gcc/config/riscv/linux.h +++ b/gcc/config/riscv/linux.h @@ -59,8 +59,6 @@ along with GCC; see the file COPYING3. If not see -dynamic-linker " GNU_USER_DYNAMIC_LINKER "} \ %{static:-static}}" -#define TARGET_ASM_FILE_END file_end_indicate_exec_stack - #define STARTFILE_PREFIX_SPEC \ "/lib" XLEN_SPEC "/" ABI_SPEC "/ " \ "/usr/lib" XLEN_SPEC "/" ABI_SPEC "/ " \ diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index 5dc303f89c7..2b3ab862816 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -9098,6 +9098,8 @@ riscv_frame_pointer_required (void) #define TARGET_ASM_FILE_START riscv_file_start #undef TARGET_ASM_FILE_START_FILE_DIRECTIVE #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true +#undef TARGET_ASM_FILE_END +#define TARGET_ASM_FILE_END file_end_indicate_exec_stack #undef TARGET_EXPAND_BUILTIN_VA_START #define TARGET_EXPAND_BUILTIN_VA_START riscv_va_start -- 2.40.1