From: Florian Weimer <fweimer@redhat.com>
To: libc-alpha@sourceware.org
Subject: [PATCH] math: Use local strto_*nan function in nan* for CONFIG_MATH_NOPRIVATE
Date: Thu, 20 Sep 2018 14:01:00 -0000 [thread overview]
Message-ID: <87r2hoclp6.fsf@oldenburg.str.redhat.com> (raw)
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
next reply other threads:[~2018-09-20 14:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-20 14:01 Florian Weimer [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-05-13 20:31 Florian Weimer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r2hoclp6.fsf@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).