From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vk1-xa35.google.com (mail-vk1-xa35.google.com [IPv6:2607:f8b0:4864:20::a35]) by sourceware.org (Postfix) with ESMTPS id 59EC8384F6EB for ; Fri, 18 Nov 2022 05:22:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 59EC8384F6EB Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-vk1-xa35.google.com with SMTP id g26so1908710vkm.12 for ; Thu, 17 Nov 2022 21:22:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=G3Um9cidq0BSIDKLdwl4B9VWSJq72rylkafgq1OMKzU=; b=QevGZdZ8EwfbPe68yfH7l+KiX2Q0Wd5yRaMOxNVLFWvlkHNGrj17as7K6VCr+Mvwtu y4woj+Vnurm6WyvYT+usYNHNOJdxMoOmlBz80D3NHwqPU7eoPXgekmE/4WJV8uVpIFbz ioe5jdNiSOntynY+0UcN5rVFQlxHS3e80Kamf6SxVzj+tdIcFCHKsO6s7QxGc3XAdZM9 XXE4JgEhKR3+Mhtl5+XNzFPaKAZZ13zSvj0Top1MlXlhi11W/jcL01AOejNCofuRrIbZ W4xNDfjCx6RdNBtVGejXRz/+4r/lzxj6xaR7e4QHL8UodEkJwn4tMTiIQCgNjW0PbTke Cycg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=G3Um9cidq0BSIDKLdwl4B9VWSJq72rylkafgq1OMKzU=; b=YfHzD67UZeJuPiOp8o7FRKZsUb+jCltigdpvL5CMSYU54VQjLXXgPQWGU794UyT1wz DG4K/byWubki3o8vgZ2le9ZtT5Et6VEPsUrEz/kHoDVXV1+L1tWH8PaTpxtffjgEfFTF a41UeYPri8SIsbkkYG5rtALSgRCg2nTZPm/PZifSZ+tr+eaKz6rnzVOocXFig2fsPHAW LCY1dza4zpY6QWRCz1B8Vy1e4kPKqGuKRPd85RcWDPxXhRf1hUxDGry6Jk3hbyNTY5Tc QJtCL+44V1W/j6oS2e7RGR5O94LvlG7typkIxFHpzCX5Zrvz23dSokGK4tKtIMYRemyi W6xQ== X-Gm-Message-State: ANoB5pn+HhxjFJeNflxP6juk08JY00O/1ehknuooE1GIx/LFAF2gdlNP OaI21yzzk8Of2chM/mmc2DIgj9D15rIZF0II5Dzg0jWG3b2zVFJHkPg= X-Google-Smtp-Source: AA0mqf5senkAftJplp0r6dXTDL5FSpLF56MFHNGy1S5qytW6tTvPHwNu2vlAa3UqVDdJdf239GB/PbP7BmNOlUTjhcs= X-Received: by 2002:a1f:21c8:0:b0:3b7:6a89:4530 with SMTP id h191-20020a1f21c8000000b003b76a894530mr3236901vkh.37.1668748927598; Thu, 17 Nov 2022 21:22:07 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Oria Chiuan Date: Fri, 18 Nov 2022 13:21:56 +0800 Message-ID: Subject: Re: [PATCH] Ver.2: Add compile option "-msmall-data-limit=0" to avoid using .srodata section for riscv. To: Palmer Dabbelt Cc: Andrew Waterman , Kito Cheng , chenyixuan@iscas.ac.cn, gcc-patches@gcc.gnu.org, jiawei@iscas.ac.cn Content-Type: multipart/alternative; boundary="0000000000000c868905edb7e305" X-Spam-Status: No, score=-8.9 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,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: --0000000000000c868905edb7e305 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thank you very much for your patient explanation=EF=BC=81 Palmer Dabbelt =E4=BA=8E2022=E5=B9=B411=E6=9C=8818=E6= =97=A5 =E5=91=A8=E4=BA=9413:02=E5=86=99=E9=81=93=EF=BC=9A > On Thu, 17 Nov 2022 19:30:23 PST (-0800), oriachiuan@gmail.com wrote: > > Got it, I used to regard this test case as targeting at test if the con= st > > data would use the ".rodata" section. > > Sorry, I'm not quite sure what you're trying to say here. Here's a dump > of how I see things: > > In some targets (RISC-V and MIPS) there's multiple copies of the > data/rodata sections, with the small data/rodata ending up in the small > sections (`.sdata` and `.srodata`). I've never actually been 100% on > that being allowed by any spec, but MIPS did it long before RISC-V so I > figure software is expected to tolerate the oddness. > > In RISC-V we use it to try and place as many symbols as possible close > to GP, so we're more likely to relax to GP-relative addressing > sequences. IIRC that's pretty much the same as MIPS, though they have > slightly different addressing requirements. > > For targets that function this way `.srodata` and `.rodata` are > functionally equivalent (assuming you're not playing any GP tricks to > relocate, but those are way out of what's supported). So unless the > test is trying to dig into performance issues differences between these > sections, it should just allow code to target either. > > > > > Palmer Dabbelt =E4=BA=8E2022=E5=B9=B411=E6=9C=8818= =E6=97=A5=E5=91=A8=E4=BA=94 07:59=E5=86=99=E9=81=93=EF=BC=9A > > > >> On Thu, 17 Nov 2022 13:50:00 PST (-0800), gcc-patches@gcc.gnu.org > wrote: > >> > > >> > On 11/17/22 02:53, Yixuan Chen wrote: > >> >> 2022-11-17 Yixuan Chen > >> >> > >> >> * gcc/testsuite/gcc.dg/pr25521.c: Add compile option > >> "-msmall-data-limit=3D0" to avoid using .srodata section for riscv. > >> >> --- > >> >> gcc/testsuite/gcc.dg/pr25521.c | 3 ++- > >> >> 1 file changed, 2 insertions(+), 1 deletion(-) > >> >> > >> >> diff --git a/gcc/testsuite/gcc.dg/pr25521.c > >> b/gcc/testsuite/gcc.dg/pr25521.c > >> >> index 74fe2ae6626..628ddf1a761 100644 > >> >> --- a/gcc/testsuite/gcc.dg/pr25521.c > >> >> +++ b/gcc/testsuite/gcc.dg/pr25521.c > >> >> @@ -2,7 +2,8 @@ > >> >> sections. > >> >> > >> >> { dg-require-effective-target elf } > >> >> - { dg-do compile } */ > >> >> + { dg-do compile } > >> >> + { dg-options "-msmall-data-limit=3D0" { target { riscv*-*-* } }= } > */ > >> >> > >> >> const volatile int foo =3D 30; > >> >> > >> > > >> > Wouldn't this be better? It avoids a target specific conditional by > >> > instead extending what we look for to cover [s]rodata sections. > >> > > >> > > >> > Thoughts? > >> > > >> > Jeff > >> > diff --git a/gcc/testsuite/gcc.dg/pr25521.c > >> b/gcc/testsuite/gcc.dg/pr25521.c > >> > index 74fe2ae6626..63363a03b9f 100644 > >> > --- a/gcc/testsuite/gcc.dg/pr25521.c > >> > +++ b/gcc/testsuite/gcc.dg/pr25521.c > >> > @@ -7,4 +7,4 @@ > >> > const volatile int foo =3D 30; > >> > > >> > > >> > -/* { dg-final { scan-assembler "\\.rodata" } } */ > >> > +/* { dg-final { scan-assembler "\\.s\?rodata" } } */ > >> > >> That's how I usually do it for these tests, there's some other targets > >> with sdata too so it fixes the test for everyone. IIRC I said somethi= ng > >> like that in the v1, but sorry if I'm just getting it confused with so= me > >> other patch. > >> > >> There's a few of these that need to get chased down for every release, > >> maybe we should add some sort of DG hepler? Not sure that'd keep folks > >> from matching on .data, though... > >> > --0000000000000c868905edb7e305--