[Midnightbsd-cvs] src [8397] trunk/lib: fix static linking

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Sep 18 15:26:19 EDT 2016


Revision: 8397
          http://svnweb.midnightbsd.org/src/?rev=8397
Author:   laffer1
Date:     2016-09-18 15:26:19 -0400 (Sun, 18 Sep 2016)
Log Message:
-----------
fix static linking

Modified Paths:
--------------
    trunk/lib/libc/gen/isnan.c
    trunk/lib/msun/src/s_isnan.c

Modified: trunk/lib/libc/gen/isnan.c
===================================================================
--- trunk/lib/libc/gen/isnan.c	2016-09-18 19:25:51 UTC (rev 8396)
+++ trunk/lib/libc/gen/isnan.c	2016-09-18 19:26:19 UTC (rev 8397)
@@ -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 @@
 	u.f = f;
 	return (u.bits.exp == 255 && u.bits.man != 0);
 }
+#endif /* PIC */

Modified: trunk/lib/msun/src/s_isnan.c
===================================================================
--- trunk/lib/msun/src/s_isnan.c	2016-09-18 19:25:51 UTC (rev 8396)
+++ trunk/lib/msun/src/s_isnan.c	2016-09-18 19:26:19 UTC (rev 8397)
@@ -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 @@
 	u.d = d;
 	return (u.bits.exp == 2047 && (u.bits.manl != 0 || u.bits.manh != 0));
 }
-#endif
+#endif /* !PIC */
 
 int
 __isnanf(float f)



More information about the Midnightbsd-cvs mailing list