On 12/30/2021 9:59 AM, Palmer Dabbelt wrote:
On Thu, 30 Dec 2021 08:28:34 PST (-0800), gcc-patches@gcc.gnu.org wrote:


On 12/29/2021 8:02 PM, jiawei wrote:
Add -msmall-data-limit option to put global and static data into right
section and generate 'btt_info' on RISC-V target.

BTF (BPF Type Format) is the metadata format which encodes the debug info related to BPF program/map, more details on: https://www.kernel.org/doc/html/latest/bpf/index.html#bpf-type-format-btf

gcc/testsuite/ChangeLog:

         * gcc.dg/debug/btf/btf-datasec-1.c: Add riscv target support.
Is the goal here to get the variable "d" out of the small data section
and into the standard data section?  It's not clear from your description .

Neither an ACK nor a NAK at this point.  I need to understand better
what you're trying to accomplish.

IIUC that's what this is doing, though the commit message isn't clear at all.  That saind, it might be better to do something like
It might.  My only real hesitation would be if where was some wonky BTF dependency on having the symbols in the normal sections.  But I'd consider that unlikey.

   diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-datasec-1.c b/gcc/testsuite/gcc.dg/debug/btf/btf-datasec-1.c
   index dbb236bbda1..c0ad77d40aa 100644
   --- a/gcc/testsuite/gcc.dg/debug/btf/btf-datasec-1.c
   +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-datasec-1.c
   @@ -22,9 +22,9 @@
    /* { dg-final { scan-assembler-times "0\[\t \]+\[^\n\]*bts_offset" 7 } } */        /* Check that strings for each DATASEC have been added to the BTF string table.  */    -/* { dg-final { scan-assembler-times "ascii \".data.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */    -/* { dg-final { scan-assembler-times "ascii \".rodata.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */    -/* { dg-final { scan-assembler-times "ascii \".bss.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */    +/* { dg-final { scan-assembler-times "ascii \".[s]?data.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */    +/* { dg-final { scan-assembler-times "ascii \".[s]?rodata.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */    +/* { dg-final { scan-assembler-times "ascii \".[s]?bss.0\"\[\t \]+\[^\n\]*btf_aux_string" 1 } } */
       int a;
    long long b;

as whether specific symbols end up in .data or .sdata is really just an optimization and either should be sufficiently correct.
Probably missing some escapes in your variant (the brackets). Jiawei, could you try Palmer suggestion to verify it works for you?


IIRC some targets have other flavors of these, PPC's .sdata2 comes to mind.  Not sure if we'd need that to drop their -msdata=none flag.
I'd expect them to continue to work as-is.  We could potentially drop those flags as a separate patch after suitable testing.

jeff

Reply via email to