delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/09/13/10:27:50

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <39BF8E90.AC37ADA@e-14.com>
Date: Wed, 13 Sep 2000 15:26:24 +0100
From: Nigel Wetten <nwetten AT e-14 DOT com>
X-Mailer: Mozilla 4.72 [en] (WinNT; I)
X-Accept-Language: en
MIME-Version: 1.0
To: cygwin AT sources DOT redhat DOT com
Subject: Re: crash using _environ from libmsvcrt20/40.a
References: <39BF6F25 DOT 45A7BBB0 AT e-14 DOT com> <20000913091355 DOT A16305 AT cygnus DOT com>

> MSVCRT*.DLL and Cygwin1.dll are mutually exclusive.  You can't mix them.
> 
> If you want to use MSVCRT*.DLL use the -mno-cygwin option when you compile
> and link.

Thanks, I've added that, and objdump -p confirms that the binary does
not use cygwin.dll, BUT the program still faults in the same way.

To re-iterate, the instructions that try to load the address for
_environ are loading the first 4 bytes from:
(objdump -d -S a.exe)
00401298 <__environ>:
  401298:	ff 25 d0 30 40 00    	jmp    *0x4030d0

and using this value causes the access violation. If I manually change
it every time to 0x4030d0, the program can actually execute, although
_environ seems to point to garbage.
At this point, I'm just a bit confused about what's going on. I don't
understand why the 2 bytes for the jmp opcode are there, or
alternatively why the main progam code that tries to load the address
for _environ, accidentally gets 2 bytes of the opcode for jmp and
therefore faults.
The link.map suggests that the address 0x4030d0 is the right place:
 .idata$5       0x004030d0        0x4 /usr/lib/libmsvcrt40.a(ds00128.o)
                0x004030d0                _imp___environ

The progam works when compiled with msvc, which suggests to me either
there is a problem in the import library, or perhaps have I done the
build incorrectly?

Nigel

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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