This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [PATCH: re-submit] - fix offsets in DWARF when linking relocatable (-r)
- To: igor at windriver dot com
- Subject: Re: [PATCH: re-submit] - fix offsets in DWARF when linking relocatable (-r)
- From: Geoff Keating <geoffk at cygnus dot com>
- Date: Mon, 21 Aug 2000 11:44:01 -0700
- CC: binutils at sourceware dot cygnus dot com
- References: <NDBBKCENGMEOBDEHNNEJCEDCCGAA.igor@windriver.com>
> From: "Igor Shevlyakov" <igor@windriver.com>
> Date: Mon, 21 Aug 2000 10:37:38 -0700
> Hi folks,
>
> We noticed that when linking together object files with DWARF debug
> info in relocatable mode resulting DWARF debug info is not correct
> because relocations are used to describe offsets in other sections.
> And since RELA is used for PPC that offsetes are kept in relocation
> itself not in actual debug section. That patch fix that. It updates
> offsets in debug sections as well. It's safe: they will be
> overwritten at final link time. But that makes possible to debug
> relocatable files as well as finally linked
I think the last time this came up, I think we decided that it makes
no sense to have any kind of relocation against non-loaded sections
like DWARF sections. So the right patch is to resolve all relocations
against non-loaded sections in the linker.
[STABS only gets away with this by coincidence.]
> ! rel->r_addend += sec->output_offset + sym->st_value;
> ! /* It safe to put real offset into .debug* sections
> ! since it will be overwritten at final link. But
> ! DWARF debug info will be correct even when
> ! linking is relocatable.
> ! */
> ! if ((input_section->flags & SEC_DEBUGGING) == 0)
> ! addend = rel->r_addend;
> ! else
> ! update_data = 1;
--
- Geoffrey Keating <geoffk@cygnus.com>