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: RFA: pseudo-relocations for pe targets


Brian Dessent <brian@dessent.net> wrote on 11.11.2008 15:56:09:

> Kai Tietz wrote:
> 
> > as you may saw in prior comments (or by source code), this is exactly 
the
> > reason why I introduced version 1 and version 2. And as I told before 
for
> > 32-bit targets version 1 (the old pseudo-relocation fixup structure) 
is
> 
> Oh right.  I saw the first hunk which sets
> 
> -  link_info.pei386_runtime_pseudo_reloc = -1;
> +  link_info.pei386_runtime_pseudo_reloc = 2; /* Use by default version
> 2.  */
> 
> ...and neglected that this was in pep.em not pe.em.
> 
> > prepare at the moment additionally a version of the pseudo-reloc.c 
file,
> > which is able to choose the proper relocation type by itself, but 
there
> > should be at the moment no need to change this for 32-bit!
> 
> I still am not clear how you would write a runtime relocator that can
> detect whether it's been passed a v1 or a v2 list.  Or is that what you
> were implying with the part of the v2 spec about addend == flags == 0
> being interpreted as a no-op?  In other words, you're saying that the v2
> list would distinguish itself by having as the first entry an element
> with all zeros (as that would never naturally occur with a v1 list since
> a pseudo-reloc is only required when addend != 0)?
> 
> Brian
> 

Well, I thought about the noop version, but deceided not todo so. The 
problem is that __image_base__+0 is not necessarily writeable, but old 
relocator tries to add then zero there and may raise a PF. So I want to 
implement it by checking that the size for the entries modulo 
sizeof(pseudo_reloc_v1) is zero for v2 and check that the flags (the 
reloc-size) field has just values of 8,16,32,64. Otherwise version one is 
assumed.

If you have an better idea, please let me know. I think this check is a 
hack, but should work.

Cheers,
Kai

|  (\_/)  This is Bunny. Copy and paste Bunny
| (='.'=) into your signature to help him gain
| (")_(") world domination.


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