[PATCH v2 08/11] s390: Store SFrame CFA offset adjusted
Jens Remus
jremus@linux.ibm.com
Tue Jun 3 15:19:13 GMT 2025
Hello Indu,
thank you for your review feedback!
On 02.06.2025 22:46, Indu Bhagat via Binutils wrote:
> On 5/27/25 4:07 AM, Jens Remus wrote:
>> In SFrame V2 the size of the offsets following an SFrame FRE can be
>> either signed 8-bit, 16-bit, or 32-bit integer, which the largest offset
>> determining their size:
>> 1. CFA offset from CFA base register
>> 2. RA (stack save slot) offset from CFA, usually -48 on s390x if saved
>> 3. FP (stack save slot) offset from CFA, usually -72 on s390x if saved
>> The FP and RA offsets from CFA, when FP/RA saved on the stack, usually
>> have fixed values that fit into signed 8-bit SFrame offsets. Likewise
>> the DWARF register numbers on s390x of general registers (GR; 0-15) and
>> floating-point registers (FPR; 16-31), when FP/RA saved in registers.
>> With that the CFA offset from CFA base register has the greatest impact
>> on the signed SFrame offset size.
>>
>> The s390x ELF ABI [1] defines the CFA as stack pointer (SP) at call
>> site +160. [2] Therefore the minimum CFA offset from CFA base register
>> on s390x is 160. This does not fit into a signed 8-bit integer and
>> therefore effectively prevents any use of signed 8-bit SFrame offsets
>> on s390x.
>>
>> For s390x store the CFA offset from CFA base register adjusted by -160
>> to enable the use of signed 8-bit SFrame offsets.
>>
>> [1]: s390x ELF ABI, https://github.com/IBM/s390x-abi/releases
>> [2]: s390x ELF ABI, commit 4e38ad9c8a88 ("Document the CFA"),
>> https://github.com/IBM/s390x-abi/commit/4e38ad9c8a88
> SFrame specific implementation looks good to me. One question below.
> It will be good to double check in case we have overlooked something.
Will do.
>
>> Suggested-by: Indu Bhagat <indu.bhagat@oracle.com>
>> Signed-off-by: Jens Remus <jremus@linux.ibm.com>
>
>
> Reviewed-by: Indu Bhagat <indu.bhagat@oracle.com>
Thanks!
>> Notes (jremus):
>> Changes in V2:
>> - Reword commit message (s390 to s390x, offsets, FDE to FRE). (Indu)
>> - Rename s390x-specific macros from *_S390_* to *_S390X_*. (Indu)
>> - Use "s390x" instead of "S390" in comments and SFrame spec. (Indu)
>> - Change order of CFA restore instructions in SFrame spec. (Indu)
>> - Update new libsframe test plt-findfre-2.
>> A test build of Glibc tag 2.41 on s390x libc.so shows a ~8.8% reduction in
>> .sframe section size due to storing the SFrame CFA offsets adjusted by
>> -160.
>> Statistics for libc.so - base (no CFA offset adjustment):
>> .sframe size: 169,749 bytes
>> VALUE TOTAL MIN MAX AVG
>> FDEs: 3652 - - -
>> FREs/FDE: 15236 1 20 4
>> Offsets/FDE: 29792 1 38 8
>> 8-bit: 0 0 0 0
>> 16-bit: 29792 1 38 8
>> 32-bit: 0 0 0 0
>> Offsets/FRE: 29792 1 3 1
>> 8-bit: - 0 0 0
>> 16-bit: - 1 3 1
>> 32-bit: - 0 0 0
>> O_Padd/FDE: 342 - - 0
>> 8-bit: 0
>> 16-bit: 342
>> 32-bit: 0
>> Statistics for libc.so - CFA offset adjustment:
>> .sframe size: 154,757 bytes
>> VALUE TOTAL MIN MAX AVG
>> FDEs: 3654 - - -
>
> Hmm, why would the number of FDEs shift (3652 above vs 3654 now) with
> this sort of experiment.
Good catch! I guess I erroneously mixed the output of some old and new
Glibc test builds. I will repeat them to make sure there is nothing
else going on.
>
>> FREs/FDE: 15238 1 20 4
>> Offsets/FDE: 29794 1 38 8
>> 8-bit: 14992 1 38 4
>> 16-bit: 14802 0 0 4
>> 32-bit: 0 0 0 0
>> Offsets/FRE: 29794 2 6 1
>> 8-bit: - 1 3 0
>> 16-bit: - 1 3 0
>> 32-bit: - 0 0 0
>> O_Padd/FDE: 342 - - 0
>> 8-bit: 283
>> 16-bit: 59
>> 32-bit: 0
>> Changes in V2:
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