www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/06/14:03:24

Xref: news2.mv.net comp.os.msdos.djgpp:3506
From: Thomas Demmer <demmer AT LSTM DOT Ruhr-UNI-Bochum DOT De>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: libm.a/linker *BUG* with test program
Date: Mon, 06 May 1996 12:57:34 +0100
Organization: Lehrstuhl fuer Stroemungsmechanik
Lines: 59
Message-ID: <318DE92E.41C6@LSTM.Ruhr-UNI-Bochum.De>
References: <25900 DOT 9605051801 AT bylands DOT dur DOT ac DOT uk>
NNTP-Posting-Host: bvb.lstm.ruhr-uni-bochum.de
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Sengan DOT Short AT durham DOT ac DOT uk wrote:
> 
> > This may be a stupid question but: why is it that when the math library is
> > not on the command line, it not only links and resolves the calls to pow
> > and ldexp, but it *works* too???
> > And, of course, if this program works without the library and crashes with
> > it, maybe you might try just not using the library for this situation...
> >
> > --
> >     .*.  "Clouds are not spheres, mountains are not cones, coastlines are not
> >  -()  <  circles, and bark is not smooth, nor does lightning travel in a
> >     `*'  straight line."    ,------------------------------------------------
> >          -- B. Mandelbrot  |  Paul Derbyshire (PGD) ao950 AT freenet DOT carleton DOT ca
> >
> 
> There appears to be a bug in the cygnus math library as far as pow and ldexp
> go. The solution is to use the functions in the standard libaries instead. They
> appear to work. (ie pow and ldexp are in two different libraries, and you can
> link in one or the other)
> 
> Sengan

-- 
The solution is to change src/libm/src/s_scalbn.S to:

#include <machine/asm.h>

ENTRY(scalbn)
	fidl 12(%esp)
	fldl  4(%esp)
	fscale		/* Now we have result in ST(0) and */
			/* 2nd operand in ST(1) */
	fxch  %st(1)    /* Swap result and 2nd operand */
	fincstp		/* throw away operand, result is now TOS */
	ret


gcc -c s_scalbn.S

and replace s_scalbn.o in libm.a

with 
ar -rv libm.a s_scalbn.o

Ciao
Tom



*************************************************************
* Thomas Demmer                                             *
* Lehrstuhl fuer Stroemungsmechanik                         *
* Ruhr-Uni-Bochum                                           *
* Universitaetsstr. 150                                     *
* D-44780  Bochum                                           *
* Tel: +49 234 700 6434                                     *
* Fax: +49 234 709 4162                                     *
* http://www.lstm.ruhr-uni-bochum.de/~demmer                *
*************************************************************

- Raw text -


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