ntdll: Don't cancel loading on IMAGE_FILE_RELOCS_STRIPPED

Paul Chitescu paulc at voip.null.ro
Tue Sep 7 11:13:05 CDT 2010


On Tuesday 07 September 2010 06:47:12 pm André Hentschel wrote:
> Am 07.09.2010 17:27, schrieb Marcus Meissner:
> > On Tue, Sep 07, 2010 at 04:37:49PM +0200, André Hentschel wrote:
> >> give the file a try when it only links to ordinals instead of just
> >> stopping execution here. ---
> >>  dlls/ntdll/virtual.c |    4 ----
> >>  1 files changed, 0 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
> >> index a42ed5f..0bd3023 100644
> >> --- a/dlls/ntdll/virtual.c
> >> +++ b/dlls/ntdll/virtual.c
> >> @@ -1232,12 +1232,8 @@ static NTSTATUS map_image( HANDLE hmapping, int
> >> fd, char *base, SIZE_T total_siz const IMAGE_DATA_DIRECTORY *relocs;
> >>
> >>          if (nt->FileHeader.Characteristics &
> >> IMAGE_FILE_RELOCS_STRIPPED) -        {
> >>              WARN_(module)( "Need to relocate module from %p to %p, but
> >> there are no relocation records\n", base, ptr );
> >> -            status = STATUS_CONFLICTING_ADDRESSES;
> >> -            goto error;
> >> -        }
> >>
> >>          TRACE_(module)( "relocating from %p-%p to %p-%p\n",
> >>                          base, base + total_size, ptr, ptr + total_size
> >> );
> >
> > Have you seen a program needing this? Which?
> >
> > "links to ordinals" is also a wrong comment, as RELOCS are used for
> > relocation addresses within the binary itself (not imports).
> >
> > Ciao, Marcus
>
> When trying to run WinCE apps in my ARM tree that was a show stopper,
> because the mobile apps only import by ordinal for size reasons i thought.
> So by your explanation i guess running such apps is really not possible
> unless the RELOCS are not stripped?

Exporting and importing has nothing to do with relocations.

In a typical Win32 environment the executables don't have relocations since 
they load at a fixed address. Old (Visual C 4.x and older) executables had 
relocations so they could run on Win32s.

Most DLLs have relocations as they can't know where they get loaded in memory. 
The only exception are the special Microsoft managed DLLs which load at 
reserved addresses.




More information about the wine-devel mailing list