Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Nov 2012 23:05:18 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r243193 - in stable/9/lib: libc/gen msun/src
Message-ID:  <201211172305.qAHN5IZn002672@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Sat Nov 17 23:05:18 2012
New Revision: 243193
URL: http://svnweb.freebsd.org/changeset/base/243193

Log:
  MFC r242879:
  
    Only define isnan, isnanf, __isnan and __isnanf in libc.so, not in
    libc.a and libc_p.a.  In addition, define isnan in libm.a and libm_p.a,
    but not in libm.so.
  
    This makes it possible to statically link executables using both isnan
    and isnanf with libc and libm.
  
    Tested by:	kargl
  
  MFC r242894:
  
    Add an explanatory comment to lib/libc/gen/isnan.c about the fix to make
    static linking with libc and libm work.
  
    Requested by:	jilles

Modified:
  stable/9/lib/libc/gen/isnan.c
  stable/9/lib/msun/src/s_isnan.c
Directory Properties:
  stable/9/lib/libc/   (props changed)
  stable/9/lib/msun/   (props changed)

Modified: stable/9/lib/libc/gen/isnan.c
==============================================================================
--- stable/9/lib/libc/gen/isnan.c	Sat Nov 17 22:58:33 2012	(r243192)
+++ stable/9/lib/libc/gen/isnan.c	Sat Nov 17 23:05:18 2012	(r243193)
@@ -33,8 +33,14 @@
 /*
  * XXX These routines belong in libm, but they must remain in libc for
  *     binary compat until we can bump libm's major version number.
+ *
+ * Note this only applies to the dynamic versions of libm and libc, so
+ * for the static and profiled versions we stub out the definitions.
+ * Otherwise you cannot link statically to libm and libc at the same
+ * time, when calling both functions.
  */
 
+#ifdef PIC
 __weak_reference(__isnan, isnan);
 __weak_reference(__isnanf, isnanf);
 
@@ -55,3 +61,4 @@ __isnanf(float f)
 	u.f = f;
 	return (u.bits.exp == 255 && u.bits.man != 0);
 }
+#endif /* PIC */

Modified: stable/9/lib/msun/src/s_isnan.c
==============================================================================
--- stable/9/lib/msun/src/s_isnan.c	Sat Nov 17 22:58:33 2012	(r243192)
+++ stable/9/lib/msun/src/s_isnan.c	Sat Nov 17 23:05:18 2012	(r243193)
@@ -30,8 +30,9 @@
 
 #include "fpmath.h"
 
-/* Provided by libc */
-#if 0
+/* Provided by libc.so */
+#ifndef PIC
+#undef isnan
 int
 isnan(double d)
 {
@@ -40,7 +41,7 @@ isnan(double d)
 	u.d = d;
 	return (u.bits.exp == 2047 && (u.bits.manl != 0 || u.bits.manh != 0));
 }
-#endif
+#endif /* !PIC */
 
 int
 __isnanf(float f)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201211172305.qAHN5IZn002672>