diff mbox series

[v2,1/5] btf: fixed type id in BTF_KIND_FUNC struct data.

Message ID 20240227190435.35750-2-cupertino.miranda@oracle.com
State New
Headers show
Series [v2,1/5] btf: fixed type id in BTF_KIND_FUNC struct data. | expand

Commit Message

Cupertino Miranda Feb. 27, 2024, 7:04 p.m. UTC
This patch correct the aditition of +1 on the type id, which originally
was done in the wrong location and leaded to func_sts->dtd_type for
BTF_KIND_FUNCS struct data to contain the type id of the previous entry.

gcc/ChangeLog:

	* btfout.cc (btf_collect_dataset): Corrected BTF type id.
---
 gcc/btfout.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

David Faust Feb. 27, 2024, 8 p.m. UTC | #1
Hi Cupertino,

Just some nits below. Apologies for incoming pedantry.

On 2/27/24 11:04, Cupertino Miranda wrote:
> This patch correct the aditition of +1 on the type id, which originally
> was done in the wrong location and leaded to func_sts->dtd_type for
> BTF_KIND_FUNCS struct data to contain the type id of the previous entry.

Multiple typos here:
  correct -> corrects
  aditition -> addition
  ...leaded to.. -> ..led to..
  func_sts -> func_dtd
  BTF_KIND_FUNCS -> BTF_KIND_FUNC

> 
> gcc/ChangeLog:
> 
> 	* btfout.cc (btf_collect_dataset): Corrected BTF type id.

Please use present tense in the ChangeLog entries, to match GNU style
guidelines and existing entries,
i.e. "Correct..." instead of "Corrected..."

The same goes for the commit header, please use present tense to match
the style of existing commits,
i.e. "btf: fix type id..." instead of "fixed".

The patch itself LGTM, so OK with above changes.
Thanks!

> ---
>  gcc/btfout.cc | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/gcc/btfout.cc b/gcc/btfout.cc
> index dcf751f8fe0d..7e114e224449 100644
> --- a/gcc/btfout.cc
> +++ b/gcc/btfout.cc
> @@ -457,7 +457,8 @@ btf_collect_datasec (ctf_container_ref ctfc)
>        func_dtd->dtd_data.ctti_type = dtd->dtd_type;
>        func_dtd->linkage = dtd->linkage;
>        func_dtd->dtd_name = dtd->dtd_name;
> -      func_dtd->dtd_type = num_types_added + num_types_created;
> +      /* +1 for the sentinel type not in the types map.  */
> +      func_dtd->dtd_type = num_types_added + num_types_created + 1;
>  
>        /* Only the BTF_KIND_FUNC type actually references the name. The
>  	 BTF_KIND_FUNC_PROTO is always anonymous.  */
> @@ -480,8 +481,7 @@ btf_collect_datasec (ctf_container_ref ctfc)
>  
>  	  struct btf_var_secinfo info;
>  
> -	  /* +1 for the sentinel type not in the types map.  */
> -	  info.type = func_dtd->dtd_type + 1;
> +	  info.type = func_dtd->dtd_type;
>  
>  	  /* Both zero at compile time.  */
>  	  info.size = 0;
Cupertino Miranda Feb. 28, 2024, 7:24 p.m. UTC | #2
Corrected and Pushed.

Thanks,
Cupertino

David Faust writes:

> Hi Cupertino,
>
> Just some nits below. Apologies for incoming pedantry.
>
> On 2/27/24 11:04, Cupertino Miranda wrote:
>> This patch correct the aditition of +1 on the type id, which originally
>> was done in the wrong location and leaded to func_sts->dtd_type for
>> BTF_KIND_FUNCS struct data to contain the type id of the previous entry.
>
> Multiple typos here:
>   correct -> corrects
>   aditition -> addition
>   ...leaded to.. -> ..led to..
>   func_sts -> func_dtd
>   BTF_KIND_FUNCS -> BTF_KIND_FUNC
>
>>
>> gcc/ChangeLog:
>>
>> 	* btfout.cc (btf_collect_dataset): Corrected BTF type id.
>
> Please use present tense in the ChangeLog entries, to match GNU style
> guidelines and existing entries,
> i.e. "Correct..." instead of "Corrected..."
>
> The same goes for the commit header, please use present tense to match
> the style of existing commits,
> i.e. "btf: fix type id..." instead of "fixed".
>
> The patch itself LGTM, so OK with above changes.
> Thanks!
>
>> ---
>>  gcc/btfout.cc | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/gcc/btfout.cc b/gcc/btfout.cc
>> index dcf751f8fe0d..7e114e224449 100644
>> --- a/gcc/btfout.cc
>> +++ b/gcc/btfout.cc
>> @@ -457,7 +457,8 @@ btf_collect_datasec (ctf_container_ref ctfc)
>>        func_dtd->dtd_data.ctti_type = dtd->dtd_type;
>>        func_dtd->linkage = dtd->linkage;
>>        func_dtd->dtd_name = dtd->dtd_name;
>> -      func_dtd->dtd_type = num_types_added + num_types_created;
>> +      /* +1 for the sentinel type not in the types map.  */
>> +      func_dtd->dtd_type = num_types_added + num_types_created + 1;
>>
>>        /* Only the BTF_KIND_FUNC type actually references the name. The
>>  	 BTF_KIND_FUNC_PROTO is always anonymous.  */
>> @@ -480,8 +481,7 @@ btf_collect_datasec (ctf_container_ref ctfc)
>>
>>  	  struct btf_var_secinfo info;
>>
>> -	  /* +1 for the sentinel type not in the types map.  */
>> -	  info.type = func_dtd->dtd_type + 1;
>> +	  info.type = func_dtd->dtd_type;
>>
>>  	  /* Both zero at compile time.  */
>>  	  info.size = 0;
diff mbox series

Patch

diff --git a/gcc/btfout.cc b/gcc/btfout.cc
index dcf751f8fe0d..7e114e224449 100644
--- a/gcc/btfout.cc
+++ b/gcc/btfout.cc
@@ -457,7 +457,8 @@  btf_collect_datasec (ctf_container_ref ctfc)
       func_dtd->dtd_data.ctti_type = dtd->dtd_type;
       func_dtd->linkage = dtd->linkage;
       func_dtd->dtd_name = dtd->dtd_name;
-      func_dtd->dtd_type = num_types_added + num_types_created;
+      /* +1 for the sentinel type not in the types map.  */
+      func_dtd->dtd_type = num_types_added + num_types_created + 1;
 
       /* Only the BTF_KIND_FUNC type actually references the name. The
 	 BTF_KIND_FUNC_PROTO is always anonymous.  */
@@ -480,8 +481,7 @@  btf_collect_datasec (ctf_container_ref ctfc)
 
 	  struct btf_var_secinfo info;
 
-	  /* +1 for the sentinel type not in the types map.  */
-	  info.type = func_dtd->dtd_type + 1;
+	  info.type = func_dtd->dtd_type;
 
 	  /* Both zero at compile time.  */
 	  info.size = 0;