update dwarf2 asm unwind info [hppa64-*-* failures]

John David Anglin dave@hiauly1.hia.nrc.ca
Sat Aug 23 21:14:00 GMT 2008


> @@ -57,39 +57,39 @@
> 	 
>  000000c8 00000018 000000cc FDE cie=00000000 pc=000000a8..000000d8
>    DW_CFA_advance_loc: 8 to 000000b0
> -  DW_CFA_def_cfa_offset_sf: -64
> +  DW_CFA_def_cfa_offset_sf: -16
> +  DW_CFA_advance_loc: 20 to 000000c4
>    DW_CFA_offset: r4 at cfa+0
>    DW_CFA_offset_extended_sf: r2 at cfa-20
>    DW_CFA_nop
>    DW_CFA_nop
> -  DW_CFA_nop
> 
>  000000e4 00000018 000000e8 FDE cie=00000000 pc=000000d8..00000144
>    DW_CFA_advance_loc: 12 to 000000e4
> -  DW_CFA_def_cfa_offset_sf: -64
> +  DW_CFA_def_cfa_offset_sf: -16
> 
> The first difference is the code alignment factor.  It seems this
> is hard-coded to 1 in dwarf2out.c.
> 
> It looks like the offset of -16 is wrong:
> 
>         .cfi_startproc
> _Unwind_DeleteException:
> 	.PROC
> 	.CALLINFO FRAME=64,CALLS,SAVE_RP,ENTRY_GR=3
> 	.ENTRY
> 	stw %r2,-20(%r30)
> 	stwm %r4,64(%r30)
> 	.cfi_def_cfa_offset -16

Comparatively, with -fno-dwarf2-asm, the .eh_frame output is

        .byte   0x13
	.sleb128 -16

So, both bits of code output an "offset" of -16.  It seems gas doesn't
have a .cfi_def_cfa_offset_sf directive, yet the ".cfi_def_cfa_offset -16"
encodes the value with DW_CFA_def_cfa_offset_sf when the value is negative.

I see the following code in dw2gencfi.c:

    case DW_CFA_def_cfa_offset:
      offset = insn->u.i;
      if (offset < 0)
	{
	  out_one (DW_CFA_def_cfa_offset_sf);
	  out_sleb128 (offset / DWARF2_CIE_DATA_ALIGNMENT);
	}
      else
        {
	  out_one (DW_CFA_def_cfa_offset);
	  out_uleb128 (offset);
	}

As can be seen, gas is dividing DWARF2_CIE_DATA_ALIGNMENT when the
offset is negative.  GCC is also dividing by the data alignment.
So, which is wrong?

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)



More information about the Gcc-patches mailing list