www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/02/20/08:43:46

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <499EB5A6.5000707@gmail.com>
Date: Fri, 20 Feb 2009 13:52:38 +0000
From: Dave Korn <dave DOT korn DOT cygwin AT googlemail DOT com>
User-Agent: Thunderbird 2.0.0.17 (Windows/20080914)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com, Dave Korn <dave DOT korn DOT cygwin AT googlemail DOT com>
Subject: Re: [ANNOUNCEMENT] [1.7] Updated: file-5.00-1
References: <announce DOT 20090210093102 DOT GB11175 AT calimero DOT vinschen DOT de> <499E2B9A DOT 5030907 AT cwilson DOT fastmail DOT fm> <20090220095916 DOT GA759 AT calimero DOT vinschen DOT de>
In-Reply-To: <20090220095916.GA759@calimero.vinschen.de>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Corinna Vinschen wrote:
>> I haven't rebased again, but is there any reason to suspect that
>> cygmagic-1.dll is not rebaseable?
>
> Apparently.  I rebased the DLL alone and afterwards file simply stopped
> working.  The DLL has a base address of 0x6a500000.  Even rebasing to
> the very same address results in a coredump!
>
> The DLL has been built with -static-libgcc.  Assuming that this might
> have been the reason I rebuilt the file package without -static-libgcc,
> so the DLL now depends on cyggcc_s.dll.  And, guess what, afterwards
> the DLL is rebaseable just fine.
>
> Dave?  Any idea why this occurs?

  Nope, I can't reproduce it yet.  I installed the file-5.00-1 sources and
then ran

root AT host /usr/src/file-5.00-1
$ ./configure  --prefix=/usr/local CC='gcc-4 -static-libgcc'
$ make
$ cd src/.libs/
$ cp cygmagic-1.dll cygmagic-1.dll.bak
$ rebase -v -b 0x6a500000 ./cygmagic-1.dll

root AT host /usr/src/file-5.00-1/src/.libs
$ ./file.exe ./file.exe
file: could not find any magic files!

  No crash.  Then I tried it on the live version in /bin:

root AT host /bin
$ cp cygmagic-1.dll cygmagic-1.dll.bak

root AT host /bin
$ ./file.exe ./file.exe
./file.exe: PE32 executable for MS Windows (console) Intel 80386 32-bit

root AT host /bin
$ rebase -v -b 0x6a500000 ./cygmagic-1.dll
./cygmagic-1.dll: new base = 6a500000, new size = 20000

root AT host /bin
$ ./file.exe ./file.exe
./file.exe: PE32 executable for MS Windows (console) Intel 80386 32-bit

  I verified that I have the statically linked version installed, rather than
the update you just uploaded:

root AT host /bin
$ cygcheck ./cygmagic-1.dll
F:\cygwin-1.7\bin\cygmagic-1.dll
  F:\cygwin-1.7\bin\cygwin1.dll
    C:\WINNT\system32\ADVAPI32.DLL
      C:\WINNT\system32\NTDLL.DLL
      C:\WINNT\system32\KERNEL32.DLL
      C:\WINNT\system32\RPCRT4.DLL
  F:\cygwin-1.7\bin\cygz.dll

root AT host /bin

  Did I do something wrong?  Did you do something differently?  I note that
after my attempt to rebase at the same address, the DLL afterward is identical
to the one before:

DKAdmin AT ubik /bin
$ md5sum cygmagic-1.dll cygmagic-1.dll.bak
1628930e970b95891bd5ce79bab9f814 *cygmagic-1.dll
1628930e970b95891bd5ce79bab9f814 *cygmagic-1.dll.bak

  Do you see the same result?  Because if so, that would be *really* strange!

> The crash happens when the Cygwin DLL
> is running the ctors list.  Given that the file package is using plain
> C, it seems that a static libgcc is non-relocatable for whatever reason.

  I'm fairly certain it shouldn't be.  You can't expect exceptions to work
right in these circumstances, but I wouldn't see why they would be involved.

  Can one of you and Chuck run addr2line on the stackdump from the crash?  I
have no idea what's even going on yet.


    cheers,
      DaveK


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019