Looking for advice for GNU debuglink generation.

Nick Clifton nickc@redhat.com
Tue Jan 26 10:14:44 GMT 2021


Hi Kalamatee,

> I am looking for advice on the generation of gnu debug link information in
> binaries

A good starting place would be the source file bfd/opncls.c which contains
several functions related to separate debug information.  In particular the
find_separate_debug_file() function has heuristics for locating the debug
files.

> The problem we have is our binaries are generated under some directory
> (e.g. /home/test/build/AROS/), which is present in the debug link
> information for all the binaries we generate. Is there some way to define a
> base path that the linker will strip when adding this?

It is the objcopy program rather than the linker which is responsible for
adding the debug links, and it strips *all* of the path components from the
filename before storing it.  (See bfd_create_gnu_debuglink_section() where
it calls lbasename).
  
> In future, we had hoped to move the generated debug information under
> <build dir>/Developer/Debug/dbg - - but again doing so doesn't work because
> it then looks for <build dir>/Developer/Debug/dbg/<biuld dir>/<relative
> path to binary>/<binary>

When you say "it looks for", what is "it" ?  If you mean the objdump program
or readelf then you may need to modify the code in the load_separate_debug_info()
function in binutils/dwarf.c.

Cheers
   Nick





More information about the Binutils mailing list