Re: [PATCH] btf: Fix up btf-datasec-1.c test on x86

2024-03-27 Thread David Faust
Hi Jakub,

On 3/27/24 04:16, Jakub Jelinek wrote:
> On Wed, Mar 27, 2024 at 11:18:49AM +0100, Jakub Jelinek wrote:
>>> -/* The offset entry for each variable in a DATSEC should be 0 at compile 
>>> time.  */
>>> -/* { dg-final { scan-assembler-times "0\[\t \]+\[^\n\]*bts_offset" 7 } } */
>>> +/* The offset entry for each variable in a DATSEC should contain a label.  
>>> */
>>> +/* { dg-final { scan-assembler-times ".4byte\[\t \]\[a-e\]\[\t 
>>> \]+\[^\n\]*bts_offset" 5 } } */
>>
>> 4byte is used only on some targets, what exact assembler directive is used
>> for 4byte unaligned data is heavily target dependent.
> 
> Now in patch form, tested on x86_64-linux with
> make check-gcc RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} btf.exp'
> ok for trunk?

OK.
Thank you for fixing these.

> 
> 2024-03-27  Jakub Jelinek  
> 
>   * gcc.dg/debug/btf/btf-cvr-quals-1.c: Use dg-additional-options
>   instead of multiple dg-options.
>   * gcc.dg/debug/btf/btf-datasec-1.c: Likewise.  Accept all supported
>   unaligned 4 byte assembler directives rather than assuming it must
>   be .4byte.
> 
> --- gcc/testsuite/gcc.dg/debug/btf/btf-cvr-quals-1.c.jj   2021-07-12 
> 22:57:26.056103708 +0200
> +++ gcc/testsuite/gcc.dg/debug/btf/btf-cvr-quals-1.c  2024-03-27 
> 12:09:25.383278017 +0100
> @@ -23,7 +23,7 @@
>  
>  /* { dg-do compile } */
>  /* { dg-options "-O0 -gbtf -dA" } */
> -/* { dg-options "-O0 -gbtf -gdwarf-4 -dA" { target { *-*-darwin* } } } */
> +/* { dg-additional-options "-gdwarf-4" { target { *-*-darwin* } } } */
>  
>  /* { dg-final { scan-assembler-times "ascii \"int.0\"\[\t 
> \]+\[^\n\]*btf_string" 1 } } */
>  
> --- gcc/testsuite/gcc.dg/debug/btf/btf-datasec-1.c.jj 2024-03-26 
> 22:34:47.925757342 +0100
> +++ gcc/testsuite/gcc.dg/debug/btf/btf-datasec-1.c2024-03-27 
> 12:12:09.761045873 +0100
> @@ -11,16 +11,16 @@
>  
>  /* { dg-do compile )  */
>  /* { dg-options "-O0 -gbtf -dA" } */
> -/* { dg-options "-O0 -gbtf -dA -msdata=none" { target { { powerpc*-*-* } && 
> ilp32 } } } */
> -/* { dg-options "-O0 -gbtf -dA -msmall-data-limit=0" { target { riscv*-*-* } 
> } } */
> -/* { dg-options "-O0 -gbtf -dA -G0" { target { nios2-*-* } } } */
> +/* { dg-additional-options "-msdata=none" { target { { powerpc*-*-* } && 
> ilp32 } } } */
> +/* { dg-additional-options "-msmall-data-limit=0" { target { riscv*-*-* } } 
> } */
> +/* { dg-additional-options "-G0" { target { nios2-*-* } } } */
>  
>  /* Check for two DATASEC entries with vlen 3, and one with vlen 1.  */
>  /* { dg-final { scan-assembler-times "0xf03\[\t \]+\[^\n\]*btt_info" 2 } 
> } */
>  /* { dg-final { scan-assembler-times "0xf01\[\t \]+\[^\n\]*btt_info" 1 } 
> } */
>  
>  /* The offset entry for each variable in a DATSEC should contain a label.  */
> -/* { dg-final { scan-assembler-times ".4byte\[\t \]\[a-e\]\[\t 
> \]+\[^\n\]*bts_offset" 5 } } */
> +/* { dg-final { scan-assembler-times 
> "(?:(?:\\.4byte|\\.long|data4\\.ua|\\.ualong|\\.uaword|\\.dword|long|dc\\.l|\\.word)\[\t
>  \]|\\.vbyte\t4,\[\t \]?)\[a-e\]\[\t \]+\[^\n\]*bts_offset" 5 } } */
>  /* { dg-final { scan-assembler-times "my_cstruct\[\t \]+\[^\n\]*bts_offset" 
> 1 } } */
>  /* { dg-final { scan-assembler-times "bigarr\[\t \]+\[^\n\]*bts_offset" 1 } 
> } */
>  
> 
>   Jakub
> 


[PATCH] btf: Fix up btf-datasec-1.c test on x86

2024-03-27 Thread Jakub Jelinek
On Wed, Mar 27, 2024 at 11:18:49AM +0100, Jakub Jelinek wrote:
> > -/* The offset entry for each variable in a DATSEC should be 0 at compile 
> > time.  */
> > -/* { dg-final { scan-assembler-times "0\[\t \]+\[^\n\]*bts_offset" 7 } } */
> > +/* The offset entry for each variable in a DATSEC should contain a label.  
> > */
> > +/* { dg-final { scan-assembler-times ".4byte\[\t \]\[a-e\]\[\t 
> > \]+\[^\n\]*bts_offset" 5 } } */
> 
> 4byte is used only on some targets, what exact assembler directive is used
> for 4byte unaligned data is heavily target dependent.

Now in patch form, tested on x86_64-linux with
make check-gcc RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} btf.exp'
ok for trunk?

2024-03-27  Jakub Jelinek  

* gcc.dg/debug/btf/btf-cvr-quals-1.c: Use dg-additional-options
instead of multiple dg-options.
* gcc.dg/debug/btf/btf-datasec-1.c: Likewise.  Accept all supported
unaligned 4 byte assembler directives rather than assuming it must
be .4byte.

--- gcc/testsuite/gcc.dg/debug/btf/btf-cvr-quals-1.c.jj 2021-07-12 
22:57:26.056103708 +0200
+++ gcc/testsuite/gcc.dg/debug/btf/btf-cvr-quals-1.c2024-03-27 
12:09:25.383278017 +0100
@@ -23,7 +23,7 @@
 
 /* { dg-do compile } */
 /* { dg-options "-O0 -gbtf -dA" } */
-/* { dg-options "-O0 -gbtf -gdwarf-4 -dA" { target { *-*-darwin* } } } */
+/* { dg-additional-options "-gdwarf-4" { target { *-*-darwin* } } } */
 
 /* { dg-final { scan-assembler-times "ascii \"int.0\"\[\t 
\]+\[^\n\]*btf_string" 1 } } */
 
--- gcc/testsuite/gcc.dg/debug/btf/btf-datasec-1.c.jj   2024-03-26 
22:34:47.925757342 +0100
+++ gcc/testsuite/gcc.dg/debug/btf/btf-datasec-1.c  2024-03-27 
12:12:09.761045873 +0100
@@ -11,16 +11,16 @@
 
 /* { dg-do compile )  */
 /* { dg-options "-O0 -gbtf -dA" } */
-/* { dg-options "-O0 -gbtf -dA -msdata=none" { target { { powerpc*-*-* } && 
ilp32 } } } */
-/* { dg-options "-O0 -gbtf -dA -msmall-data-limit=0" { target { riscv*-*-* } } 
} */
-/* { dg-options "-O0 -gbtf -dA -G0" { target { nios2-*-* } } } */
+/* { dg-additional-options "-msdata=none" { target { { powerpc*-*-* } && ilp32 
} } } */
+/* { dg-additional-options "-msmall-data-limit=0" { target { riscv*-*-* } } } 
*/
+/* { dg-additional-options "-G0" { target { nios2-*-* } } } */
 
 /* Check for two DATASEC entries with vlen 3, and one with vlen 1.  */
 /* { dg-final { scan-assembler-times "0xf03\[\t \]+\[^\n\]*btt_info" 2 } } 
*/
 /* { dg-final { scan-assembler-times "0xf01\[\t \]+\[^\n\]*btt_info" 1 } } 
*/
 
 /* The offset entry for each variable in a DATSEC should contain a label.  */
-/* { dg-final { scan-assembler-times ".4byte\[\t \]\[a-e\]\[\t 
\]+\[^\n\]*bts_offset" 5 } } */
+/* { dg-final { scan-assembler-times 
"(?:(?:\\.4byte|\\.long|data4\\.ua|\\.ualong|\\.uaword|\\.dword|long|dc\\.l|\\.word)\[\t
 \]|\\.vbyte\t4,\[\t \]?)\[a-e\]\[\t \]+\[^\n\]*bts_offset" 5 } } */
 /* { dg-final { scan-assembler-times "my_cstruct\[\t \]+\[^\n\]*bts_offset" 1 
} } */
 /* { dg-final { scan-assembler-times "bigarr\[\t \]+\[^\n\]*bts_offset" 1 } } 
*/
 

Jakub