delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/23/15:41:15

Date: Fri, 23 Jan 1998 12:40:19 -0800 (PST)
Message-Id: <199801232040.MAA27046@adit.ap.net>
Mime-Version: 1.0
To: jedediah AT interlog DOT com, djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Q about emulib.a

At 12:01  1/23/1998 GMT, jedediah AT interlog DOT com wrote:
>Ok after searching through FAQs, info files, Dejanews, etc.. I am now
>looking for help for this very frustrating problem here. 
>
>I am compiling a program on a 386 (with no FPU) that uses floats.
>According to the DJGPP FAQ, I link it with the emulib.a archive to use
>emulation. I am also using other archives that I know for a fact were not
>compiled with emulib.a but that shouldn't make a difference as far as I
>can tell. Now my program doesnt work. I don't want to explain the whole
>thing, but basically a function inside one the the other archives (the 
>ones that were not compiled with the -lemu option) that uses floats just
>crashes inexplicably. Is there something you have to do when creating an
>archive from source code to make it use floating point emulation? I don't
>understand how emulation can be implemented at link time.
I am not absolutely clear on the workings of this, but I believe it works
like this.
* Startup code, linked with every program, references a hook symbol
(__emu387_load_hook).
* If libemu (note spelling) is being linked, the linker sees it defined
there and pulls in the statically-loaded emulation.
* If not, the linker finds the hook symbol defined in another routine whose
job it is to dynamically load the emulation from a DXE file.

Compiling to object code should be exactly the same whether or not you have
an FPU. Linking is the only stage where it becomes an issue. So no, if you
link with libemu, everything *should* work.

But apparently it doesn't. So here are a few questions.
* Can you tell us what the function which crashes does? Source would be
nice. If you make a program that only does that, does it still crash?
* Does it happen if you don't link with libemu.a, and let the dynamic
emulation load automatically?
>
>Let me clarify this. First I create an object file:
>
>gcc mylib.c -c -o mylib.o
>
>Where mylib.c uses floats. Then I compile my main source file and link it
>with mylib.o and emulib.a:
>
>gcc myprog.c mylib.o -lemu -o myprog.exe
>
>And what I need to know is will the functions originally in mylib.c use
>floating point emulation?
The answer *should* be yes. Please provide more info, since it apparently
doesn't.

The FPU emulation code doesn't get as much workout as the rest, so a bug in
it is possible.

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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