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


Christopher Faylor <cgf-use-the-mailinglist-please@sourceware.org> wrote 
on 03.11.2008 16:23:04:

> On Mon, Nov 03, 2008 at 03:21:43PM +0100, Kai Tietz wrote:
> >The code in runtimes of the pseudo-relocator would do the following 
steps:
> >1) If "addend" is zero and flag:8 is zero continue to the next element 
> >(nothing to be done).
> >2) Read the existing relocation as value at "target" as ("rel").
> >3) Substract from "rel" the "addend" and the "fixup_sym".
> >4) Read the final destination address from "fixup_sym" as "dst".
> >5) Add to "dst" the "addend" value.
> >6) Add to "rel" the "dst"
> >7) Check for overflow
> >8) Write "rel" back to "target" by using protect() to make sure that no 

> >memory exception appears.
> >
> >This should enable even pe targets to auto-import even variables in all 

> >cases and speed-up execution, too.
> >
> >I am interested in your opinion about this and also would like to know, 
if 
> >there is for the existing 32-bit targets also an interest to have this 
> >change, otherwise I will implement it just for the 64-bit case.
> 
> I would be very interested in seeing this added for all PE targets.
> 
> cgf
> 

Ok, here is my patch for it. I verified it on x86_64-pc-mingw32, so maybe 
somebody could verify it for 32-bit cygwin/mingw, too.
I introduced two new linker parameters named --enable-pseudo-runtime-v1 
(for the old implementation) and --enable-pseudo-runtime-v2 for the new 
one. The defaults for 32-bit is the old variant (as broken it is, but to 
prevent startup failures), and for 64-bit the new version.

ChangeLog

2008-11-02  Kai Tietz  <kai.tietz@onevision.com>

        * emultempl/pep.em (..._before_parse): initialize 
pei386_runtime_pseudo_reloc by version 2.
        (OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC_V1): New option.
        (OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC_V2): New option.
        (make_import_fixup): Use relocation size to read addend.
        * emultempl/pe.em (..._before_parse): initialize 
pei386_runtime_pseudo_reloc by version 1.
        (OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC_V1): New option.
        (OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC_V2): New option.
        * pe-dll.c (pe-dll.h): Remove useless include.
        (make_runtime_pseudo_reloc): Change addend to use bfd_vma.
        Handle the two variants of pseudo-relocation.
        (pe_create_import_fixup): Change addend to type bfd_vma.
        Modify for the two pseudo_relocation variants.
        * pe-dll.h (pe_create_import_fixup): Change addend argument type 
to bfd_vma.
        * pep-dll.h (pep_create_import_fixup): Likewise.

Is this patch ok for trunk?

Cheers,
Kai



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

Attachment: pseudo_reloc_w64.txt
Description: Text document


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