Subject: Re: rebase for setup (curl)
From: Jason Tishler <[email-masked]>
To: Cygwin <[email-masked]>
Cc: "Roth, Kevin P." <[email-masked]>
Date: Fri, 4 Jan 2002 13:53:55 -0500

On Fri, Jan 04, 2002 at 11:47:32AM -0500, Roth, Kevin P. wrote:
> Negative - I get no warnings at all during the building of
> cygcurl-2.dll.

Thanks for the confirmation.

> Here's the gcc line that actually dumps out the dll:
> 
> $  gcc -Wl,--base-file,.libs/cygcurl-2.dll-base -Wl,--dll -nostartfiles
> -Wl,-e, __cygwin_dll_entry@12 -o .libs/cygcurl-2.dll file.lo ...
> 
> I can send more of the build output if you'd like, or feel free to grab
> the source and run it yourself if you like (my commands, straight-forward
> though they may be, are all documented in my readme).

Actually, the above was very useful -- it got me thinking about PostgreSQL
DLLs, since they are made in an unconventional way.

Sure enough, rebase breaks pq.dll (one of the PostgreSQL DLLs) in exactly
the same way as cygcurl-2.dll:

    $ file pq.dll 
    pq.dll: MS Windows PE Intel 80386 console DLL
    $ objdump -p pq.dll | fgrep ImageBase
    ImageBase               67980000
    $ rebase -d -b 0x68000000 pq.dll 
    pq.dll: new base = 68000000, new size = 20000
    $ objdump -p pq.dll | fgrep ImageBase
    objdump: pq.dll: File format not recognized
    $ file pq.dll 
    pq.dll: MS-DOS executable (EXE), OS/2 or MS Windows

All PostgreSQL DLLs are created with dllwrap.  If I invoke dllwrap with
the verbose flag, we get the following:

    $ dllwrap -v -o pq.dll --dllname pq.dll --def pq.def fe-auth.o ...
    DLLTOOL name    : dlltool
    DLLTOOL options :  -v --dllname pq.dll --exclude-symbol=_cygwin_dll_entry@12 --def pq.def
    DRIVER name     : gcc
    DRIVER options  : -Wl,--dll -nostartfiles -o pq.dll -Wl,-e,__cygwin_dll_entry@12 -Wl,--image-base,0x67980000
    ...

So, the options passed to ld are the same for cygcurl-2.dll and pq.dll
except for the slight variation of --base-file versus --image-base.

I decided to table the search for the "offending" ld option(s) because
of the following gloomy thought:

    Given that rebase can break certain DLLs and that it is nearly
    impossible to control how arbitrary packages create their DLLs,
    can setup.exe's proposed rebase solution deal with this problem?
    Or, is the rebase solution doomed to failure?

Does anyone have any bright ideas?

Thanks,
Jason

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/