roy@philabs.philips.com (03/09/89)
When you do "cc -fwhatever -lm", how does the linker know which versions of the math library to link in? If you do a "cc -dryrun" to see what's going on, the only difference at the linking stage is using a different version of crt.o. The only thing I can see that might make sense (and looking at gprof output semi-confirms this) is that every routine in the math library is actually 3 routines in one (soft, 68881, and fpa versions) and does a switch to the right code on entry, based on the value of some global variable set in crt.o. Could this really be the way things work? Is the binary of every program I write using the math library loaded down with three versions of each routine (plus the, admittedly minor, overhead of the switch-out code on each call)? Roy Smith, System Administrator Public Health Research Institute {allegra,philabs,cmcl2,rutgers}!phri!roy -or- phri!roy@uunet.uu.net
dupuy@cs.columbia.edu (Alexander Dupuy) (03/23/89)
This came up in connection with gcc recently. There are four versions of the Sun-3 libm.a library under 4.0, in /usr/lib/f{68881,fpa,soft,switch}. Depending on your compilation options, you would get a different one each time. I don't know about 3.x - I guess you get the soft or switch libraries. @alex