This is the mail archive of the binutils@sources.redhat.com 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]

Re: [PATCH: re-submit] - fix offsets in DWARF when linking relocatable (-r)


> 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>

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