[V2 18/36] [SFrame-V3] gas: sframe: output new FDE type SFRAME_FDE_TYPE_FLEX

Jens Remus jremus@linux.ibm.com
Tue Jan 13 09:20:14 GMT 2026


On 1/13/2026 10:13 AM, Indu Bhagat wrote:
> On 1/13/26 12:31 AM, Jens Remus wrote:
>> On 1/13/2026 3:06 AM, Indu Bhagat wrote:
>>> On 1/12/26 2:28 AM, Jens Remus wrote:


>>>> C) Flex FDE FRE offset decoding logic when using single padding offset
>>>>      but allowing trailing padding offsets:
>>>>
>>>>           if (offset_count < 2)
>>>>                   return -EFAULT;
>>>>           UNSAFE_GET_USER_INC(cfa_reg, cur, offset_size, Efault);
>>>>           UNSAFE_GET_USER_INC(cfa_off, cur, offset_size, Efault);
>>
>> Above reads CFA control data and offset into cfa_reg and cfa_off.
>>
>>>>           offset_count -= 2;
>>>>           cfa_off = sframe_cfa_offset_decode(cfa_off);
>>>>
>>>>           ra_off = sec->fp_off;
> 
> ra_off = sec->ra_off ?

Fixed, thanks!

>>>>           ra_reg = ra_off ? 2 : 0; /* deref_p=(ra_off != 0) */
>>
>> Above initializes RA offset in ra_off to fixed RA offset and deduces
>> RA control data in ra_reg to have deref_p set if the RA offset is not
>> SFRAME_CFA_FIXED_RA_INVALID (= zero).
>>
>>>>           if (offset_count) {
>>>>                   UNSAFE_GET_USER_INC(ra_reg, cur, offset_size, Efault);
>>
>> Above reads RA contol data into ra_reg.
>>
>>>>                   offset_count--;
>>>>                   if (ra_reg) {
>>>>                           if (!offset_count)   <-- additional test required
>>>>                                   return -EFAULT;
>>>>                           UNSAFE_GET_USER_INC(ra_off, cur, offset_size, Efault);
>>
>> Above reads RA offset into ra_off.
>>
>>>>                           offset_count--;
>>>>                   } else {
>>>>                           /* Padding RA location info */
>>>>                           ra_off = sec->ra_off;
>>>>                           if (ra_off)
>>>>                                   ra_reg = 2; /* deref_p=(ra_off != 0) */
>>
>> Above sets RA offset to fixed RA offset and deduces RA control data.
>> I realized that setting ra_off is not required as it was not touched
>> since initialization to the fixed RA offset.  Only the RA control
>> data needs to be re-deduced, as it got overwritten with the padding
>> "offset".
>>
>>>>                   }
>>>>           }
>>>>
>>>
>>> (I assume the comments /* deref_p=(ra_off != 0) */ are merely some
>>> stub/testing comment.  We do need to get
>>> SFRAME_V3_FLEX_FDE_OFFSET_REG_DEREF_P (ra_reg) for deref_p...)
>>
>> No, they are not.  Whenever the fixed default RA/FP offset is used
>> the control data in ra_reg needs to be deduced, specifically deref_p
>> from whether the offset not SFRAME_CFA_FIXED_{FP|RA}_INVALID (= zero).
>> reg_p is always cleared when a fixed FP/RA offset is used.
>>
>> Whenever control data is read from the FDE location data that is used
>> of course.
>>
>> regnum, deref_p, and reg_p for CFA/FP/RA are later extracted from
>> cfa_reg/cfa_off, ra_reg/ra_off, and fp_reg/fp_off.
>>
> 
> Thanks for explaining. Makes sense.
Regards,
Jens
-- 
Jens Remus
Linux on Z Development (D3303)
jremus@de.ibm.com / jremus@linux.ibm.com

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



More information about the Binutils mailing list