isnan for ppc def help

Michael Meissner meissner@cygnus.com
Wed Mar 1 12:04:00 GMT 2000


On Wed, Mar 01, 2000 at 09:21:37AM -0800, Matthew R Wette wrote:
> "Scully, Maureen" writes ...
> > VxWorks user -
> > 	Do you have any suggustions on how is can resolve the undefined
> > symbol, isnan for the ppc?
> > Some background info:
> > 	I am using Tornado for VxWorks & Seawind for X/Motif/OpenGL support
> > for VxWorks running on a PPC - power PC. Found your knowledgeable responses
> > on a bulletin board when I search.  
> > I think that someone else must had the same problem or can advise me on
> > porting software to the VxWorks/PPC environment. VxWorks/PPC Tornados
> > Windshell outputs: undefined symbols: isnan, equal, ent, directory,
> > valid_path, and remove_dir...  These symbols are prototyped with a #ifdef
> > unix and #ifdef mac differently. In these header files need to define a
> > similar definition #ifdef VXWORKS for the PPC. isnan wrapper has the highest
> > concern. 
> > I not sure don't understand why isnan differs in MAC and Unix defs. How then
> > does VxWorks needs to do to resolve these symbols. Tornado's C++ compiler
> > does not seem to resolve after I tried similar definitions during build
> > because later during run time, spawning the loaded executable this problem
> > still shows up. The NFS, network file system should help in resolving  the
> > variations in mkdir, chdir, rmdir. Not the comparable to isnan, valid_path,
> > directory, ent, and equal under VxWorks.
> > I think I need to load these symbol definitions in a *.o file, but I don
> > understand them. 
> > I was hoping someone could share their insight into this symbol issue? 
> 
> I find it odd that WRS left this out.  Anyway, probably the easiest
> thing to do is grab newlib from ftp://sourceware.cygnus.com/pub .
> and grab the routine from there (for ppc!).   I'm pretty sure it's
> there.  All that the routine has to do is test a bit in the fp status
> register.

First check if WRS provided a math library and add -lm to the ld -r line (or
load libm.a).  If that doesn't work, it is fairly simple to define isnan as:

	int isnan(double x){
	  return x!=x;
	}

	int isnanf(float x){
	  return x!=x;
	}

	int isinf(double x){
	  return x==(1.0/0.0) || x==(-1.0/0.0);
	}

	int isinff(float x){
	  return x==(1.0f/0.0f) || x==(-1.0f/0.0f);
	}

-- 
Michael Meissner, Cygnus Solutions, a Red Hat company.
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
Work:	  meissner@redhat.com		phone: +1 978-486-9304
Non-work: meissner@spectacle-pond.org	fax:   +1 978-692-4482


More information about the Gcc mailing list