https://sourceware.org/bugzilla/show_bug.cgi?id=33131

--- Comment #2 from Indu Bhagat <indu.bhagat at oracle dot com> ---
Confirmed.

objdump also hits the same assertion.

$ gdb --args objdump --sframe libffi_convenience.a
...
Breakpoint 2, sframe_decoder_get_fre (ctx=0x72cbd0, func_idx=0, fre_idx=33,
fre=0x7fffffffd980)
    at <src>/binutils-gdb/binutils-gdb/libsframe/sframe.c:1267
1267               sframe_assert (fre->fre_start_addr < fdep->sfde_func_size);
1: fre->fre_start_addr = 255
2: fdep->sfde_func_size = 255

The offending function is in win64.o:

0000000000000000 <ffi_call_win64>:
   0:   48 8b 04 24             mov    (%rsp),%rax
   4:   48 89 2e                mov    %rbp,(%rsi)
   7:   48 89 46 08             mov    %rax,0x8(%rsi)
   ...
  fd:   c9                      leave
  fe:   c3                      ret
  ff:   90                      nop

00000018 000000000000009c 00000000 FDE cie=00000000
pc=0000000000000000..00000000000000ff
  DW_CFA_advance_loc: 14 to 000000000000000e
  DW_CFA_def_cfa: r6 (rbp) ofs 16
  DW_CFA_offset: r6 (rbp) at cfa-16
  DW_CFA_advance_loc1: 83 to 0000000000000061
  DW_CFA_remember_state
  DW_CFA_def_cfa: r7 (rsp) ofs 8
  DW_CFA_restore: r6 (rbp)
  ...
  DW_CFA_advance_loc: 9 to 00000000000000fe
  DW_CFA_remember_state
  DW_CFA_def_cfa: r7 (rsp) ofs 8
  DW_CFA_restore: r6 (rbp)
  DW_CFA_advance_loc: 1 to 00000000000000ff
  DW_CFA_restore_state
  DW_CFA_nop

(See how the size of the function is 0xff and the last advance_loc location is
also 0xff.

Looking at gcc/libffi/src/x86/win64.S, I see that the CFIs involved here are
.cfi_restore_state and .cfi_endproc in the src.

 .globl ffi_call_win64
 .hidden ffi_call_win64


ffi_call_win64:
 .cfi_startproc
 endbr64
 ...
 .align 8
99: call abort@PLT

 leaveq; .cfi_remember_state; .cfi_def_cfa %rsp, 8; .cfi_restore %rbp; ret;
.cfi_restore_state

 .cfi_endproc

We could update the assertion in libsframe to not be so uptight, the nop is
unreachable code.  If gas permits this sequence, SFrame will need to allow too
I guess...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to