[PATCH 3/4] gas: sframe: handle .cfi_undefined

Jens Remus jremus@linux.ibm.com
Tue May 13 08:36:36 GMT 2025


Hello Indu!

On 12.05.2025 20:55, Indu Bhagat wrote:
> On 5/12/25 1:47 AM, Jens Remus wrote:
>> On 11.05.2025 09:35, Indu Bhagat wrote:
>>> Fix PR gas/32952 - sframe: incorrect handling of .cfi_undefined in gas
>>>
>>> In context of SFrame generation, it is incorrect to simply ignore all
>>> .cfi_undefined.  We may ignore only those .cfi_undefined which are for
>>> registers of no interest (similar to whats done for other CFI
>>> directives).
>>
>> Is this a first step towards representing .cfi_undefined <RA>
>> in SFrame as either (potentially starting with SFrame V3):
>> 1. empty FDE (i.e. FDE without any FREs) or
>> 2. FRE without offsets?
>>
> 
> Yes.
> 
> I am still unsure about whether it should be #1 or #2 above.  I have a
> patch for #1, and so far I think we do not need the flexibility provided
> by #2: What does it mean to have an FDE with one FRE designating
> "outermost frame" and other FREs with valid stack trace information;
> there cannot be such a case IIUC..

I tend to agree.  It's just that DWARF provides this flexibility, which
SFrame would not with option #1.

Initially I thought Glibc clone and clone3 would be samples, where
unwinding is possible until reaching thread_start, for instance on
x86-64:

sysdeps/unix/sysv/linux/s390/s390-64/clone.S
sysdeps/unix/sysv/linux/s390/s390-64/clone3.S

But it is being worked around by putting thread_start into a separate
FDE.


N.B.: Unrelated but also interesting for SFrame is Glibc longjmp.  The
x86-64 implementation does emit CFI for the target, effectively
switching to another CFA:

sysdeps/x86_64/__longjmp.S

This is according to specification.  See probes longjmp and
longjmp_terget in Glibc manual/probes.texi.  Although I think this
violates DWARF, which requires the CFA to be constant:

  "(By definition, the CFA value does not change.)"

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