This is the mail archive of the binutils@sourceware.org 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: relocations targeting discarded symbols


On Mon, May 25, 2009 at 02:17:25PM +0100, Jan Beulich wrote:
> Alan,
> 
> as you seem to be the last one who touched that code (when moving it from
> elflink.h to elflink.c), and since I cannot seem to find a way to look at the
> history of elflink.h - what are the reasons behind

cvs ann elflink.h

> 		  if (irela->r_offset >= (bfd_vma) -2)
> 		    {
> 		      /* This is a reloc for a deleted entry or somesuch.
> 			 Turn it into an R_*_NONE reloc, at the same
> 			 offset as the last reloc.  elf_eh_frame.c and
> 			 bfd_elf_discard_info rely on reloc offsets
> 			 being ordered.  */
> 		      irela->r_offset = last_offset;
> 		      irela->r_info = 0;
> 		      irela->r_addend = 0;
> 		      continue;
> 		    }
> 
> In particular,
> - Why can't such relocations just be discarded?

All sections have been sized and file offsets assigned by this stage,
so discarding leaves a hole.  I suppose it might be possible to adjust
the reloc section size and shuffle relocs.

> - Why does r_offset need to be changed? I can't see why keeping the old
>   offset would clobber the ordering (or prevent it from being established)
>   here.

r_offset has been set to -1 or -2.  There isn't an easy way to find
the original r_offset.

-- 
Alan Modra
Australia Development Lab, IBM


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