[coreboot] debugging symbols for final ROM image
c-d.hailfinger.devel.2006 at gmx.net
Mon Apr 21 02:05:39 CEST 2008
On 21.04.2008 01:22, Jeremy Jackson wrote:
> On Mon, 2008-04-21 at 00:04 +0200, Carl-Daniel Hailfinger wrote:
>> Is there a way to strip out the debugging information from an image
>> compiled with -g? I would like to have an image without debugging info,
>> especially for the bootblock and initram because both are uncompressed
>> and storing uncompressed debug info in a ROM is a total waste of space.
>> The debugging info for each LAR member can be stored in a separate
>> (always compressed) member.
> There is the question of including the debug symbols in the ROM
> (compiler default), provided with the ROM in a separate file (put both
> in a .tgz for distribution from a website), or offering as a separate
> download. There's probably a use case for all 3, so configure/build
> Debian/Ubuntu has separate -dbg packages for some things, which contain
> the debug symbol files. (separate from the .so libraries) The man page
> for "strip" suggests:
> $ objcopy --only-keep-debug foo foo.dbg
> $ objcopy --strip-debug foo
> $ objcopy --add-gnu-debuglink=foo.dbg foo
Well, it's not that easy AFAICS. The bootblock is very sensitive to
offset and code location differences and unless some magic happens, the
chance to break the boot block by stripping out debug symbols that were
compiled in is really big.
>> By the way, the debugging info is similar to one of the pet projects I
>> have: Providing a symbol file for the boot block, enabling people to
>> build initram and stage2 against a given bootblock.
> This sounds like a special case, but in general, "there's nothing new
> under the sun" and compilers/assemblers/linkers do this every day...
> wouldn't that just be a matter of providing the .o/.a object file
> and/or .h header file?
Yes, but the challenge is to pack only the essential linker information
in a file with minimum size so that shipping it in the ROM does not take
away a sizable amount of space. I have some scripts which perform a few
objcopy/nm/... calls and hand-patch ELF files to create truly minimal
symbol tables which also compress well and can be used by ld.
If you are willing to sacrifice lots of ROM space and/or make symbol
tables available for download only and/or write your own linker, my
solution does not apply.
More information about the coreboot