http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53380

--- Comment #3 from msharov at users dot sourceforge.net 2012-05-22 11:21:41 
UTC ---
> Did -fno-asynchronous-unwind-tables do what you wanted it to do?  In that
> disable the unwinding tables when not using exceptions?

No, it did not. For example:

#include <stdio.h>
int calculate (int x, int y) { return (x * y); }
void print (void) { printf ("%d", calculate(1,2)); }
int main (void) { print(); return (0); }

g++ -Os -c -fno-asynchronous-unwind-tables -o tes.o tes.cc
readelf --debug-dump=frames tes.o

Contents of the .eh_frame section:

00000000 00000014 00000000 CIE
  Version:               1
  Augmentation:          "zR"
  Code alignment factor: 1
  Data alignment factor: -8
  Return address column: 16
  Augmentation data:     1b

  DW_CFA_def_cfa: r7 (rsp) ofs 8
  DW_CFA_offset: r16 (rip) at cfa-8
  DW_CFA_nop
  DW_CFA_nop

00000018 00000010 0000001c FDE cie=00000000 pc=00000000..00000006
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop

0000002c 00000010 00000030 FDE cie=00000000 pc=00000006..00000017
  DW_CFA_nop
  DW_CFA_nop
  DW_CFA_nop

00000040 00000014 00000044 FDE cie=00000000 pc=00000000..0000000a
  DW_CFA_advance_loc: 1 to 00000001
  DW_CFA_def_cfa_offset: 16
  DW_CFA_advance_loc: 8 to 00000009
  DW_CFA_def_cfa_offset: 8
  DW_CFA_nop

As you can see, all three functions still have unwind entries emitted.
According to documentation I saw on the web, -fno-asynchronous-unwind-tables
increases unwind information granularity to function-level, meaning that it
supposedly avoids stepping cfa unless there is a function call there. While I
don't regularly read the unwind tables, I was under impression that this was
happening by default.

Reply via email to