fix small const data for riscv

Message ID 20221111130221.541603-1-oriachiuan@gmail.com
State Accepted
Headers
Series fix small const data for riscv |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Oria Chiuan Nov. 11, 2022, 1:02 p.m. UTC
  gcc/testsuite ChangeLog:

2022-11-11  Oria Chen  <oriachiuan@gmail.com>

        * gcc/testsuite/gcc.dg/pr25521.c: Add compile option "-msmall-data-limit=0" to avoid using .srodata section.  
---
 gcc/testsuite/gcc.dg/pr25521.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Andrew Pinski Nov. 11, 2022, 7:56 p.m. UTC | #1
On Fri, Nov 11, 2022 at 5:03 AM Oria Chen via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> gcc/testsuite ChangeLog:
>
> 2022-11-11  Oria Chen  <oriachiuan@gmail.com>
>
>         * gcc/testsuite/gcc.dg/pr25521.c: Add compile option "-msmall-data-limit=0" to avoid using .srodata section.

I noticed g++.dg/cpp0x/constexpr-rom.C has some slightly different
handling here.
Seems like there should be a generic way to add
-G0/-msmall-data-limit=0 if we don't want small data for a testcase
rather than the current scheme of things.

Thanks,
Andrew Pinski

> ---
>  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=0" { target { riscv*-*-* } } } */
>
>  const volatile int foo = 30;
>
> --
> 2.37.2
>
  
Palmer Dabbelt Nov. 11, 2022, 8:34 p.m. UTC | #2
On Fri, 11 Nov 2022 11:56:08 PST (-0800), gcc-patches@gcc.gnu.org wrote:
> On Fri, Nov 11, 2022 at 5:03 AM Oria Chen via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
>>
>> gcc/testsuite ChangeLog:
>>
>> 2022-11-11  Oria Chen  <oriachiuan@gmail.com>
>>
>>         * gcc/testsuite/gcc.dg/pr25521.c: Add compile option "-msmall-data-limit=0" to avoid using .srodata section.
>
> I noticed g++.dg/cpp0x/constexpr-rom.C has some slightly different
> handling here.
> Seems like there should be a generic way to add
> -G0/-msmall-data-limit=0 if we don't want small data for a testcase
> rather than the current scheme of things.

There's also a few tests like these where we modified the regex to match 
.sadata in addition to .data, which fixes the problem on MIPS too.

>
> Thanks,
> Andrew Pinski
>
>> ---
>>  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=0" { target { riscv*-*-* } } } */
>>
>>  const volatile int foo = 30;
>>
>> --
>> 2.37.2
>>
  

Patch

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=0" { target { riscv*-*-* } } } */
 
 const volatile int foo = 30;