> The question is if we should resolve against .debug, when the section is not
> in runtime. In that case, what assures that the section number is meant to
> point to .debug. I mean:
That's a good question. Based on the documentation:
$ man strip
...
--only-keep-debug
Strip a file, emptying the contents of any sections that would not
be stripped by --strip-debug and leaving the debugging sections intact. In ELF
files, this preserves all the note sections in the output as well.
Note - the section headers of the stripped sections are preserved,
including their sizes, but the contents of the section are discarded. The
section headers are preserved so that other tools can match up the debuginfo
file with the real executable, even
if that executable has been relocated to a different address space.
that's why we see sections like .text, .data and others in the separate debug
info ELF file.
Problem is that our symbol points to a section (.debug_info) that is removed
from the original ELF file (for obvious reason).