Re: Why kernel make obj file with debug info ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Wow...happy new year, and nice to hear from you again Mulyadi!!!

On Fri, Jan 2, 2009 at 8:59 PM, Mulyadi Santosa
<mulyadi.santosa@xxxxxxxxx> wrote:
> On Tue, Dec 30, 2008 at 9:17 AM, pl ice <telent997@xxxxxxxxx> wrote:
>> Hi buddy,
>>       I found kernel use Kbuild to make obj-file,and I objdumped
>> these obj file and found they all had section .debug. I think they
>> will make building kernel use much more time.why these
>> obj file compile to debug version?
>
> I check that .debug sections are created whenever you use gcc to
> create new object file. I guess you mistakenly assume they were the
> sections used  by gdb to debug the binary, not they are not.
>

First I used gcc on a C file, and both object and elf output does not
have any debug related information after "objdump -x".

Next I used "gcc -g" on the C file, and both the object and ELF output
have lots of debug related information, something like the following
(which is "objdump -x vmlinux"):

 39 .debug_aranges 0000c7d0  00000000  00000000  004bac78  2**3
 40 .debug_pubnames 0003e96f  00000000  00000000  004c7448  2**0
 41 .debug_info   0308daa6  00000000  00000000  00505db7  2**0
 42 .debug_abbrev 001525c5  00000000  00000000  0359385d  2**0
 43 .debug_line   00295fa6  00000000  00000000  036e5e22  2**0
 44 .debug_frame  0008dd30  00000000  00000000  0397bdc8  2**2
 45 .debug_str    00114de3  00000000  00000000  03a09af8  2**0
 46 .debug_loc    0033f6b8  00000000  00000000  03b1e8db  2**0
 47 .debug_ranges 0007f728  00000000  00000000  03e5df93  2**0
00000000 l    d  .debug_aranges 00000000 .debug_aranges
00000000 l    d  .debug_pubnames        00000000 .debug_pubnames
00000000 l    d  .debug_info    00000000 .debug_info
00000000 l    d  .debug_abbrev  00000000 .debug_abbrev
00000000 l    d  .debug_line    00000000 .debug_line
00000000 l    d  .debug_frame   00000000 .debug_frame
00000000 l    d  .debug_str     00000000 .debug_str
00000000 l    d  .debug_loc     00000000 .debug_loc
00000000 l    d  .debug_ranges  00000000 .debug_ranges
RELOCATION RECORDS FOR [.debug_aranges]:
00000006 R_386_32          .debug_info
0000045e R_386_32          .debug_info
0000047e R_386_32          .debug_info
0000049e R_386_32          .debug_info

And so the key difference is "-g".

Looking into Makefile in root directory of kernel source:

ifdef CONFIG_DEBUG_INFO
KBUILD_CFLAGS   += -g
KBUILD_AFLAGS   += -gdwarf-2
endif

So after all it should be CONFIG_DEBUG_INFO which resulted in these
debug section.

> If you don't need them, simply use "strip".

yes, u are right, after "strip"-ping, everything is gone.

>
> regards,
>
> Mulyadi.



-- 
Regards,
Peter Teoh

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux