On Mon, 2009-12-14 at 19:18 +0100, Thomas Schwinge wrote: > Hello! > > I noticed the following on ARM, GCC trunk -- didn't check yet whether it > is ARM-specific; may be a general issue. > > Hacking out the forcing-off of emitting CFI statements in arm.c, I see > the following function prologue emitted (-O -g): > > .text > .Ltext0: > .cfi_sections .debug_frame > .align 2 > .global foo > .type foo, %function > foo: > .LFB0: > .file 1 "c.c" > .loc 1 2 0 > .cfi_startproc > @ args = 0, pretend = 0, frame = 0 > @ frame_needed = 0, uses_anonymous_args = 0 > stmfd sp!, {r3, lr} > .LCFI0: > .cfi_def_cfa_offset 8 > .loc 1 4 0 > mov r0, #33 > .cfi_offset 14, -4 > .cfi_offset 3, -8 > bl bar > [...] > > Comparing this to -pg: > > .LCFI0: > .cfi_def_cfa_offset 8 > + push {lr} > + bl __gnu_mcount_nc > .loc 1 4 0 > mov r0, #33 > > Shouldn't ``.cfi_adjust_cfa_offset 4'' or equivalent be emitted, too? If > I'm interpreting the .debug_frame correctly that is generated directly by > GCC without using CFI statemnts, it seems to have the same problem. Or > am I misunderstanding something?
__gnu_mcount_nc is magic, it will pop that stack value before returning; so while there's a slight inconsistency for those two instructions, everything will be correct for the main body of the function. I'm not sure what other architectures do in this case. Do they also put out adjustments to the cfi? Any, this isn't the right place for this; could you raise a bug report in bugzilla please? R.