math: Use local strto_*nan function in nan* for CONFIG_MATH_NOPRIVATE
Commit Message
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.
@@ -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)
@@ -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>
@@ -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)
{
@@ -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>
@@ -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
@@ -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>
@@ -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>
@@ -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"
@@ -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"
@@ -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