* [PATCH] Introduce --enable-math-noprivate
@ 2018-05-11 15:43 Florian Weimer
2018-05-11 16:36 ` Adhemerval Zanella
2018-05-16 4:54 ` Florian Weimer
0 siblings, 2 replies; 17+ messages in thread
From: Florian Weimer @ 2018-05-11 15:43 UTC (permalink / raw)
To: libc-alpha
Avoid errno@GLIBC_PRIVATE if enabled. Additional work is needed
to eliminate further GLIBC_PRIVATE symbol references.
2018-05-11 Florian Weimer <fweimer@redhat.com>
Introduce --enable-math-noprivate.
Avoid errno@GLIBC_PRIVATE if enabled.
* config.h.in (CONFIG_MATH_NOPRIVATE): Define.
* config.make.in (config-math-noprivate): New variable.
* configure.ac: Recognize --enable-math-noprivate option.
* manual/install.texi (Configuring and compiling): Document
--enable-math-noprivate.
* configure: Regenerate.
* INSTALL: Likewise.
* include/errno.h: Do not redefine errno for libm, libmvec if
CONFIG_MATH_NOPRIVATE.
diff --git a/INSTALL b/INSTALL
index 052b1b6f89..0dc6739e42 100644
--- a/INSTALL
+++ b/INSTALL
@@ -197,6 +197,13 @@ if 'CFLAGS' is specified it must enable optimization. For example:
libnss_nisplus are not built at all. Use this option to enable
libnsl with all depending NSS modules and header files.
+'--enable-math-noprivate'
+ By default, libm and libmvec (if available) are built in such a way
+ that they rely on internals in the rest of the library (notably
+ libc). With this option, the math libraries are built in a way
+ that avoids such dependencies. As a result, it is possible to use
+ them with older versions of the library.
+
'--disable-experimental-malloc'
By default, a per-thread cache is enabled in 'malloc'. While this
cache can be disabled on a per-application basis using tunables
diff --git a/config.h.in b/config.h.in
index b0b7cf26cb..794f526da4 100644
--- a/config.h.in
+++ b/config.h.in
@@ -156,6 +156,10 @@
code to link against. */
#undef LINK_OBSOLETE_NSL
+/* Define as 1 if GLIBC_PRIVATE symbols should be avoided in the math
+ libraries. */
+#define CONFIG_MATH_NOPRIVATE 0
+
/* Define if Systemtap <sys/sdt.h> probes should be defined. */
#undef USE_STAP_PROBE
diff --git a/config.make.in b/config.make.in
index 9e5e24b2c6..d7ac4d5a7a 100644
--- a/config.make.in
+++ b/config.make.in
@@ -101,6 +101,7 @@ use-nscd = @use_nscd@
build-hardcoded-path-in-tests= @hardcoded_path_in_tests@
build-pt-chown = @build_pt_chown@
have-tunables = @have_tunables@
+config-math-noprivate = @config_math_noprivate@
# Build tools.
CC = @CC@
diff --git a/configure b/configure
index 7a8bd3f817..73599affbf 100755
--- a/configure
+++ b/configure
@@ -672,6 +672,7 @@ base_machine
have_tunables
build_pt_chown
build_nscd
+config_math_noprivate
build_obsolete_nsl
link_obsolete_rpc
libc_cv_static_nss_crypt
@@ -782,6 +783,7 @@ enable_experimental_malloc
enable_nss_crypt
enable_obsolete_rpc
enable_obsolete_nsl
+enable_math_noprivate
enable_systemtap
enable_build_nscd
enable_nscd
@@ -1453,6 +1455,7 @@ Optional Features:
link-time usage
--enable-obsolete-nsl build and install the obsolete libnsl library and
depending NSS modules
+ --enable-math-noprivate avoid GLIBC_PRIVATE symbols in math libraries
--enable-systemtap enable systemtap static probe points [default=no]
--disable-build-nscd disable building and installing the nscd daemon
--disable-nscd library functions will not contact the nscd daemon
@@ -3632,6 +3635,19 @@ if test "$build_obsolete_nsl" = yes; then
fi
+# Check whether --enable-math-noprivate was given.
+if test "${enable_math_noprivate+set}" = set; then :
+ enableval=$enable_math_noprivate; config_math_noprivate=$enableval
+else
+ config_math_noprivate=no
+fi
+
+
+if test "$config_math_noprivate" = yes; then
+ $as_echo "#define CONFIG_MATH_NOPRIVATE 1" >>confdefs.h
+
+fi
+
# Check whether --enable-systemtap was given.
if test "${enable_systemtap+set}" = set; then :
enableval=$enable_systemtap; systemtap=$enableval
diff --git a/configure.ac b/configure.ac
index ca1282a6b3..f18242e276 100644
--- a/configure.ac
+++ b/configure.ac
@@ -378,6 +378,16 @@ if test "$build_obsolete_nsl" = yes; then
AC_DEFINE(LINK_OBSOLETE_NSL)
fi
+AC_ARG_ENABLE([math-noprivate],
+ AC_HELP_STRING([--enable-math-noprivate],
+ [avoid GLIBC_PRIVATE symbols in math libraries]),
+ [config_math_noprivate=$enableval],
+ [config_math_noprivate=no])
+AC_SUBST(config_math_noprivate)
+if test "$config_math_noprivate" = yes; then
+ AC_DEFINE(CONFIG_MATH_NOPRIVATE)
+fi
+
AC_ARG_ENABLE([systemtap],
[AS_HELP_STRING([--enable-systemtap],
[enable systemtap static probe points @<:@default=no@:>@])],
diff --git a/include/errno.h b/include/errno.h
index 457114b27a..6c0e0b94ef 100644
--- a/include/errno.h
+++ b/include/errno.h
@@ -20,7 +20,8 @@
# define errno rtld_errno
extern int rtld_errno attribute_hidden;
-# elif IS_IN_LIB && !IS_IN (rtld)
+# elif IS_IN_LIB && !IS_IN (rtld) \
+ && (!CONFIG_MATH_NOPRIVATE || !(IS_IN (libm) || IS_IN (libmvec)))
# include <tls.h>
diff --git a/manual/install.texi b/manual/install.texi
index 4bbbfcffa5..1a131a009a 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -230,6 +230,13 @@ libnss_nisplus are not built at all.
Use this option to enable libnsl with all depending NSS modules and
header files.
+@item --enable-math-noprivate
+By default, libm and libmvec (if available) are built in such a way that
+they rely on internals in the rest of the library (notably libc). With
+this option, the math libraries are built in a way that avoids such
+dependencies. As a result, it is possible to use them with older
+versions of the library.
+
@item --disable-experimental-malloc
By default, a per-thread cache is enabled in @code{malloc}. While
this cache can be disabled on a per-application basis using tunables
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] Introduce --enable-math-noprivate
2018-05-11 15:43 [PATCH] Introduce --enable-math-noprivate Florian Weimer
@ 2018-05-11 16:36 ` Adhemerval Zanella
2018-05-11 17:23 ` Florian Weimer
2018-05-16 4:54 ` Florian Weimer
1 sibling, 1 reply; 17+ messages in thread
From: Adhemerval Zanella @ 2018-05-11 16:36 UTC (permalink / raw)
To: libc-alpha
On 11/05/2018 12:43, Florian Weimer wrote:
> Avoid errno@GLIBC_PRIVATE if enabled. Additional work is needed
> to eliminate further GLIBC_PRIVATE symbol references.
Why just not make it the default instead of adding a configure option?
>
> 2018-05-11 Florian Weimer <fweimer@redhat.com>
>
> Introduce --enable-math-noprivate.
> Avoid errno@GLIBC_PRIVATE if enabled.
> * config.h.in (CONFIG_MATH_NOPRIVATE): Define.
> * config.make.in (config-math-noprivate): New variable.
> * configure.ac: Recognize --enable-math-noprivate option.
> * manual/install.texi (Configuring and compiling): Document
> --enable-math-noprivate.
> * configure: Regenerate.
> * INSTALL: Likewise.
> * include/errno.h: Do not redefine errno for libm, libmvec if
> CONFIG_MATH_NOPRIVATE.
>
> diff --git a/INSTALL b/INSTALL
> index 052b1b6f89..0dc6739e42 100644
> --- a/INSTALL
> +++ b/INSTALL
> @@ -197,6 +197,13 @@ if 'CFLAGS' is specified it must enable optimization. For example:
> libnss_nisplus are not built at all. Use this option to enable
> libnsl with all depending NSS modules and header files.
>
> +'--enable-math-noprivate'
> + By default, libm and libmvec (if available) are built in such a way
> + that they rely on internals in the rest of the library (notably
> + libc). With this option, the math libraries are built in a way
> + that avoids such dependencies. As a result, it is possible to use
> + them with older versions of the library.
> +
> '--disable-experimental-malloc'
> By default, a per-thread cache is enabled in 'malloc'. While this
> cache can be disabled on a per-application basis using tunables
> diff --git a/config.h.in b/config.h.in
> index b0b7cf26cb..794f526da4 100644
> --- a/config.h.in
> +++ b/config.h.in
> @@ -156,6 +156,10 @@
> code to link against. */
> #undef LINK_OBSOLETE_NSL
>
> +/* Define as 1 if GLIBC_PRIVATE symbols should be avoided in the math
> + libraries. */
> +#define CONFIG_MATH_NOPRIVATE 0
> +
> /* Define if Systemtap <sys/sdt.h> probes should be defined. */
> #undef USE_STAP_PROBE
>
> diff --git a/config.make.in b/config.make.in
> index 9e5e24b2c6..d7ac4d5a7a 100644
> --- a/config.make.in
> +++ b/config.make.in
> @@ -101,6 +101,7 @@ use-nscd = @use_nscd@
> build-hardcoded-path-in-tests= @hardcoded_path_in_tests@
> build-pt-chown = @build_pt_chown@
> have-tunables = @have_tunables@
> +config-math-noprivate = @config_math_noprivate@
>
> # Build tools.
> CC = @CC@
> diff --git a/configure b/configure
> index 7a8bd3f817..73599affbf 100755
> --- a/configure
> +++ b/configure
> @@ -672,6 +672,7 @@ base_machine
> have_tunables
> build_pt_chown
> build_nscd
> +config_math_noprivate
> build_obsolete_nsl
> link_obsolete_rpc
> libc_cv_static_nss_crypt
> @@ -782,6 +783,7 @@ enable_experimental_malloc
> enable_nss_crypt
> enable_obsolete_rpc
> enable_obsolete_nsl
> +enable_math_noprivate
> enable_systemtap
> enable_build_nscd
> enable_nscd
> @@ -1453,6 +1455,7 @@ Optional Features:
> link-time usage
> --enable-obsolete-nsl build and install the obsolete libnsl library and
> depending NSS modules
> + --enable-math-noprivate avoid GLIBC_PRIVATE symbols in math libraries
> --enable-systemtap enable systemtap static probe points [default=no]
> --disable-build-nscd disable building and installing the nscd daemon
> --disable-nscd library functions will not contact the nscd daemon
> @@ -3632,6 +3635,19 @@ if test "$build_obsolete_nsl" = yes; then
>
> fi
>
> +# Check whether --enable-math-noprivate was given.
> +if test "${enable_math_noprivate+set}" = set; then :
> + enableval=$enable_math_noprivate; config_math_noprivate=$enableval
> +else
> + config_math_noprivate=no
> +fi
> +
> +
> +if test "$config_math_noprivate" = yes; then
> + $as_echo "#define CONFIG_MATH_NOPRIVATE 1" >>confdefs.h
> +
> +fi
> +
> # Check whether --enable-systemtap was given.
> if test "${enable_systemtap+set}" = set; then :
> enableval=$enable_systemtap; systemtap=$enableval
> diff --git a/configure.ac b/configure.ac
> index ca1282a6b3..f18242e276 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -378,6 +378,16 @@ if test "$build_obsolete_nsl" = yes; then
> AC_DEFINE(LINK_OBSOLETE_NSL)
> fi
>
> +AC_ARG_ENABLE([math-noprivate],
> + AC_HELP_STRING([--enable-math-noprivate],
> + [avoid GLIBC_PRIVATE symbols in math libraries]),
> + [config_math_noprivate=$enableval],
> + [config_math_noprivate=no])
> +AC_SUBST(config_math_noprivate)
> +if test "$config_math_noprivate" = yes; then
> + AC_DEFINE(CONFIG_MATH_NOPRIVATE)
> +fi
> +
> AC_ARG_ENABLE([systemtap],
> [AS_HELP_STRING([--enable-systemtap],
> [enable systemtap static probe points @<:@default=no@:>@])],
> diff --git a/include/errno.h b/include/errno.h
> index 457114b27a..6c0e0b94ef 100644
> --- a/include/errno.h
> +++ b/include/errno.h
> @@ -20,7 +20,8 @@
> # define errno rtld_errno
> extern int rtld_errno attribute_hidden;
>
> -# elif IS_IN_LIB && !IS_IN (rtld)
> +# elif IS_IN_LIB && !IS_IN (rtld) \
> + && (!CONFIG_MATH_NOPRIVATE || !(IS_IN (libm) || IS_IN (libmvec)))
>
> # include <tls.h>
>
> diff --git a/manual/install.texi b/manual/install.texi
> index 4bbbfcffa5..1a131a009a 100644
> --- a/manual/install.texi
> +++ b/manual/install.texi
> @@ -230,6 +230,13 @@ libnss_nisplus are not built at all.
> Use this option to enable libnsl with all depending NSS modules and
> header files.
>
> +@item --enable-math-noprivate
> +By default, libm and libmvec (if available) are built in such a way that
> +they rely on internals in the rest of the library (notably libc). With
> +this option, the math libraries are built in a way that avoids such
> +dependencies. As a result, it is possible to use them with older
> +versions of the library.
> +
> @item --disable-experimental-malloc
> By default, a per-thread cache is enabled in @code{malloc}. While
> this cache can be disabled on a per-application basis using tunables
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] Introduce --enable-math-noprivate
2018-05-11 16:36 ` Adhemerval Zanella
@ 2018-05-11 17:23 ` Florian Weimer
0 siblings, 0 replies; 17+ messages in thread
From: Florian Weimer @ 2018-05-11 17:23 UTC (permalink / raw)
To: Adhemerval Zanella; +Cc: libc-alpha
On 05/11/2018 06:36 PM, Adhemerval Zanella wrote:
>
> On 11/05/2018 12:43, Florian Weimer wrote:
>> Avoid errno@GLIBC_PRIVATE if enabled. Additional work is needed
>> to eliminate further GLIBC_PRIVATE symbol references.
> Why just not make it the default instead of adding a configure option?
This change is perhaps appropriate (especially on x86-64, where a
function call and indirect store is more compact that an TLS offset load
and TLS store). However, to remove GLIBC_PRIVATE references from the
nan* functions and from the IFUNC resolvers (which use _rtld_global_ro
on x86-64 and ppc64le), I need to duplicate code, and I'm not sure if
it's appropriate to do this for such a narrow feature.
(Although the IFUNC resolvers can probably made to crash due the
relocations they contain, but I'm still hoping for a different bugfix
for that, which should make relocations based on non-IFUNC-symbols work
reliably in IFUNC resolvers).
Thanks,
Florian
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] Introduce --enable-math-noprivate
2018-05-11 15:43 [PATCH] Introduce --enable-math-noprivate Florian Weimer
2018-05-11 16:36 ` Adhemerval Zanella
@ 2018-05-16 4:54 ` Florian Weimer
2018-06-07 13:38 ` Florian Weimer
1 sibling, 1 reply; 17+ messages in thread
From: Florian Weimer @ 2018-05-16 4:54 UTC (permalink / raw)
To: libc-alpha
On 05/11/2018 05:43 PM, Florian Weimer wrote:
> Avoid errno@GLIBC_PRIVATE if enabled. Additional work is needed
> to eliminate further GLIBC_PRIVATE symbol references.
>
> 2018-05-11 Florian Weimer<fweimer@redhat.com>
>
> Introduce --enable-math-noprivate.
> Avoid errno@GLIBC_PRIVATE if enabled.
> * config.h.in (CONFIG_MATH_NOPRIVATE): Define.
> * config.make.in (config-math-noprivate): New variable.
> * configure.ac: Recognize --enable-math-noprivate option.
> * manual/install.texi (Configuring and compiling): Document
> --enable-math-noprivate.
> * configure: Regenerate.
> * INSTALL: Likewise.
> * include/errno.h: Do not redefine errno for libm, libmvec if
> CONFIG_MATH_NOPRIVATE.
Ping. These patches
<https://sourceware.org/ml/libc-alpha/2018-05/msg00501.html>
<https://sourceware.org/ml/libc-alpha/2018-05/msg00541.html>
allow building libm.so.6 without GLIBC_PRIVATE references on aarch64,
and on x86-64 if --disable-multi-arch is also specified (I have a patch
to add multi-arch support for the latter, but I need to come up with
something that reduces the maintenance burden).
Thanks,
Florian
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] Introduce --enable-math-noprivate
2018-05-16 4:54 ` Florian Weimer
@ 2018-06-07 13:38 ` Florian Weimer
2018-06-08 9:03 ` Szabolcs Nagy
0 siblings, 1 reply; 17+ messages in thread
From: Florian Weimer @ 2018-06-07 13:38 UTC (permalink / raw)
To: libc-alpha
On 05/16/2018 06:54 AM, Florian Weimer wrote:
> On 05/11/2018 05:43 PM, Florian Weimer wrote:
>> Avoid errno@GLIBC_PRIVATE if enabled. Additional work is needed
>> to eliminate further GLIBC_PRIVATE symbol references.
>>
>> 2018-05-11Â Florian Weimer<fweimer@redhat.com>
>>
>> Â Â Â Â Introduce --enable-math-noprivate.
>> Â Â Â Â Avoid errno@GLIBC_PRIVATE if enabled.
>> Â Â Â Â * config.h.in (CONFIG_MATH_NOPRIVATE): Define.
>> Â Â Â Â * config.make.in (config-math-noprivate): New variable.
>> Â Â Â Â * configure.ac: Recognize --enable-math-noprivate option.
>> Â Â Â Â * manual/install.texi (Configuring and compiling): Document
>> Â Â Â Â --enable-math-noprivate.
>> Â Â Â Â * configure: Regenerate.
>> Â Â Â Â * INSTALL: Likewise.
>> Â Â Â Â * include/errno.h: Do not redefine errno for libm, libmvec if
>> Â Â Â Â CONFIG_MATH_NOPRIVATE.
>
> Ping. These patches
>
> <https://sourceware.org/ml/libc-alpha/2018-05/msg00501.html>
> <https://sourceware.org/ml/libc-alpha/2018-05/msg00541.html>
>
> allow building libm.so.6 without GLIBC_PRIVATE references on aarch64,
> and on x86-64 if --disable-multi-arch is also specified (I have a patch
> to add multi-arch support for the latter, but I need to come up with
> something that reduces the maintenance burden).
Ping?
What's the general feeling regarding this feature?
Thanks,
Florian
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] Introduce --enable-math-noprivate
2018-06-07 13:38 ` Florian Weimer
@ 2018-06-08 9:03 ` Szabolcs Nagy
2018-06-08 11:22 ` Adhemerval Zanella
2018-06-08 12:11 ` Florian Weimer
0 siblings, 2 replies; 17+ messages in thread
From: Szabolcs Nagy @ 2018-06-08 9:03 UTC (permalink / raw)
To: Florian Weimer, libc-alpha; +Cc: nd
On 07/06/18 14:38, Florian Weimer wrote:
> On 05/16/2018 06:54 AM, Florian Weimer wrote:
>> On 05/11/2018 05:43 PM, Florian Weimer wrote:
>>> Avoid errno@GLIBC_PRIVATE if enabled. Additional work is needed
>>> to eliminate further GLIBC_PRIVATE symbol references.
>>>
>>> 2018-05-11Â Florian Weimer<fweimer@redhat.com>
>>>
>>> Â Â Â Â Introduce --enable-math-noprivate.
>>> Â Â Â Â Avoid errno@GLIBC_PRIVATE if enabled.
>>> Â Â Â Â * config.h.in (CONFIG_MATH_NOPRIVATE): Define.
>>> Â Â Â Â * config.make.in (config-math-noprivate): New variable.
>>> Â Â Â Â * configure.ac: Recognize --enable-math-noprivate option.
>>> Â Â Â Â * manual/install.texi (Configuring and compiling): Document
>>> Â Â Â Â --enable-math-noprivate.
>>> Â Â Â Â * configure: Regenerate.
>>> Â Â Â Â * INSTALL: Likewise.
>>> Â Â Â Â * include/errno.h: Do not redefine errno for libm, libmvec if
>>> Â Â Â Â CONFIG_MATH_NOPRIVATE.
>>
>> Ping. These patches
>>
>> <https://sourceware.org/ml/libc-alpha/2018-05/msg00501.html>
>> <https://sourceware.org/ml/libc-alpha/2018-05/msg00541.html>
>>
>> allow building libm.so.6 without GLIBC_PRIVATE references on aarch64, and on x86-64 if --disable-multi-arch is also specified (I have a patch
>> to add multi-arch support for the latter, but I need to come up with something that reduces the maintenance burden).
>
> Ping?
>
> What's the general feeling regarding this feature?
independently updatable libm can be useful
(or something that works from an LD_LIBRARY_PATH)
when users of a very-stable-distro want to use the
latest libm (assuming libm improves over time) or
somebody wants to provide a libm with different
precision guarantees.
but i can see that ifunc may be ugly to implement.
(or soft float, or fenv or strtod using nan)
if one updates libm.so will that also update math.h?
or we just want a libm with backward compatible abi?
either way i think it should be possible to do and
since glibc is currently very hard to update on a
system it can be useful.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] Introduce --enable-math-noprivate
2018-06-08 9:03 ` Szabolcs Nagy
@ 2018-06-08 11:22 ` Adhemerval Zanella
2018-06-08 12:12 ` Florian Weimer
2018-06-08 12:11 ` Florian Weimer
1 sibling, 1 reply; 17+ messages in thread
From: Adhemerval Zanella @ 2018-06-08 11:22 UTC (permalink / raw)
To: libc-alpha
On 08/06/2018 06:03, Szabolcs Nagy wrote:
> On 07/06/18 14:38, Florian Weimer wrote:
>> On 05/16/2018 06:54 AM, Florian Weimer wrote:
>>> On 05/11/2018 05:43 PM, Florian Weimer wrote:
>>>> Avoid errno@GLIBC_PRIVATE if enabled. Additional work is needed
>>>> to eliminate further GLIBC_PRIVATE symbol references.
>>>>
>>>> 2018-05-11Â Florian Weimer<fweimer@redhat.com>
>>>>
>>>> Â Â Â Â Introduce --enable-math-noprivate.
>>>> Â Â Â Â Avoid errno@GLIBC_PRIVATE if enabled.
>>>> Â Â Â Â * config.h.in (CONFIG_MATH_NOPRIVATE): Define.
>>>> Â Â Â Â * config.make.in (config-math-noprivate): New variable.
>>>> Â Â Â Â * configure.ac: Recognize --enable-math-noprivate option.
>>>> Â Â Â Â * manual/install.texi (Configuring and compiling): Document
>>>> Â Â Â Â --enable-math-noprivate.
>>>> Â Â Â Â * configure: Regenerate.
>>>> Â Â Â Â * INSTALL: Likewise.
>>>> Â Â Â Â * include/errno.h: Do not redefine errno for libm, libmvec if
>>>> Â Â Â Â CONFIG_MATH_NOPRIVATE.
>>>
>>> Ping. These patches
>>>
>>> <https://sourceware.org/ml/libc-alpha/2018-05/msg00501.html>
>>> <https://sourceware.org/ml/libc-alpha/2018-05/msg00541.html>
>>>
>>> allow building libm.so.6 without GLIBC_PRIVATE references on aarch64, and on x86-64 if --disable-multi-arch is also specified (I have a patch to add multi-arch support for the latter, but I need to come up with something that reduces the maintenance burden).
>>
>> Ping?
>>
>> What's the general feeling regarding this feature?
>
> independently updatable libm can be useful
> (or something that works from an LD_LIBRARY_PATH)
> when users of a very-stable-distro want to use the
> latest libm (assuming libm improves over time) or
> somebody wants to provide a libm with different
> precision guarantees.
>
> but i can see that ifunc may be ugly to implement.
> (or soft float, or fenv or strtod using nan)
>
> if one updates libm.so will that also update math.h?
> or we just want a libm with backward compatible abi?
> either way i think it should be possible to do and
> since glibc is currently very hard to update on a
> system it can be useful.
I think it should be a transitional configuration option with a plan to make it
default and later remove it once we have all bits upstream (maybe next release).
Which kind of fixes do you see it still requires to make it a default option?
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] Introduce --enable-math-noprivate
2018-06-08 9:03 ` Szabolcs Nagy
2018-06-08 11:22 ` Adhemerval Zanella
@ 2018-06-08 12:11 ` Florian Weimer
1 sibling, 0 replies; 17+ messages in thread
From: Florian Weimer @ 2018-06-08 12:11 UTC (permalink / raw)
To: Szabolcs Nagy, libc-alpha; +Cc: nd
On 06/08/2018 11:03 AM, Szabolcs Nagy wrote:
>>> Ping. These patches
>>>
>>> <https://sourceware.org/ml/libc-alpha/2018-05/msg00501.html>
>>> <https://sourceware.org/ml/libc-alpha/2018-05/msg00541.html>
>>>
>>> allow building libm.so.6 without GLIBC_PRIVATE references on aarch64,
>>> and on x86-64 if --disable-multi-arch is also specified (I have a
>>> patch to add multi-arch support for the latter, but I need to come up
>>> with something that reduces the maintenance burden).
>>
>> Ping?
>>
>> What's the general feeling regarding this feature?
>
> independently updatable libm can be useful
> (or something that works from an LD_LIBRARY_PATH)
> when users of a very-stable-distro want to use the
> latest libm (assuming libm improves over time) or
> somebody wants to provide a libm with different
> precision guarantees.
>
> but i can see that ifunc may be ugly to implement.
> (or soft float, or fenv or strtod using nan)
The strtod/nan part should be covered by the second patch. I don't know
yet what the problems with soft float will be. To be honest, I'm not
particularly interested in soft-float. 8-/
IFUNC handling need per-architecture changes. On some targets, it
simply means removing IFUNC resolvers which always return the same
function. On other targets, it requires to duplicate the dispatching
logic found in libc inside libm.
There could be a problem if the dispatching logic depends on the
auxiliary vector passed by the kernel. libm will not have access to
that during relocation.
> if one updates libm.so will that also update math.h?
I don't think that will be easy to support.
> or we just want a libm with backward compatible abi?
For now, yes.
Thanks,
Florian
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] Introduce --enable-math-noprivate
2018-06-08 11:22 ` Adhemerval Zanella
@ 2018-06-08 12:12 ` Florian Weimer
2018-06-08 12:56 ` Adhemerval Zanella
0 siblings, 1 reply; 17+ messages in thread
From: Florian Weimer @ 2018-06-08 12:12 UTC (permalink / raw)
To: Adhemerval Zanella, libc-alpha
On 06/08/2018 01:22 PM, Adhemerval Zanella wrote:
> I think it should be a transitional configuration option with a plan to make it
> default and later remove it once we have all bits upstream (maybe next release).
> Which kind of fixes do you see it still requires to make it a default option?
I didn't expect to make it the default because there is a size increase,
and not all architectures will be able to support it.
Thanks,
Florian
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] Introduce --enable-math-noprivate
2018-06-08 12:12 ` Florian Weimer
@ 2018-06-08 12:56 ` Adhemerval Zanella
0 siblings, 0 replies; 17+ messages in thread
From: Adhemerval Zanella @ 2018-06-08 12:56 UTC (permalink / raw)
To: Florian Weimer, libc-alpha
On 08/06/2018 09:12, Florian Weimer wrote:
> On 06/08/2018 01:22 PM, Adhemerval Zanella wrote:
>> I think it should be a transitional configuration option with a plan to make it
>> default and later remove it once we have all bits upstream (maybe next release).
>> Which kind of fixes do you see it still requires to make it a default option?
>
> I didn't expect to make it the default because there is a size increase, and not all architectures will be able to support it.
>
> Thanks,
> Florian
My reservations about this change is adding another optional feature which
requires an extra build to check and test. It also sets different expectations
and semantics for different architecture, for instance someone might find
this option does not work on his targeting architecture (this is different
than libmvec which adds an extra option library).
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] Introduce --enable-math-noprivate
2018-09-20 17:25 ` Florian Weimer
@ 2018-09-20 17:35 ` Joseph Myers
0 siblings, 0 replies; 17+ messages in thread
From: Joseph Myers @ 2018-09-20 17:35 UTC (permalink / raw)
To: Florian Weimer; +Cc: Wilco Dijkstra, libc-alpha, nd
On Thu, 20 Sep 2018, Florian Weimer wrote:
> Oohh, we have happy accident here that we can reuse the existing
> historic __strtoul_internal export, which isn't GLIBC_PRIVATE for some
> reason (probably for libstdc++'s sake).
Presumably because there used to be inline functions in the public headers
that used those exports, until commit
9b2e9577b228350b15d88303b00097dd58e8d29 in 2007.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] Introduce --enable-math-noprivate
2018-09-20 17:11 ` Joseph Myers
@ 2018-09-20 17:25 ` Florian Weimer
2018-09-20 17:35 ` Joseph Myers
0 siblings, 1 reply; 17+ messages in thread
From: Florian Weimer @ 2018-09-20 17:25 UTC (permalink / raw)
To: Joseph Myers; +Cc: Wilco Dijkstra, libc-alpha, nd
* Joseph Myers:
> On Thu, 20 Sep 2018, Florian Weimer wrote:
>
>> > Similarly the strtod_nan* dependency seems worthwhile to remove too.
>>
>> I haven't thought about this. It's certainly a bit of a code
>> duplication.
>>
>> Joseph, any thoughts on that?
>
> Well, sharing the implementation of NaN parsing between the nan functions
> and the strto* functions seemed to make sense (the old approach of the nan
> functions calling strto* having had problems as discussed in bugs 16961
> and 16962). And to share it at the binary level, not just the source
> level, meant GLIBC_PRIVATE exports. Since such exports are completely
> normal as the way for one glibc library to use internal functionality from
> another, I see no obvious reason to avoid using them by default, as
> opposed to with non-default configure options like this one.
Oohh, we have happy accident here that we can reuse the existing
historic __strtoul_internal export, which isn't GLIBC_PRIVATE for some
reason (probably for libstdc++'s sake).
> There's potential for the functions to get more complicated in the
> _Float128 / binary128 long double case - the present approach is unable to
> represent NaN significand bits outside the trailing 64 (and fixing that
> would mean having something like strtoull that handles integers up to at
> least 111 bits - in which case either that something would need exporting
> from libc as public, or it would need exporting as GLIBC_PRIVATE and
> duplicating with the new option). (You can construct NaNs with arbitrary
> payloads using setpayload functions, but having the nan/strto functions be
> able to do so as well would seem natural.)
Right, I think we might get more GLIBC_PRIVATE shortcuts in the future.
This is one reason why I think that --enable-math-noprivate might be
controversial: it's one more configuration to test, and we must make
sure that we can duplicate symbols (with hidden visiblity) into libm as
needed.
Thanks,
Florian
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] Introduce --enable-math-noprivate
2018-09-20 16:58 ` Florian Weimer
@ 2018-09-20 17:11 ` Joseph Myers
2018-09-20 17:25 ` Florian Weimer
0 siblings, 1 reply; 17+ messages in thread
From: Joseph Myers @ 2018-09-20 17:11 UTC (permalink / raw)
To: Florian Weimer; +Cc: Wilco Dijkstra, libc-alpha, nd
On Thu, 20 Sep 2018, Florian Weimer wrote:
> > Similarly the strtod_nan* dependency seems worthwhile to remove too.
>
> I haven't thought about this. It's certainly a bit of a code
> duplication.
>
> Joseph, any thoughts on that?
Well, sharing the implementation of NaN parsing between the nan functions
and the strto* functions seemed to make sense (the old approach of the nan
functions calling strto* having had problems as discussed in bugs 16961
and 16962). And to share it at the binary level, not just the source
level, meant GLIBC_PRIVATE exports. Since such exports are completely
normal as the way for one glibc library to use internal functionality from
another, I see no obvious reason to avoid using them by default, as
opposed to with non-default configure options like this one.
There's potential for the functions to get more complicated in the
_Float128 / binary128 long double case - the present approach is unable to
represent NaN significand bits outside the trailing 64 (and fixing that
would mean having something like strtoull that handles integers up to at
least 111 bits - in which case either that something would need exporting
from libc as public, or it would need exporting as GLIBC_PRIVATE and
duplicating with the new option). (You can construct NaNs with arbitrary
payloads using setpayload functions, but having the nan/strto functions be
able to do so as well would seem natural.)
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] Introduce --enable-math-noprivate
2018-09-20 16:27 Wilco Dijkstra
2018-09-20 16:35 ` Joseph Myers
@ 2018-09-20 16:58 ` Florian Weimer
2018-09-20 17:11 ` Joseph Myers
1 sibling, 1 reply; 17+ messages in thread
From: Florian Weimer @ 2018-09-20 16:58 UTC (permalink / raw)
To: Wilco Dijkstra; +Cc: libc-alpha, nd, Joseph Myers
* Wilco Dijkstra:
> My question is, would a new config option really be useful? Errno can
> be set outside the critical paths, so inlining it doesn't help at
> all. Therefore this should be done by default.
I can submit a patch to that effect, basically making that part
unconditional.
> Similarly the strtod_nan* dependency seems worthwhile to remove too.
I haven't thought about this. It's certainly a bit of a code
duplication.
Joseph, any thoughts on that?
> If these are the main dependencies between libc and libm, I can't see
> the value of adding a new config option.
The IFUNC resolvers on x86-64 use a GLIBC_PRIVATE symbol from ld.so.
That's going to be a bit more complicated to remove, and what we have to
do there is still a bit unclear to me. (I had a proof-of-concept patch
which actually reimplemented part of sysdeps/x86/cpu-features.c, but
didn't want to submit that so far.)
My expectation is that at least for x86, we'd still want
--enable-math-noprivate. (Maybe not in the distant future when we can
assume that H.J.'s new feature bit access interface is available
everywhere. 8-)
Thanks,
Florian
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] Introduce --enable-math-noprivate
2018-09-20 16:27 Wilco Dijkstra
@ 2018-09-20 16:35 ` Joseph Myers
2018-09-20 16:58 ` Florian Weimer
1 sibling, 0 replies; 17+ messages in thread
From: Joseph Myers @ 2018-09-20 16:35 UTC (permalink / raw)
To: Wilco Dijkstra; +Cc: Florian Weimer, libc-alpha, nd
On Thu, 20 Sep 2018, Wilco Dijkstra wrote:
> Similarly the strtod_nan* dependency seems worthwhile to remove too.
> If these are the main dependencies between libc and libm, I can't see
> the value of adding a new config option.
I could envisage adding GLIBC_PRIVATE exports of the GMP functions in
libc, and using those from libm, as part of fixing the problems with
inaccuracy of cpow functions (which requires very high internal precision
for some arguments).
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] Introduce --enable-math-noprivate
@ 2018-09-20 16:27 Wilco Dijkstra
2018-09-20 16:35 ` Joseph Myers
2018-09-20 16:58 ` Florian Weimer
0 siblings, 2 replies; 17+ messages in thread
From: Wilco Dijkstra @ 2018-09-20 16:27 UTC (permalink / raw)
To: Florian Weimer; +Cc: libc-alpha, nd
Hi Florian,
My question is, would a new config option really be useful? Errno can be set
outside the critical paths, so inlining it doesn't help at all. Therefore this should
be done by default.
Similarly the strtod_nan* dependency seems worthwhile to remove too.
If these are the main dependencies between libc and libm, I can't see
the value of adding a new config option.
Wilco
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH] Introduce --enable-math-noprivate
@ 2018-09-20 14:01 Florian Weimer
0 siblings, 0 replies; 17+ messages in thread
From: Florian Weimer @ 2018-09-20 14:01 UTC (permalink / raw)
To: libc-alpha
This is a (rebased) repost of my --enable-math-noprivate patch.
It will need a companion patch to deal with the GLIBC_PRIVATE symbol
references in math/s_nan_template.c, which I will post shortly.
Is this still a direction we want to move in?
Downstream, I can at least put this into EPEL once approved for glibc
master, and we can take it from there.
Thanks,
Florian
Commit message:
Avoid errno@GLIBC_PRIVATE if enabled. Additional work is needed
to eliminate further GLIBC_PRIVATE symbol references.
Changelog entry:
2018-09-20 Florian Weimer <fweimer@redhat.com>
Introduce --enable-math-noprivate.
Avoid errno@GLIBC_PRIVATE if enabled.
* config.h.in (CONFIG_MATH_NOPRIVATE): Define.
* config.make.in (config-math-noprivate): New variable.
* configure.ac: Recognize --enable-math-noprivate option.
* manual/install.texi (Configuring and compiling): Document
--enable-math-noprivate.
* configure: Regenerate.
* INSTALL: Likewise.
* include/errno.h: Do not redefine errno for libm, libmvec if
CONFIG_MATH_NOPRIVATE.
diff --git a/INSTALL b/INSTALL
index 4faeac4469..6b09109783 100644
--- a/INSTALL
+++ b/INSTALL
@@ -240,6 +240,13 @@ if 'CFLAGS' is specified it must enable optimization. For example:
independently-maintained implementations of libcrypt. It may
become the default in a future release.
+'--enable-math-noprivate'
+ By default, libm and libmvec (if available) are built in such a way
+ that they rely on internals in the rest of the library (notably
+ libc). With this option, the math libraries are built in a way
+ that avoids such dependencies. As a result, it is possible to use
+ them with older versions of the library.
+
'--disable-experimental-malloc'
By default, a per-thread cache is enabled in 'malloc'. While this
cache can be disabled on a per-application basis using tunables
diff --git a/config.h.in b/config.h.in
index 141db213a9..316444e845 100644
--- a/config.h.in
+++ b/config.h.in
@@ -153,6 +153,10 @@
code to link against. */
#undef LINK_OBSOLETE_NSL
+/* Define as 1 if GLIBC_PRIVATE symbols should be avoided in the math
+ libraries. */
+#define CONFIG_MATH_NOPRIVATE 0
+
/* Define if Systemtap <sys/sdt.h> probes should be defined. */
#undef USE_STAP_PROBE
diff --git a/config.make.in b/config.make.in
index a6fe48d31f..98b4a17b9e 100644
--- a/config.make.in
+++ b/config.make.in
@@ -102,6 +102,7 @@ use-nscd = @use_nscd@
build-hardcoded-path-in-tests= @hardcoded_path_in_tests@
build-pt-chown = @build_pt_chown@
have-tunables = @have_tunables@
+config-math-noprivate = @config_math_noprivate@
# Build tools.
CC = @CC@
diff --git a/configure b/configure
index 285a6537f0..673bc27d54 100755
--- a/configure
+++ b/configure
@@ -672,6 +672,7 @@ base_machine
have_tunables
build_pt_chown
build_nscd
+config_math_noprivate
build_obsolete_nsl
link_obsolete_rpc
libc_cv_static_nss_crypt
@@ -786,6 +787,7 @@ enable_crypt
enable_nss_crypt
enable_obsolete_rpc
enable_obsolete_nsl
+enable_math_noprivate
enable_systemtap
enable_build_nscd
enable_nscd
@@ -1460,6 +1462,7 @@ Optional Features:
link-time usage
--enable-obsolete-nsl build and install the obsolete libnsl library and
depending NSS modules
+ --enable-math-noprivate avoid GLIBC_PRIVATE symbols in math libraries
--enable-systemtap enable systemtap static probe points [default=no]
--disable-build-nscd disable building and installing the nscd daemon
--disable-nscd library functions will not contact the nscd daemon
@@ -3667,6 +3670,19 @@ if test "$build_obsolete_nsl" = yes; then
fi
+# Check whether --enable-math-noprivate was given.
+if test "${enable_math_noprivate+set}" = set; then :
+ enableval=$enable_math_noprivate; config_math_noprivate=$enableval
+else
+ config_math_noprivate=no
+fi
+
+
+if test "$config_math_noprivate" = yes; then
+ $as_echo "#define CONFIG_MATH_NOPRIVATE 1" >>confdefs.h
+
+fi
+
# Check whether --enable-systemtap was given.
if test "${enable_systemtap+set}" = set; then :
enableval=$enable_systemtap; systemtap=$enableval
diff --git a/configure.ac b/configure.ac
index 8045d44dd0..f1e66caa1f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -397,6 +397,16 @@ if test "$build_obsolete_nsl" = yes; then
AC_DEFINE(LINK_OBSOLETE_NSL)
fi
+AC_ARG_ENABLE([math-noprivate],
+ AC_HELP_STRING([--enable-math-noprivate],
+ [avoid GLIBC_PRIVATE symbols in math libraries]),
+ [config_math_noprivate=$enableval],
+ [config_math_noprivate=no])
+AC_SUBST(config_math_noprivate)
+if test "$config_math_noprivate" = yes; then
+ AC_DEFINE(CONFIG_MATH_NOPRIVATE)
+fi
+
AC_ARG_ENABLE([systemtap],
[AS_HELP_STRING([--enable-systemtap],
[enable systemtap static probe points @<:@default=no@:>@])],
diff --git a/include/errno.h b/include/errno.h
index 457114b27a..6c0e0b94ef 100644
--- a/include/errno.h
+++ b/include/errno.h
@@ -20,7 +20,8 @@
# define errno rtld_errno
extern int rtld_errno attribute_hidden;
-# elif IS_IN_LIB && !IS_IN (rtld)
+# elif IS_IN_LIB && !IS_IN (rtld) \
+ && (!CONFIG_MATH_NOPRIVATE || !(IS_IN (libm) || IS_IN (libmvec)))
# include <tls.h>
diff --git a/manual/install.texi b/manual/install.texi
index eab4b0d75a..dd601b6c4f 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -271,6 +271,13 @@ This option is for hackers and distributions experimenting with
independently-maintained implementations of libcrypt. It may become
the default in a future release.
+@item --enable-math-noprivate
+By default, libm and libmvec (if available) are built in such a way that
+they rely on internals in the rest of the library (notably libc). With
+this option, the math libraries are built in a way that avoids such
+dependencies. As a result, it is possible to use them with older
+versions of the library.
+
@item --disable-experimental-malloc
By default, a per-thread cache is enabled in @code{malloc}. While
this cache can be disabled on a per-application basis using tunables
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2018-09-20 17:35 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-11 15:43 [PATCH] Introduce --enable-math-noprivate Florian Weimer
2018-05-11 16:36 ` Adhemerval Zanella
2018-05-11 17:23 ` Florian Weimer
2018-05-16 4:54 ` Florian Weimer
2018-06-07 13:38 ` Florian Weimer
2018-06-08 9:03 ` Szabolcs Nagy
2018-06-08 11:22 ` Adhemerval Zanella
2018-06-08 12:12 ` Florian Weimer
2018-06-08 12:56 ` Adhemerval Zanella
2018-06-08 12:11 ` Florian Weimer
2018-09-20 14:01 Florian Weimer
2018-09-20 16:27 Wilco Dijkstra
2018-09-20 16:35 ` Joseph Myers
2018-09-20 16:58 ` Florian Weimer
2018-09-20 17:11 ` Joseph Myers
2018-09-20 17:25 ` Florian Weimer
2018-09-20 17:35 ` Joseph Myers
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).