This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Partial linking problems on ELF32 PPC

On Sat, Dec 28, 2002 at 01:42:58AM -0800, Ranjit Deshpande wrote:
> Hello,
> I've run into this problem while using partial linking with multiple object
> files where the DWARF2 .debug_info section incorrectly tells me that a
> string is at offset X in the merged .debug_str section. I do think that the
> correct offset is present in rela.debug_info but none of the tools (objdump,
> readelf or gdb) use this information.
> Included below is the output from readelf -wi ./foo.o. I've chopped off the
> uninteresting bits. Notice the DW_AT_name attribute for DW_TAG_compile_unit.
> It shows the correct file name for the first CU, but the latter CU's are
> screwed up. I have 3 objects: main.o main1.o main2.o and the link command
> is:
> $ ld -r -o foo.o main.o main1.o main2.o
> What I have noticed is that the .debug_info section contains offsets into
> .debug_str that are no longer valid after the merge.
> I claim complete ignorance of how all of this works and the fact that the
> rela.debug_info shows the offset into .debug_str correctly makes me think
> that the offset is not completely lost after merging the .debug_info and
> debug_str sections from the 3 objects.
> However readelf and objdump both do not take the rela.debug_info into
> account.

Now this is peculiar.  I swear that I fixed this - it wasn't in 2.13.1,
but it should ave been in the current snapshot.  No, looking back at it
it looks like I only fixed the abbrev offsets.  Apparently I forgot to
finish what I started.

The correct fix for this is to call
bfd_simple_get_relocated_section_contents from readelf (and objdump).

> And being lazy, I wonder if Daniel Jacobowitz is lurking on this list so
> that I might ask him if he is aware of this and has dealt with this in the
> gdb code. From my extremely limited understanding of the gdb code, I don't
> think that he has but I could be wrong. GDB does not find source files.

I posted the patch to fix this to the GDB list some time ago and am
still waiting for comments on it.  Check the archives of gdb-patches,
Oct. 11th, "[RFA] Relocate debug information in object files".

Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]