[PATCH v3 1/3] include: libsframe: Add API to get total number of FREs

Indu Bhagat indu.bhagat@oracle.com
Fri Jul 25 00:52:28 GMT 2025


On 7/23/25 7:33 AM, Jens Remus wrote:
> On 23.07.2025 15:42, Jan Beulich wrote:
>> On 23.07.2025 15:17, Jens Remus wrote:
>>> This API will be later used by the linker to handle the special case
>>> of a SFrame section that solely contain FDEs without any FREs.  Such
>>> FDEs without any FREs will be used to represent RA undefined.
> 
>>> diff --git a/libsframe/sframe.c b/libsframe/sframe.c
> 
>>> @@ -1499,6 +1499,20 @@ sframe_encoder_get_num_fidx (sframe_encoder_ctx *encoder)
>>>     return num_fdes;
>>>   }
>>>   
>>> +/* Return the number of function row entries in the SFrame encoder
>>> +   ENCODER.  */
>>> +
>>> +uint32_t
>>> +sframe_encoder_get_num_fres (sframe_encoder_ctx *encoder)
>>> +{
>>> +  uint32_t num_fres = 0;
>>> +  sframe_header *ehp = NULL;
>>
>> Just one nit: What's the point of this initializer? Why can't ...
> 
> Doh!  The result of thoughtless copy and paste and minor adaption of
> sframe_encoder_get_num_fidx's code.
> 
>>> +  ehp = sframe_encoder_get_header (encoder);
>>
>> ... this be the initializer right away?
> 
> Makes absolutely sense!  I'll take that into account, unless Indu does
> prefer to omit this new API and let libsframe use ehp->sfh_num_fres
> directly.  The latter could make sense as this new API would only be
> used internally by libsframe.
> 

(This patch may not be necessary in the end, but just to share my opinion.)

I would not add this API.  So far, the usecase seems to be internal 
only, so accessing the field directly or even keeping it even static is 
OK.  Further, if you add this API to master, the libsframe version node 
will be 2.1 (inheritance node of 2.0) which adds the new API.

Thanks
Indu



More information about the Binutils mailing list