[LLVMdev] memory hog llvm-ld

Holger Schurig hs4233 at mail.mn-solutions.de
Thu Jul 19 03:57:40 PDT 2007


> LLVM represents debug info as explicit calls to intrinsics.
> This approach has many advantages, but a possible disadvantage
> is that it can significantly increase the size of the bitcode.
> I don't know if that explains your observations.  I'm curious
> to know how gcc stores debug info...

GCC stores debug info in ELF sections of the .o file, e.g.:

$ objdump -h wtd.o

wtd.o:     file format elf32-i386

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00000ef4  00000000  00000000  00000034  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  1 .data         00000000  00000000  00000000  00000f28  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bss          00000000  00000000  00000000  00000f28  2**2
                  ALLOC
  3 .debug_abbrev 0000017e  00000000  00000000  00000f28  2**0
                  CONTENTS, READONLY, DEBUGGING
  4 .debug_info   00001052  00000000  00000000  000010a6  2**0
                  CONTENTS, RELOC, READONLY, DEBUGGING
  5 .debug_line   00000229  00000000  00000000  000020f8  2**0
                  CONTENTS, RELOC, READONLY, DEBUGGING
  6 .rodata       00000161  00000000  00000000  00002324  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  7 .debug_frame  00000140  00000000  00000000  00002488  2**2
                  CONTENTS, RELOC, READONLY, DEBUGGING
  8 .debug_loc    00000210  00000000  00000000  000025c8  2**0
                  CONTENTS, READONLY, DEBUGGING
  9 .debug_pubnames 00000089  00000000  00000000  000027d8  2**0
                  CONTENTS, RELOC, READONLY, DEBUGGING
 10 .debug_aranges 00000020  00000000  00000000  00002861  2**0
                  CONTENTS, RELOC, READONLY, DEBUGGING
 11 .debug_str    0000005b  00000000  00000000  00002881  2**0
                  CONTENTS, READONLY, DEBUGGING
 12 .comment      0000003a  00000000  00000000  000028dc  2**0
                  CONTENTS, READONLY
 13 .note.GNU-stack 00000000  00000000  00000000  00002916  2**0
                  CONTENTS, READONLY

When I compile this file without debug info, I get this:

$ objdump -h wtd.o

wtd.o:     file format elf32-i386

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00000871  00000000  00000000  00000034  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  1 .data         00000000  00000000  00000000  000008a8  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bss          00000000  00000000  00000000  000008a8  2**2
                  ALLOC
  3 .rodata.str1.1 00000157  00000000  00000000  000008a8  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .comment      0000003a  00000000  00000000  000009ff  2**0
                  CONTENTS, READONLY
  5 .note.GNU-stack 00000000  00000000  00000000  00000a39  2**0
                  CONTENTS, READONLY

There are various formats available, e.g. Dwarf and others. I
think this is all handled via libbfd, or you can get more info
by staring at the gdb source.



More information about the llvm-dev mailing list