This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] math: Use local strto_*nan function in nan* for CONFIG_MATH_NOPRIVATE


With --enable-math-noprivate, this results in a libm.so.6 without
GLIBC_PRIVATE references on aarch64.  (Other architectures need
--disable-multi-arch as well and, in some cases, additional work.)

2018-08-20  Florian Weimer  <fweimer@redhat.com>

	* math/s_nan_template.c [CONFIG_MATH_NOPRIVATE] (M_STRTO_NAN,
	STRING_TYPE, L_, STRTOULL, STRTOD_NAN_DECL, STRTOD_NAN): Define.
	Include <stdlib/strtod_nan_main.c>.
	* stdlib/strtod_nan.c (STRTOD_NAN_DECL): Define.
	* stdlib/strtod_nan_main.c (STROT_D_NAN): Use it.
	* stdlib/strtof_nan.c (STRTOD_NAN_DECL): Define.
	* stdlib/strtold_nan.c (STRTOD_NAN_DECL): Define.
	* sysdeps/ieee754/float128/strtof128_nan.c (STRTOD_NAN_DECL):
	Define.
	* sysdeps/ieee754/float128/wcstof128_nan.c (STRTOD_NAN_DECL):
	Define.
	* wcsmbs/wcstod_nan.c (STRTOD_NAN_DECL): Define.
	* wcsmbs/wcstof_nan.c (STRTOD_NAN_DECL): Define.
	* wcsmbs/wcstold_nan.c (STRTOD_NAN_DECL): Define.

diff --git a/math/s_nan_template.c b/math/s_nan_template.c
index fe390474e4..46cb8afa80 100644
--- a/math/s_nan_template.c
+++ b/math/s_nan_template.c
@@ -23,6 +23,21 @@
 #include <string.h>
 #include <ieee754.h>
 
+#if CONFIG_MATH_NOPRIVATE
+/* Use a static function definition to avoid the external reference to
+   the implementation in libc.  For historic reasons,
+   __strtoul_internal is an exported symbol.  */
+
+# undef M_STRTO_NAN
+# define M_STRTO_NAN strtod_local
+
+# define STRING_TYPE char
+# define L_(Ch) Ch
+# define STRTOULL(S, E, B) __strtoul_internal (S, E, B, /* group */ 0)
+# define STRTOD_NAN_DECL static
+# define STRTOD_NAN M_STRTO_NAN
+# include <stdlib/strtod_nan_main.c>
+#endif
 
 FLOAT
 M_DECL_FUNC (__nan) (const char *tagp)
diff --git a/stdlib/strtod_nan.c b/stdlib/strtod_nan.c
index c5876b59a0..f1fc5ae135 100644
--- a/stdlib/strtod_nan.c
+++ b/stdlib/strtod_nan.c
@@ -20,5 +20,6 @@
 #include <strtod_nan_narrow.h>
 #include <math-type-macros-double.h>
 
+#define STRTOD_NAN_DECL
 #define STRTOD_NAN __strtod_nan
 #include <strtod_nan_main.c>
diff --git a/stdlib/strtod_nan_main.c b/stdlib/strtod_nan_main.c
index 80ecb78572..457cc90103 100644
--- a/stdlib/strtod_nan_main.c
+++ b/stdlib/strtod_nan_main.c
@@ -29,6 +29,7 @@
    return a default NAN.  If ENDPTR is not NULL, set *ENDPTR to point
    to the character after the initial n-char-sequence.  */
 
+STRTOD_NAN_DECL
 FLOAT
 STRTOD_NAN (const STRING_TYPE *str, STRING_TYPE **endptr, STRING_TYPE endc)
 {
diff --git a/stdlib/strtof_nan.c b/stdlib/strtof_nan.c
index f085c5b4fb..dfa80c8cca 100644
--- a/stdlib/strtof_nan.c
+++ b/stdlib/strtof_nan.c
@@ -20,5 +20,6 @@
 #include <strtod_nan_narrow.h>
 #include <math-type-macros-float.h>
 
+#define STRTOD_NAN_DECL
 #define STRTOD_NAN __strtof_nan
 #include <strtod_nan_main.c>
diff --git a/stdlib/strtold_nan.c b/stdlib/strtold_nan.c
index eadfe546e2..935a024e0a 100644
--- a/stdlib/strtold_nan.c
+++ b/stdlib/strtold_nan.c
@@ -25,6 +25,7 @@
 # include <strtod_nan_narrow.h>
 # include <math-type-macros-ldouble.h>
 
+# define STRTOD_NAN_DECL
 # define STRTOD_NAN __strtold_nan
 # include <strtod_nan_main.c>
 #endif
diff --git a/sysdeps/ieee754/float128/strtof128_nan.c b/sysdeps/ieee754/float128/strtof128_nan.c
index 37a7f4e02e..4fe885e9a7 100644
--- a/sysdeps/ieee754/float128/strtof128_nan.c
+++ b/sysdeps/ieee754/float128/strtof128_nan.c
@@ -22,5 +22,6 @@
 #include <strtod_nan_narrow.h>
 #include <math-type-macros-float128.h>
 
+#define STRTOD_NAN_DECL
 #define STRTOD_NAN __strtof128_nan
 #include <stdlib/strtod_nan_main.c>
diff --git a/sysdeps/ieee754/float128/wcstof128_nan.c b/sysdeps/ieee754/float128/wcstof128_nan.c
index f504809dcf..300e4de35e 100644
--- a/sysdeps/ieee754/float128/wcstof128_nan.c
+++ b/sysdeps/ieee754/float128/wcstof128_nan.c
@@ -19,5 +19,6 @@
 
 #include <stdlib/strtod_nan_wide.h>
 #include <math-type-macros-float128.h>
+#define STRTOD_NAN_DECL
 #define STRTOD_NAN __wcstof128_nan
 #include <stdlib/strtod_nan_main.c>
diff --git a/wcsmbs/wcstod_nan.c b/wcsmbs/wcstod_nan.c
index 1423f3e8aa..fdc626dfa0 100644
--- a/wcsmbs/wcstod_nan.c
+++ b/wcsmbs/wcstod_nan.c
@@ -19,5 +19,6 @@
 #include "../stdlib/strtod_nan_wide.h"
 #include <math-type-macros-double.h>
 
+#define STRTOD_NAN_DECL
 #define STRTOD_NAN __wcstod_nan
 #include "../stdlib/strtod_nan_main.c"
diff --git a/wcsmbs/wcstof_nan.c b/wcsmbs/wcstof_nan.c
index 96f2198667..68ff567c49 100644
--- a/wcsmbs/wcstof_nan.c
+++ b/wcsmbs/wcstof_nan.c
@@ -19,5 +19,6 @@
 #include "../stdlib/strtod_nan_wide.h"
 #include <math-type-macros-float.h>
 
+#define STRTOD_NAN_DECL
 #define STRTOD_NAN __wcstof_nan
 #include "../stdlib/strtod_nan_main.c"
diff --git a/wcsmbs/wcstold_nan.c b/wcsmbs/wcstold_nan.c
index 66793ec459..8e00d8eefe 100644
--- a/wcsmbs/wcstold_nan.c
+++ b/wcsmbs/wcstold_nan.c
@@ -25,6 +25,7 @@
 # include "../stdlib/strtod_nan_wide.h"
 # include <math-type-macros-ldouble.h>
 
+# define STRTOD_NAN_DECL
 # define STRTOD_NAN __wcstold_nan
 # include "../stdlib/strtod_nan_main.c"
 #endif


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]