$ install/bin/arm-none-linux-gnueabi-gcc --version arm-none-linux-gnueabi-gcc (GCC) 4.5.0 20091214 (experimental) [...]
This GCC contains the following patch for gcc/config/arm/arm.c: @@ -1877,7 +1877,8 @@ arm_override_options (void) debug info. However this also creates the .eh_frame section, so disable them until GAS can handle this properly. See PR40521. */ - if (TARGET_AAPCS_BASED) + if (TARGET_AAPCS_BASED + && !getenv("GCC_ALLOW_CFI")) flag_dwarf2_cfi_asm = 0; GCC created incorrect CFI: $ cat d.c void foo(void) { register int r7 asm("r7"); asm volatile ("" : : "r" (r7) : "memory"); } $ GCC_ALLOW_CFI= install/bin/arm-none-linux-gnueabi-gcc -g -O -c -o d.o d.c $ install/bin/arm-none-linux-gnueabi-objdump -dr d.o d.o: file format elf32-littlearm Disassembly of section .text: 00000000 <foo>: 0: e52d7004 push {r7} ; (str r7, [sp, #-4]!) 4: e8bd0080 pop {r7} 8: e12fff1e bx lr $ install/bin/arm-none-linux-gnueabi-readelf -wf d.o Contents of the .debug_frame section: 00000000 0000000c ffffffff CIE Version: 1 Augmentation: "" Code alignment factor: 2 Data alignment factor: -4 Return address column: 14 DW_CFA_def_cfa: r13 ofs 0 00000010 00000014 00000000 FDE cie=00000000 pc=00000000..0000000c DW_CFA_advance_loc: 4 to 00000004 DW_CFA_def_cfa_offset: 4 DW_CFA_advance_loc: 8 to 0000000c DW_CFA_offset: r7 at cfa-4 DW_CFA_nop DW_CFA_nop The .cfi_offset r7, -4 belongs at pos. 4, not 0xc. Also, for correctness, GCC should emit .cfi_adjust_cfa_offset -4 and .cfi_restore r7 at pos. 8, see PR42403. -- Summary: Incorrect CFI generated Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: tschwinge at gcc dot gnu dot org GCC target triplet: arm-none-linux-gnueabi http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42404