From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by sourceware.org (Postfix) with ESMTPS id 967A93858D28 for ; Wed, 6 Sep 2023 02:58:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 967A93858D28 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-lf1-x136.google.com with SMTP id 2adb3069b0e04-500c37d479aso5045408e87.2 for ; Tue, 05 Sep 2023 19:58:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1693969082; x=1694573882; darn=gcc.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=AQjjjFKZbIOaFoTXrT9ATpy5IFG+Tu7Gc2kjxS3gH7Q=; b=kQ9YuaDfREhdiF0xrxLYXcTENYe2LofX1XRomsJEpjl/uNdJe5i4scG6aD/TsHFWS6 9ZnGG3hL6EGxvCpLve+a/l1OM2PH7duGkgQfNwG3YT38HIrVr7LWj1wtEkZW1Ap7mOwU OzBj63Qojl9aLWrccpn8nnoZyS/ChHS54XYxejqGafIutLO58P3L5GohI0DyJR5v5g2P 6jU3WkduZSBLT22gt6/U6wR+J3tmxIgpUtWYZJhYoq2QDeGRe3AfsxdeF6jO+6tSK3rU Gxz8K/lwCWHwwfTJvCnIw9OLpsMrhqjH72D9O+T7eSqljRJ9/YTv5bjCTHROfUluUyFj kiFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693969082; x=1694573882; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=AQjjjFKZbIOaFoTXrT9ATpy5IFG+Tu7Gc2kjxS3gH7Q=; b=lM17FIHd/hIN2BCZ1w3U1FlkAiCUHYfMVqs21y+UCXwTASL8hhDhr+crnUmh8XHNvR PTtim1nLDrDjEoYgkiGFqu8jdGoL3f37BxCIldxGgkbv0j6tO8eP1VnFMk1PujAbClMm jE9OlRlUZ2QMj6q3P2ghIERdtgINC6paQ7lfV9qOKS9PGBpAkFd2VCxU6zthnCLDTwg4 Xpsrjhc6bbBJ8G65HIbcG/FmFNV04jNsUjpj87El7EBBUSP9y7TW+P9TKLryZg6LvX+C OUwClAnRcdsbtd++8S6rOy3ROFu1DhVkykshkDXCBbd/Dz0h+JiUS0ruaRX6ai/CDScE iWEQ== X-Gm-Message-State: AOJu0YyblPLWK22upPWZX2G2V7TJbo67VmIOx1AZzIA5xTiM0rtpo/iI D4bwkB+4o8487EaN8jJsi0YrFa9HNho//flReFu7fQ== X-Google-Smtp-Source: AGHT+IHW+3Rrtwud959wCTGpsslPi1jGqb5goi3ByrfFf0NBiOESoxFzzkuddod+CS/lPbpEA1ShSG59Ibp5ZgxXZq4= X-Received: by 2002:ac2:5f51:0:b0:4fe:7dcb:4150 with SMTP id 17-20020ac25f51000000b004fe7dcb4150mr1094825lfz.67.1693969081966; Tue, 05 Sep 2023 19:58:01 -0700 (PDT) MIME-Version: 1.0 References: <20230831090547.71737-1-kito.cheng@sifive.com> In-Reply-To: From: Kito Cheng Date: Wed, 6 Sep 2023 10:57:50 +0800 Message-ID: Subject: Re: [PATCH] RISC-V: Emit .note.GNU-stack for non-linux target as well To: Fangrui Song Cc: Kito Cheng , Jeff Law , GCC Patches Content-Type: multipart/alternative; boundary="0000000000006444e50604a7e9b7" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,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 List-Id: --0000000000006444e50604a7e9b7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable RISC-V qemu default that to false, which mean stack can't execute anything by default, that's match RISC-V linux kernel behaviour, but the problem is risc-v bare metal toolchain may execute code on stack *without* that tag, that does not cause problems before for running tests on qemu user mode, but...it causes problems once using newer qemu (with that patch). Fangrui Song =E6=96=BC 2023=E5=B9=B49=E6=9C=886=E6=97= =A5 =E9=80=B1=E4=B8=89 04:53 =E5=AF=AB=E9=81=93=EF=BC=9A > On Tue, Sep 5, 2023 at 5:14=E2=80=AFAM Kito Cheng via Gcc-patches < > gcc-patches@gcc.gnu.org> wrote: > >> committed, thanks :) >> >> On Tue, Sep 5, 2023 at 3:18=E2=80=AFPM Jeff Law via Gcc-patches >> wrote: >> > >> > >> > >> > On 8/31/23 03:05, Kito Cheng wrote: >> > > 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 toolchia= n, >> > > the price is that will increase few bytes for each binary. >> > > >> > > [1] >> https://github.com/qemu/qemu/commit/872f3d046f2381e3f416519e82df96bd6081= 8311 >> > > >> > > gcc/ChangeLog: >> > > >> > > * config/riscv/linux.h (TARGET_ASM_FILE_END): Move ... >> > > * config/riscv/riscv.cc (TARGET_ASM_FILE_END): to here. >> > OK. >> > jeff >> > > Does > https://github.com/qemu/qemu/commit/872f3d046f2381e3f416519e82df96bd60818= 311 > use #define EXSTACK_DEFAULT true > for riscv? > > > > > -- > =E5=AE=8B=E6=96=B9=E7=9D=BF > --0000000000006444e50604a7e9b7--