From patchwork Thu Sep 20 14:01:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 29490 Received: (qmail 98974 invoked by alias); 20 Sep 2018 14:01:19 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 92659 invoked by uid 89); 20 Sep 2018 14:01:15 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=float128 X-HELO: mx1.redhat.com From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH] math: Use local strto_*nan function in nan* for CONFIG_MATH_NOPRIVATE Date: Thu, 20 Sep 2018 16:01:09 +0200 Message-ID: <87r2hoclp6.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 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 * 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.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 #include +#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 +#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 #include +#define STRTOD_NAN_DECL #define STRTOD_NAN __strtod_nan #include 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 #include +#define STRTOD_NAN_DECL #define STRTOD_NAN __strtof_nan #include 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 # include +# define STRTOD_NAN_DECL # define STRTOD_NAN __strtold_nan # include #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 #include +#define STRTOD_NAN_DECL #define STRTOD_NAN __strtof128_nan #include 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 #include +#define STRTOD_NAN_DECL #define STRTOD_NAN __wcstof128_nan #include 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 +#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 +#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 +# define STRTOD_NAN_DECL # define STRTOD_NAN __wcstold_nan # include "../stdlib/strtod_nan_main.c" #endif