Thank you very much for your example! I have sent a new patch according to your guide.
"Jeff Law" <jeffreya...@gmail.com>wrote: > > On 11/17/22 02:53, Yixuan Chen wrote: > > 2022-11-17 Yixuan Chen <chenyix...@iscas.ac.cn> > > > > * gcc/testsuite/gcc.dg/pr25521.c: Add compile option > > "-msmall-data-limit=0" 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=0" { target { riscv*-*-* } } } */ > > > > const volatile int foo = 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