* [PATCH] btf: fix PR debug/112656
@ 2023-11-30 22:18 Indu Bhagat
2023-12-01 10:01 ` Jose E. Marchesi
2023-12-01 16:26 ` David Faust
0 siblings, 2 replies; 4+ messages in thread
From: Indu Bhagat @ 2023-11-30 22:18 UTC (permalink / raw)
To: gcc-patches; +Cc: david.faust, jose.marchesi, Indu Bhagat
PR debug/112656 - btf: function prototypes generated with name
With this patch, all BTF_KIND_FUNC_PROTO will appear anonymous in the
generated BTF section.
As noted in the discussion in the bugzilla, the number of
BTF_KIND_FUNC_PROTO types output varies across targets (BPF with -mco-re
vs non-BPF targets). Hence the check in the test case merely checks
that all BTF_KIND_FUNC_PROTO appear anonymous.
gcc/ChangeLog:
PR debug/112656
* btfout.cc (btf_asm_type): Fixup ctti_name for all
BTF types of kind BTF_KIND_FUNC_PROTO.
gcc/testsuite/ChangeLog:
PR debug/112656
* gcc.dg/debug/btf/btf-function-7.c: New test.
Testing notes:
- bootstrapped and reg tested on x86_64
- No regressions in btf.exp on BPF target
---
gcc/btfout.cc | 4 ++++
.../gcc.dg/debug/btf/btf-function-7.c | 19 +++++++++++++++++++
2 files changed, 23 insertions(+)
create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-function-7.c
diff --git a/gcc/btfout.cc b/gcc/btfout.cc
index 1c25404b2c0..a5e0d640e19 100644
--- a/gcc/btfout.cc
+++ b/gcc/btfout.cc
@@ -820,6 +820,10 @@ btf_asm_type (ctf_container_ref ctfc, ctf_dtdef_ref dtd)
btf_kind = BTF_KIND_ENUM64;
}
+ /* PR debug/112656. BTF_KIND_FUNC_PROTO is always anonymous. */
+ if (btf_kind == BTF_KIND_FUNC_PROTO)
+ dtd->dtd_data.ctti_name = 0;
+
dw2_asm_output_data (4, dtd->dtd_data.ctti_name,
"TYPE %" PRIu64 " BTF_KIND_%s '%s'",
get_btf_id (dtd->dtd_type), btf_kind_name (btf_kind),
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-function-7.c b/gcc/testsuite/gcc.dg/debug/btf/btf-function-7.c
new file mode 100644
index 00000000000..b560dc75650
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-function-7.c
@@ -0,0 +1,19 @@
+/* Test BTF for inlined functions.
+
+ See PR/112656 - btf: function prototypes generated with name
+ BTF_KIND_FUNC_PROTO must be anonymous. */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -gbtf -dA" } */
+
+/* { dg-final { scan-assembler-times "BTF_KIND_FUNC_PROTO ''\\(\[0-9a-z\]*\\)'" 0 } } */
+
+static int log_event(const char *event_name, void *dev_ptr)
+{
+ return 666;
+}
+
+int foo ()
+{
+ return log_event ("foobar", ((void *)0));
+}
--
2.41.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] btf: fix PR debug/112656
2023-11-30 22:18 [PATCH] btf: fix PR debug/112656 Indu Bhagat
@ 2023-12-01 10:01 ` Jose E. Marchesi
2023-12-01 10:08 ` Jose E. Marchesi
2023-12-01 16:26 ` David Faust
1 sibling, 1 reply; 4+ messages in thread
From: Jose E. Marchesi @ 2023-12-01 10:01 UTC (permalink / raw)
To: Indu Bhagat; +Cc: gcc-patches, david.faust
Hi Indu.
This is OK. Thanks.
> PR debug/112656 - btf: function prototypes generated with name
>
> With this patch, all BTF_KIND_FUNC_PROTO will appear anonymous in the
> generated BTF section.
>
> As noted in the discussion in the bugzilla, the number of
> BTF_KIND_FUNC_PROTO types output varies across targets (BPF with -mco-re
> vs non-BPF targets). Hence the check in the test case merely checks
> that all BTF_KIND_FUNC_PROTO appear anonymous.
>
> gcc/ChangeLog:
>
> PR debug/112656
> * btfout.cc (btf_asm_type): Fixup ctti_name for all
> BTF types of kind BTF_KIND_FUNC_PROTO.
>
> gcc/testsuite/ChangeLog:
>
> PR debug/112656
> * gcc.dg/debug/btf/btf-function-7.c: New test.
>
>
> Testing notes:
> - bootstrapped and reg tested on x86_64
> - No regressions in btf.exp on BPF target
>
> ---
> gcc/btfout.cc | 4 ++++
> .../gcc.dg/debug/btf/btf-function-7.c | 19 +++++++++++++++++++
> 2 files changed, 23 insertions(+)
> create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-function-7.c
>
> diff --git a/gcc/btfout.cc b/gcc/btfout.cc
> index 1c25404b2c0..a5e0d640e19 100644
> --- a/gcc/btfout.cc
> +++ b/gcc/btfout.cc
> @@ -820,6 +820,10 @@ btf_asm_type (ctf_container_ref ctfc, ctf_dtdef_ref dtd)
> btf_kind = BTF_KIND_ENUM64;
> }
>
> + /* PR debug/112656. BTF_KIND_FUNC_PROTO is always anonymous. */
> + if (btf_kind == BTF_KIND_FUNC_PROTO)
> + dtd->dtd_data.ctti_name = 0;
> +
> dw2_asm_output_data (4, dtd->dtd_data.ctti_name,
> "TYPE %" PRIu64 " BTF_KIND_%s '%s'",
> get_btf_id (dtd->dtd_type), btf_kind_name (btf_kind),
> diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-function-7.c b/gcc/testsuite/gcc.dg/debug/btf/btf-function-7.c
> new file mode 100644
> index 00000000000..b560dc75650
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-function-7.c
> @@ -0,0 +1,19 @@
> +/* Test BTF for inlined functions.
> +
> + See PR/112656 - btf: function prototypes generated with name
> + BTF_KIND_FUNC_PROTO must be anonymous. */
> +
> +/* { dg-do compile } */
> +/* { dg-options "-O2 -gbtf -dA" } */
> +
> +/* { dg-final { scan-assembler-times "BTF_KIND_FUNC_PROTO ''\\(\[0-9a-z\]*\\)'" 0 } } */
> +
> +static int log_event(const char *event_name, void *dev_ptr)
> +{
> + return 666;
> +}
> +
> +int foo ()
> +{
> + return log_event ("foobar", ((void *)0));
> +}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] btf: fix PR debug/112656
2023-12-01 10:01 ` Jose E. Marchesi
@ 2023-12-01 10:08 ` Jose E. Marchesi
0 siblings, 0 replies; 4+ messages in thread
From: Jose E. Marchesi @ 2023-12-01 10:08 UTC (permalink / raw)
To: Indu Bhagat; +Cc: gcc-patches, david.faust
> Hi Indu.
> This is OK. Thanks.
Oops sorry scratch that, I am no reviewer for the BTF area.
Will have to wait for Faust or someone else to chime in :)
>
>> PR debug/112656 - btf: function prototypes generated with name
>>
>> With this patch, all BTF_KIND_FUNC_PROTO will appear anonymous in the
>> generated BTF section.
>>
>> As noted in the discussion in the bugzilla, the number of
>> BTF_KIND_FUNC_PROTO types output varies across targets (BPF with -mco-re
>> vs non-BPF targets). Hence the check in the test case merely checks
>> that all BTF_KIND_FUNC_PROTO appear anonymous.
>>
>> gcc/ChangeLog:
>>
>> PR debug/112656
>> * btfout.cc (btf_asm_type): Fixup ctti_name for all
>> BTF types of kind BTF_KIND_FUNC_PROTO.
>>
>> gcc/testsuite/ChangeLog:
>>
>> PR debug/112656
>> * gcc.dg/debug/btf/btf-function-7.c: New test.
>>
>>
>> Testing notes:
>> - bootstrapped and reg tested on x86_64
>> - No regressions in btf.exp on BPF target
>>
>> ---
>> gcc/btfout.cc | 4 ++++
>> .../gcc.dg/debug/btf/btf-function-7.c | 19 +++++++++++++++++++
>> 2 files changed, 23 insertions(+)
>> create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-function-7.c
>>
>> diff --git a/gcc/btfout.cc b/gcc/btfout.cc
>> index 1c25404b2c0..a5e0d640e19 100644
>> --- a/gcc/btfout.cc
>> +++ b/gcc/btfout.cc
>> @@ -820,6 +820,10 @@ btf_asm_type (ctf_container_ref ctfc, ctf_dtdef_ref dtd)
>> btf_kind = BTF_KIND_ENUM64;
>> }
>>
>> + /* PR debug/112656. BTF_KIND_FUNC_PROTO is always anonymous. */
>> + if (btf_kind == BTF_KIND_FUNC_PROTO)
>> + dtd->dtd_data.ctti_name = 0;
>> +
>> dw2_asm_output_data (4, dtd->dtd_data.ctti_name,
>> "TYPE %" PRIu64 " BTF_KIND_%s '%s'",
>> get_btf_id (dtd->dtd_type), btf_kind_name (btf_kind),
>> diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-function-7.c b/gcc/testsuite/gcc.dg/debug/btf/btf-function-7.c
>> new file mode 100644
>> index 00000000000..b560dc75650
>> --- /dev/null
>> +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-function-7.c
>> @@ -0,0 +1,19 @@
>> +/* Test BTF for inlined functions.
>> +
>> + See PR/112656 - btf: function prototypes generated with name
>> + BTF_KIND_FUNC_PROTO must be anonymous. */
>> +
>> +/* { dg-do compile } */
>> +/* { dg-options "-O2 -gbtf -dA" } */
>> +
>> +/* { dg-final { scan-assembler-times "BTF_KIND_FUNC_PROTO ''\\(\[0-9a-z\]*\\)'" 0 } } */
>> +
>> +static int log_event(const char *event_name, void *dev_ptr)
>> +{
>> + return 666;
>> +}
>> +
>> +int foo ()
>> +{
>> + return log_event ("foobar", ((void *)0));
>> +}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] btf: fix PR debug/112656
2023-11-30 22:18 [PATCH] btf: fix PR debug/112656 Indu Bhagat
2023-12-01 10:01 ` Jose E. Marchesi
@ 2023-12-01 16:26 ` David Faust
1 sibling, 0 replies; 4+ messages in thread
From: David Faust @ 2023-12-01 16:26 UTC (permalink / raw)
To: Indu Bhagat; +Cc: gcc-patches, jose.marchesi
Hi Indu,
On 11/30/23 14:18, Indu Bhagat wrote:
> PR debug/112656 - btf: function prototypes generated with name
>
> With this patch, all BTF_KIND_FUNC_PROTO will appear anonymous in the
> generated BTF section.
>
> As noted in the discussion in the bugzilla, the number of
> BTF_KIND_FUNC_PROTO types output varies across targets (BPF with -mco-re
> vs non-BPF targets). Hence the check in the test case merely checks
> that all BTF_KIND_FUNC_PROTO appear anonymous.
Looks good to me. OK to apply.
Thanks!
>
> gcc/ChangeLog:
>
> PR debug/112656
> * btfout.cc (btf_asm_type): Fixup ctti_name for all
> BTF types of kind BTF_KIND_FUNC_PROTO.
>
> gcc/testsuite/ChangeLog:
>
> PR debug/112656
> * gcc.dg/debug/btf/btf-function-7.c: New test.
>
>
> Testing notes:
> - bootstrapped and reg tested on x86_64
> - No regressions in btf.exp on BPF target
>
> ---
> gcc/btfout.cc | 4 ++++
> .../gcc.dg/debug/btf/btf-function-7.c | 19 +++++++++++++++++++
> 2 files changed, 23 insertions(+)
> create mode 100644 gcc/testsuite/gcc.dg/debug/btf/btf-function-7.c
>
> diff --git a/gcc/btfout.cc b/gcc/btfout.cc
> index 1c25404b2c0..a5e0d640e19 100644
> --- a/gcc/btfout.cc
> +++ b/gcc/btfout.cc
> @@ -820,6 +820,10 @@ btf_asm_type (ctf_container_ref ctfc, ctf_dtdef_ref dtd)
> btf_kind = BTF_KIND_ENUM64;
> }
>
> + /* PR debug/112656. BTF_KIND_FUNC_PROTO is always anonymous. */
> + if (btf_kind == BTF_KIND_FUNC_PROTO)
> + dtd->dtd_data.ctti_name = 0;
> +
> dw2_asm_output_data (4, dtd->dtd_data.ctti_name,
> "TYPE %" PRIu64 " BTF_KIND_%s '%s'",
> get_btf_id (dtd->dtd_type), btf_kind_name (btf_kind),
> diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-function-7.c b/gcc/testsuite/gcc.dg/debug/btf/btf-function-7.c
> new file mode 100644
> index 00000000000..b560dc75650
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/debug/btf/btf-function-7.c
> @@ -0,0 +1,19 @@
> +/* Test BTF for inlined functions.
> +
> + See PR/112656 - btf: function prototypes generated with name
> + BTF_KIND_FUNC_PROTO must be anonymous. */
> +
> +/* { dg-do compile } */
> +/* { dg-options "-O2 -gbtf -dA" } */
> +
> +/* { dg-final { scan-assembler-times "BTF_KIND_FUNC_PROTO ''\\(\[0-9a-z\]*\\)'" 0 } } */
> +
> +static int log_event(const char *event_name, void *dev_ptr)
> +{
> + return 666;
> +}
> +
> +int foo ()
> +{
> + return log_event ("foobar", ((void *)0));
> +}
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-12-01 16:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-30 22:18 [PATCH] btf: fix PR debug/112656 Indu Bhagat
2023-12-01 10:01 ` Jose E. Marchesi
2023-12-01 10:08 ` Jose E. Marchesi
2023-12-01 16:26 ` David Faust
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).