From: "John S. Fine" Newsgroups: comp.os.msdos.djgpp Subject: Re: -O3 and -O2 breaks my NASM code Date: Fri, 18 Sep 1998 14:45:38 -0400 Lines: 26 Message-ID: <3602AA52.659@erols.com> References: <6ttip0$ng8$1 AT news2 DOT saix DOT net> Reply-To: johnfine AT erols DOT com NNTP-Posting-Host: 207-172-241-43.s43.as5.bsd.erols.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Rylan wrote: > I've ran into a situation where attempting to use -O3 and even -O2 with ANY > code that calls NASM compiled functions (in their own, seperate .O) compiles > fine but crashes the moment the NASM code is reached. This happens without a > stack trace, nothing - the whole program just stops. Unoptimized compiles of > the same code runs 100%. I can't know for sure without seeing your code, but the last several times I have seen questions like yours, the NASM code had the wrong segment name. To use .o files with djgpp without any special linking tricks, the executable portion of the .o file must be in a segment named ".text". Other people have gotten that wrong, so that their NASM code was never even reached by a call from the C code. It seemed to work/not work based on subtle things (like your -O3). In fact it wasn't working either way and the subtle change just moved things around so the call reached a different wrong address. If the above guess is wrong, post one of your nasm files so we can give more informed answers. -- http://www.erols.com/johnfine/ http://www.geocities.com/SiliconValley/Peaks/8600/