[PATCH v4 1/4] gas: ld: libsframe: Support for SFrame FDEs without any FREs

Jens Remus jremus@linux.ibm.com
Tue Jul 29 15:03:44 GMT 2025


On 7/29/2025 11:06 AM, Jens Remus wrote:
> On 7/29/2025 8:49 AM, Indu Bhagat wrote:
>> On 7/25/25 9:23 AM, Jens Remus wrote:

>>> diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c
> 
>>> @@ -651,12 +651,18 @@ output_sframe_funcdesc (symbolS *start_of_fre_section,
>>>                     sfde_func_size));
>>>       /* Offset to the first frame row entry.  */
>>> -  exp.X_op = O_subtract;
>>> -  exp.X_add_symbol = fre_symbol; /* Minuend.  */
>>> -  exp.X_op_symbol = start_of_fre_section; /* Subtrahend.  */
>>> -  exp.X_add_number = 0;
>>> -  emit_expr (&exp, sizeof_member (sframe_func_desc_entry,
>>> -                  sfde_func_start_fre_off));
>>> +  if (sframe_fde->num_fres == 0)
>>> +    /* SFrame FDEs without any FREs have a FRE offset of zero.  */
> 
> This comment should be in sync with the one below.  At least for this
> patch.

Reworking my commits I realized that your suggestion for an updated
comment makes very much sense here, as the mentioned field name could
be grepped for.

>>> +    out_four (0);
>>> +  else
>>> +    {
>>> +      exp.X_op = O_subtract;
>>> +      exp.X_add_symbol = fre_symbol; /* Minuend.  */
>>> +      exp.X_op_symbol = start_of_fre_section; /* Subtrahend.  */
>>> +      exp.X_add_number = 0;
>>> +      emit_expr (&exp, sizeof_member (sframe_func_desc_entry,
>>> +                      sfde_func_start_fre_off));
>>> +    }
>>>       /* Number of FREs.  */
>>>     out_four (sframe_fde->num_fres);

>>> diff --git a/libsframe/sframe.c b/libsframe/sframe.c
>>> @@ -1903,6 +1903,13 @@ sframe_encoder_write_sframe (sframe_encoder_ctx *encoder)
>>>         fre_type = sframe_get_fre_type (fdep);
>>>         num_fres = fdep->sfde_func_num_fres;
>>>   +      /* FDEs without any FDEs have a FRE offset of zero.  */
>>
>> Perhaps reword for clarity:
>>
>> For FDES without any FREs, set sfde_func_start_fre_off to zero.
> 
> Wouldn't the comment then just duplicate the following line(s) of code?
> What about:
> 
>       /* FDEs without any FREs have an offset to first FRE of zero.  */

Using your suggestion in both places.

>>> +      if (num_fres == 0)
>>> +    fdep->sfde_func_start_fre_off = 0;
>>> +
Regards,
Jens
-- 
Jens Remus
Linux on Z Development (D3303)
+49-7031-16-1128 Office
jremus@de.ibm.com

IBM

IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Böblingen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/



More information about the Binutils mailing list