Put this in main.c and build it with a 4.4-branch compiler using recent
binutils:

int main ()
{
  return 0;
}

Versions:

GNU assembler (GNU Binutils) 2.19.51.20090611
i686-pc-linux-gnu-gcc (GCC) 4.4.1 20090611 (prerelease)

% i686-pc-linux-gnu-gcc -c main.c; objdump --wide -h main.o | grep ALLOC
  0 .text         0000000a  00000000  00000000  00000034  2**2  CONTENTS,
ALLOC, LOAD, READONLY, CODE
  1 .data         00000000  00000000  00000000  00000040  2**2  CONTENTS,
ALLOC, LOAD, DATA
  2 .bss          00000000  00000000  00000000  00000040  2**2  ALLOC

% i686-pc-linux-gnu-gcc -c -g main.c; objdump --wide -h main.o | grep ALLOC
  0 .text         0000000a  00000000  00000000  00000034  2**2  CONTENTS,
ALLOC, LOAD, READONLY, CODE
  1 .data         00000000  00000000  00000000  00000040  2**2  CONTENTS,
ALLOC, LOAD, DATA
  2 .bss          00000000  00000000  00000000  00000040  2**2  ALLOC
 12 .eh_frame     00000034  00000000  00000000  000001c0  2**2  CONTENTS,
ALLOC, LOAD, RELOC, READONLY, DATA

We're using GAS's .cfi_startproc et cetera directives to generate debug
information.  But they only generate .eh_frame, not .debug_frame.

I also noticed this problem on an ARM EABI target.  ARM EABI does not use
.eh_frame, only .debug_frame and .ARM.exidx.

The easiest fix is to disable use of the CFI directives when we are trying to
generate .debug_frame.  I believe GCC used to generate both .debug_frame and
.eh_frame for the same function.  If we want both to gain the advantages of
using CFI directives (e.g. potentially accurate across inline asm), then we
need to teach gas to emit .debug_frame/.eh_frame/both as requested.


-- 
           Summary: [4.4/4.5 Regression] -g causes GCC to generate .eh_frame
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: drow at gcc dot gnu dot org
GCC target triplet: i686-pc-linux-gnu


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

Reply via email to