This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix up -fdwarf2-cfi-asm on ppc/ppc64
- From: Jakub Jelinek <jakub at redhat dot com>
- To: David Edelsohn <dje dot gcc at gmail dot com>, Richard Henderson <rth at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 2 Jun 2009 14:58:52 +0200
- Subject: [PATCH] Fix up -fdwarf2-cfi-asm on ppc/ppc64
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
While working on unwind info for epilogues for rs6000, I've noticed that
-fdwarf2-cfi-asm vs. -fno-dwarf2-cfi-asm generated .eh_frame substantially
differs, e.g. when noting the location of saved cr (after mfcr 12),
-fno-dwarf2-cfi-asm has DW_CFA_register: r70 in r12, while
-fdwarf2-cfi-asm has DW_CFA_register: r64 in r12. Seems weird nobody
reported this yet. After further investigation it seems ppc uses different
register numbering for .eh_frame and .dwarf_frame. Given that .cfi_*
directives generate .eh_frame section, not .dwarf_frame, we should use
register numbers for .eh_frame, not for .dwarf_frame. The patch below
should have no effect except on powerpc* (where it should fix this) and
on i?86-darwin (where gas isn't used and thus output_cfi_directive isn't
ever used).
I'll bootstrap/regtest later tonight, if that passes, is this ok for
trunk/4.4 (given that it is pretty severe ABI issue)?
2009-06-02 Jakub Jelinek <jakub@redhat.com>
* dwarf2out.c (output_cfi_directive): Pass 1 instead of
0 to second argument of DWARF2_FRAME_REG_OUT macros.
--- gcc/dwarf2out.c.jj 2009-06-01 12:32:55.000000000 +0200
+++ gcc/dwarf2out.c 2009-06-02 14:50:03.000000000 +0200
@@ -3089,42 +3089,42 @@ output_cfi_directive (dw_cfi_ref cfi)
case DW_CFA_offset:
case DW_CFA_offset_extended:
case DW_CFA_offset_extended_sf:
- r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 0);
+ r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1);
fprintf (asm_out_file, "\t.cfi_offset %lu, "HOST_WIDE_INT_PRINT_DEC"\n",
r, cfi->dw_cfi_oprnd2.dw_cfi_offset);
break;
case DW_CFA_restore:
case DW_CFA_restore_extended:
- r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 0);
+ r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1);
fprintf (asm_out_file, "\t.cfi_restore %lu\n", r);
break;
case DW_CFA_undefined:
- r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 0);
+ r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1);
fprintf (asm_out_file, "\t.cfi_undefined %lu\n", r);
break;
case DW_CFA_same_value:
- r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 0);
+ r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1);
fprintf (asm_out_file, "\t.cfi_same_value %lu\n", r);
break;
case DW_CFA_def_cfa:
case DW_CFA_def_cfa_sf:
- r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 0);
+ r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1);
fprintf (asm_out_file, "\t.cfi_def_cfa %lu, "HOST_WIDE_INT_PRINT_DEC"\n",
r, cfi->dw_cfi_oprnd2.dw_cfi_offset);
break;
case DW_CFA_def_cfa_register:
- r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 0);
+ r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1);
fprintf (asm_out_file, "\t.cfi_def_cfa_register %lu\n", r);
break;
case DW_CFA_register:
- r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 0);
- r2 = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd2.dw_cfi_reg_num, 0);
+ r = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd1.dw_cfi_reg_num, 1);
+ r2 = DWARF2_FRAME_REG_OUT (cfi->dw_cfi_oprnd2.dw_cfi_reg_num, 1);
fprintf (asm_out_file, "\t.cfi_register %lu, %lu\n", r, r2);
break;
Jakub