[14/16] linux: Move {f}xstat{at} to compat symbols
Commit Message
They are not used internally anymore.
Checked with a build for all affected Linux ABIs. I checked also
on x86_64-linux-gnu and i686-linux-gnu.
---
sysdeps/unix/sysv/linux/alpha/fxstat64.c | 12 ++++++++++-
sysdeps/unix/sysv/linux/alpha/fxstatat64.c | 9 +++++++-
sysdeps/unix/sysv/linux/alpha/lxstat64.c | 12 ++++++++++-
sysdeps/unix/sysv/linux/alpha/xstat64.c | 12 ++++++++++-
sysdeps/unix/sysv/linux/fxstat.c | 8 +++++++
sysdeps/unix/sysv/linux/fxstat64.c | 14 +++++++++----
sysdeps/unix/sysv/linux/fxstatat.c | 8 +++++++
sysdeps/unix/sysv/linux/fxstatat64.c | 12 ++++++++++-
sysdeps/unix/sysv/linux/lxstat.c | 8 +++++++
sysdeps/unix/sysv/linux/lxstat64.c | 21 ++++++++++++-------
sysdeps/unix/sysv/linux/mips/fxstat.c | 8 +++++++
sysdeps/unix/sysv/linux/mips/lxstat.c | 8 +++++++
.../unix/sysv/linux/mips/mips64/fxstat64.c | 8 +++++++
.../unix/sysv/linux/mips/mips64/fxstatat.c | 8 +++++++
.../unix/sysv/linux/mips/mips64/fxstatat64.c | 8 +++++++
.../unix/sysv/linux/mips/mips64/lxstat64.c | 8 +++++++
sysdeps/unix/sysv/linux/mips/mips64/xstat64.c | 9 +++++++-
sysdeps/unix/sysv/linux/mips/xstat.c | 8 +++++++
sysdeps/unix/sysv/linux/xstat.c | 9 ++++++++
sysdeps/unix/sysv/linux/xstat64.c | 15 ++++++++-----
20 files changed, 182 insertions(+), 23 deletions(-)
Comments
On Thu, 23 Jul 2020 16:46:39 -0300
Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:
> They are not used internally anymore.
>
> Checked with a build for all affected Linux ABIs. I checked also
> on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Lukasz Majewski <lukma@denx.de>
> ---
> sysdeps/unix/sysv/linux/alpha/fxstat64.c | 12 ++++++++++-
> sysdeps/unix/sysv/linux/alpha/fxstatat64.c | 9 +++++++-
> sysdeps/unix/sysv/linux/alpha/lxstat64.c | 12 ++++++++++-
> sysdeps/unix/sysv/linux/alpha/xstat64.c | 12 ++++++++++-
> sysdeps/unix/sysv/linux/fxstat.c | 8 +++++++
> sysdeps/unix/sysv/linux/fxstat64.c | 14 +++++++++----
> sysdeps/unix/sysv/linux/fxstatat.c | 8 +++++++
> sysdeps/unix/sysv/linux/fxstatat64.c | 12 ++++++++++-
> sysdeps/unix/sysv/linux/lxstat.c | 8 +++++++
> sysdeps/unix/sysv/linux/lxstat64.c | 21
> ++++++++++++------- sysdeps/unix/sysv/linux/mips/fxstat.c |
> 8 +++++++ sysdeps/unix/sysv/linux/mips/lxstat.c | 8 +++++++
> .../unix/sysv/linux/mips/mips64/fxstat64.c | 8 +++++++
> .../unix/sysv/linux/mips/mips64/fxstatat.c | 8 +++++++
> .../unix/sysv/linux/mips/mips64/fxstatat64.c | 8 +++++++
> .../unix/sysv/linux/mips/mips64/lxstat64.c | 8 +++++++
> sysdeps/unix/sysv/linux/mips/mips64/xstat64.c | 9 +++++++-
> sysdeps/unix/sysv/linux/mips/xstat.c | 8 +++++++
> sysdeps/unix/sysv/linux/xstat.c | 9 ++++++++
> sysdeps/unix/sysv/linux/xstat64.c | 15 ++++++++-----
> 20 files changed, 182 insertions(+), 23 deletions(-)
>
> diff --git a/sysdeps/unix/sysv/linux/alpha/fxstat64.c
> b/sysdeps/unix/sysv/linux/alpha/fxstat64.c index
> 9d6b8eca32..bcfb55050c 100644 ---
> a/sysdeps/unix/sysv/linux/alpha/fxstat64.c +++
> b/sysdeps/unix/sysv/linux/alpha/fxstat64.c @@ -22,9 +22,11 @@
> #include <kernel_stat.h>
> #include <sysdep.h>
> #include <xstatconv.h>
> +#include <shlib-compat.h>
>
> /* Get information about the file NAME in BUF. */
> int
> +attribute_compat_text_section
> __fxstat64 (int vers, int fd, struct stat64 *buf)
> {
> switch (vers)
> @@ -42,4 +44,12 @@ __fxstat64 (int vers, int fd, struct stat64 *buf)
> }
> }
> }
> -strong_alias (__fxstat64, __fxstat);
> +
> +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
> +strong_alias (__fxstat64, __fxstat_compat)
> +compat_symbol (libc, __fxstat_compat, __fxstat, GLIBC_2_0);
> +#endif
> +
> +#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_33)
> +compat_symbol (libc, __fxstat64, __fxstat64, GLIBC_2_1);
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/alpha/fxstatat64.c
> b/sysdeps/unix/sysv/linux/alpha/fxstatat64.c index
> 997fb87ac6..fa3074eeca 100644 ---
> a/sysdeps/unix/sysv/linux/alpha/fxstatat64.c +++
> b/sysdeps/unix/sysv/linux/alpha/fxstatat64.c @@ -22,11 +22,18 @@
> #include <kernel_stat.h>
> #include <sysdep.h>
> #include <xstatconv.h>
> +#include <shlib-compat.h>
>
> +#if SHLIB_COMPAT(libc, GLIBC_2_4, GLIBC_2_33)
> /* Get information about the file NAME in BUF. */
> int
> +attribute_compat_text_section
> __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st,
> int flag) {
> return INLINE_SYSCALL_CALL (fstatat64, fd, file, st, flag);
> }
> -strong_alias (__fxstatat64, __fxstatat);
> +strong_alias (__fxstatat64, __fxstatat_compat)
> +compat_symbol (libc, __fxstatat_compat, __fxstatat, GLIBC_2_4);
> +
> +compat_symbol (libc, __fxstatat64, __fxstatat64, GLIBC_2_4);
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/alpha/lxstat64.c
> b/sysdeps/unix/sysv/linux/alpha/lxstat64.c index
> 38f132f15e..7424b2f621 100644 ---
> a/sysdeps/unix/sysv/linux/alpha/lxstat64.c +++
> b/sysdeps/unix/sysv/linux/alpha/lxstat64.c @@ -23,9 +23,11 @@
> #include <kernel_stat.h>
> #include <sysdep.h>
> #include <xstatconv.h>
> +#include <shlib-compat.h>
>
> /* Get information about the file NAME in BUF. */
> int
> +attribute_compat_text_section
> __lxstat64 (int vers, const char *name, struct stat64 *buf)
> {
> switch (vers)
> @@ -43,4 +45,12 @@ __lxstat64 (int vers, const char *name, struct
> stat64 *buf) }
> }
> }
> -weak_alias (__lxstat64, __lxstat);
> +
> +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
> +strong_alias (__lxstat64, __lxstat_compat)
> +compat_symbol (libc, __lxstat_compat, __lxstat, GLIBC_2_0);
> +#endif
> +
> +#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_33)
> +compat_symbol (libc, __lxstat64, __lxstat64, GLIBC_2_1);
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/alpha/xstat64.c
> b/sysdeps/unix/sysv/linux/alpha/xstat64.c index
> c856c95dc5..59f7ddae7f 100644 ---
> a/sysdeps/unix/sysv/linux/alpha/xstat64.c +++
> b/sysdeps/unix/sysv/linux/alpha/xstat64.c @@ -23,9 +23,11 @@
> #include <kernel_stat.h>
> #include <sysdep.h>
> #include <xstatconv.h>
> +#include <shlib-compat.h>
>
> /* Get information about the file NAME in BUF. */
> int
> +attribute_compat_text_section
> __xstat64 (int vers, const char *name, struct stat64 *buf)
> {
> switch (vers)
> @@ -43,4 +45,12 @@ __xstat64 (int vers, const char *name, struct
> stat64 *buf) }
> }
> }
> -weak_alias (__xstat64, __xstat);
> +
> +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
> +strong_alias (__xstat64, __xstat_compat)
> +compat_symbol (libc, __xstat_compat, __xstat, GLIBC_2_0);
> +#endif
> +
> +#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_33)
> +compat_symbol (libc, __xstat64, __xstat64, GLIBC_2_1);
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/fxstat.c
> b/sysdeps/unix/sysv/linux/fxstat.c index f78497ea92..649bb95252 100644
> --- a/sysdeps/unix/sysv/linux/fxstat.c
> +++ b/sysdeps/unix/sysv/linux/fxstat.c
> @@ -24,9 +24,13 @@
> #if !XSTAT_IS_XSTAT64
> # include <xstatconv.h>
> # include <xstatover.h>
> +# include <shlib-compat.h>
> +
> +# if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
>
> /* Get information about the file FD in BUF. */
> int
> +attribute_compat_text_section
> __fxstat (int vers, int fd, struct stat *buf)
> {
> switch (vers)
> @@ -57,4 +61,8 @@ __fxstat (int vers, int fd, struct stat *buf)
> }
> }
> }
> +
> +compat_symbol (libc, __fxstat, __fxstat, GLIBC_2_0);
> +# endif /* SHLIB_COMPAT */
> +
> #endif /* XSTAT_IS_XSTAT64 */
> diff --git a/sysdeps/unix/sysv/linux/fxstat64.c
> b/sysdeps/unix/sysv/linux/fxstat64.c index 6ae7babccc..726dfd0ad6
> 100644 --- a/sysdeps/unix/sysv/linux/fxstat64.c
> +++ b/sysdeps/unix/sysv/linux/fxstat64.c
> @@ -24,10 +24,14 @@
> #include <sysdep.h>
> #include <xstatconv.h>
> #include <statx_cp.h>
> +#include <shlib-compat.h>
> +
> +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
>
> /* Get information about the file FD in BUF. */
>
> int
> +attribute_compat_text_section
> ___fxstat64 (int vers, int fd, struct stat64 *buf)
> {
> #if XSTAT_IS_XSTAT64
> @@ -53,16 +57,18 @@ ___fxstat64 (int vers, int fd, struct stat64 *buf)
> #endif /* XSTAT_IS_XSTAT64 */
> }
>
> -#include <shlib-compat.h>
> -
> #if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
> -versioned_symbol (libc, ___fxstat64, __fxstat64, GLIBC_2_2);
> +compat_symbol (libc, ___fxstat64, __fxstat64, GLIBC_2_2);
> strong_alias (___fxstat64, __old__fxstat64)
> compat_symbol (libc, __old__fxstat64, __fxstat64, GLIBC_2_1);
> #else
> strong_alias (___fxstat64, __fxstat64)
> +compat_symbol (libc, ___fxstat64, __fxstat64, GLIBC_2_2);
> #endif
>
> #if XSTAT_IS_XSTAT64
> -strong_alias (__fxstat64, __fxstat);
> +strong_alias (___fxstat64, __fxstat_compat)
> +compat_symbol (libc, __fxstat_compat, __fxstat, GLIBC_2_2);
> #endif
> +
> +#endif /* SHLIB_COMPAT */
> diff --git a/sysdeps/unix/sysv/linux/fxstatat.c
> b/sysdeps/unix/sysv/linux/fxstatat.c index 1a60fc10e3..2083e18eac
> 100644 --- a/sysdeps/unix/sysv/linux/fxstatat.c
> +++ b/sysdeps/unix/sysv/linux/fxstatat.c
> @@ -24,9 +24,13 @@
> #if !XSTAT_IS_XSTAT64
> # include <xstatconv.h>
> # include <xstatover.h>
> +# include <shlib-compat.h>
> +
> +# if SHLIB_COMPAT(libc, GLIBC_2_4, GLIBC_2_33)
>
> /* Get information about the file FD in BUF. */
> int
> +attribute_compat_text_section
> __fxstatat (int vers, int fd, const char *file, struct stat *st, int
> flag) {
> #if STAT_IS_KERNEL_STAT
> @@ -46,4 +50,8 @@ __fxstatat (int vers, int fd, const char *file,
> struct stat *st, int flag) return r ?: __xstat32_conv (vers, &st64,
> st); #endif
> }
> +
> +compat_symbol (libc, __fxstatat, __fxstatat, GLIBC_2_4);
> +# endif /* SHLIB_COMPAT */
> +
> #endif /* XSTAT_IS_XSTAT64 */
> diff --git a/sysdeps/unix/sysv/linux/fxstatat64.c
> b/sysdeps/unix/sysv/linux/fxstatat64.c index 7fe034809c..8a505451d9
> 100644 --- a/sysdeps/unix/sysv/linux/fxstatat64.c
> +++ b/sysdeps/unix/sysv/linux/fxstatat64.c
> @@ -24,10 +24,14 @@
> #include <sysdep.h>
> #include <xstatconv.h>
> #include <statx_cp.h>
> +#include <shlib-compat.h>
> +
> +#if SHLIB_COMPAT(libc, GLIBC_2_4, GLIBC_2_33)
>
> /* Get information about the file FD in BUF. */
>
> int
> +attribute_compat_text_section
> __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st,
> int flag) {
> #if XSTAT_IS_XSTAT64
> @@ -61,6 +65,12 @@ __fxstatat64 (int vers, int fd, const char *file,
> struct stat64 *st, int flag) #endif
> return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL);
> }
> +
> +compat_symbol (libc, __fxstatat64, __fxstatat64, GLIBC_2_4);
> +
> #if XSTAT_IS_XSTAT64
> -strong_alias (__fxstatat64, __fxstatat);
> +strong_alias (__fxstatat64, __fxstatat_compat)
> +compat_symbol (libc, __fxstatat_compat, __fxstatat, GLIBC_2_4);
> #endif
> +
> +#endif /* SHLIB_COMPAT(libc, GLIBC_2_4, GLIBC_2_33) */
> diff --git a/sysdeps/unix/sysv/linux/lxstat.c
> b/sysdeps/unix/sysv/linux/lxstat.c index 156173a4e1..f307aa4942 100644
> --- a/sysdeps/unix/sysv/linux/lxstat.c
> +++ b/sysdeps/unix/sysv/linux/lxstat.c
> @@ -20,13 +20,17 @@
> #include <fcntl.h>
> #include <kernel_stat.h>
> #include <sysdep.h>
> +#include <shlib-compat.h>
>
> #if !XSTAT_IS_XSTAT64
> # include <xstatconv.h>
> # include <xstatover.h>
>
> +# if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
> +
> /* Get information about the file NAME in BUF. */
> int
> +attribute_compat_text_section
> __lxstat (int vers, const char *name, struct stat *buf)
> {
> switch (vers)
> @@ -58,4 +62,8 @@ __lxstat (int vers, const char *name, struct stat
> *buf) }
> }
> }
> +
> +compat_symbol (libc, __lxstat, __lxstat, GLIBC_2_0);
> +# endif /* SHLIB_COMPAT */
> +
> #endif /* XSTAT_IS_XSTAT64 */
> diff --git a/sysdeps/unix/sysv/linux/lxstat64.c
> b/sysdeps/unix/sysv/linux/lxstat64.c index 29bd1cdf72..660d59aea3
> 100644 --- a/sysdeps/unix/sysv/linux/lxstat64.c
> +++ b/sysdeps/unix/sysv/linux/lxstat64.c
> @@ -24,10 +24,14 @@
> #include <sysdep.h>
> #include <xstatconv.h>
> #include <statx_cp.h>
> +#include <shlib-compat.h>
> +
> +#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_33)
>
> /* Get information about the file NAME in BUF. */
>
> int
> +attribute_compat_text_section
> ___lxstat64 (int vers, const char *name, struct stat64 *buf)
> {
> #if XSTAT_IS_XSTAT64
> @@ -70,17 +74,18 @@ ___lxstat64 (int vers, const char *name, struct
> stat64 *buf) return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL);
> }
>
> -#if XSTAT_IS_XSTAT64
> -weak_alias (___lxstat64, __lxstat);
> -weak_alias (___lxstat64, __GI___lxstat);
> -#endif
> -
> -#include <shlib-compat.h>
> -
> #if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
> -versioned_symbol (libc, ___lxstat64, __lxstat64, GLIBC_2_2);
> +compat_symbol (libc, ___lxstat64, __lxstat64, GLIBC_2_2);
> strong_alias (___lxstat64, __old__lxstat64)
> compat_symbol (libc, __old__lxstat64, __lxstat64, GLIBC_2_1);
> #else
> strong_alias (___lxstat64, __lxstat64);
> +compat_symbol (libc, ___lxstat64, __lxstat64, GLIBC_2_2);
> #endif
> +
> +#if XSTAT_IS_XSTAT64
> +strong_alias (___lxstat64,__lxstat_compat)
> +compat_symbol (libc, __lxstat_compat, __lxstat, GLIBC_2_2);
> +#endif
> +
> +#endif /* SHLIB_COMPAT */
> diff --git a/sysdeps/unix/sysv/linux/mips/fxstat.c
> b/sysdeps/unix/sysv/linux/mips/fxstat.c index 4585c2362b..cb9f656628
> 100644 --- a/sysdeps/unix/sysv/linux/mips/fxstat.c
> +++ b/sysdeps/unix/sysv/linux/mips/fxstat.c
> @@ -21,9 +21,13 @@
> #include <kernel_stat.h>
> #include <sysdep.h>
> #include <xstatconv.h>
> +#include <shlib-compat.h>
> +
> +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
>
> /* Get information about the file NAME in BUF. */
> int
> +attribute_compat_text_section
> __fxstat (int vers, int fd, struct stat *buf)
> {
> switch (vers)
> @@ -39,3 +43,7 @@ __fxstat (int vers, int fd, struct stat *buf)
> }
> }
> }
> +
> +compat_symbol (libc, __fxstat, __fxstat, GLIBC_2_0);
> +
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/mips/lxstat.c
> b/sysdeps/unix/sysv/linux/mips/lxstat.c index 62a3b15b32..ebd05cca50
> 100644 --- a/sysdeps/unix/sysv/linux/mips/lxstat.c
> +++ b/sysdeps/unix/sysv/linux/mips/lxstat.c
> @@ -21,9 +21,13 @@
> #include <kernel_stat.h>
> #include <sysdep.h>
> #include <xstatconv.h>
> +#include <shlib-compat.h>
> +
> +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
>
> /* Get information about the file NAME in BUF. */
> int
> +attribute_compat_text_section
> __lxstat (int vers, const char *name, struct stat *buf)
> {
> switch (vers)
> @@ -39,3 +43,7 @@ __lxstat (int vers, const char *name, struct stat
> *buf) }
> }
> }
> +
> +compat_symbol (libc, __lxstat, __lxstat, GLIBC_2_0);
> +
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/fxstat64.c
> b/sysdeps/unix/sysv/linux/mips/mips64/fxstat64.c index
> e6c1cacd4b..855c650814 100644 ---
> a/sysdeps/unix/sysv/linux/mips/mips64/fxstat64.c +++
> b/sysdeps/unix/sysv/linux/mips/mips64/fxstat64.c @@ -20,10 +20,14 @@
> #include <kernel_stat.h>
> #include <sysdep.h>
> #include <xstatconv.h>
> +#include <shlib-compat.h>
> +
> +#if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_33)
>
> /* Get information about the file FD in BUF. */
>
> int
> +attribute_compat_text_section
> __fxstat64 (int vers, int fd, struct stat64 *buf)
> {
> struct kernel_stat kbuf;
> @@ -31,3 +35,7 @@ __fxstat64 (int vers, int fd, struct stat64 *buf)
> return r ?: __xstat64_conv (vers, &kbuf, buf);
>
> }
> +
> +compat_symbol (libc, __fxstat64, __fxstat64, GLIBC_2_2);
> +
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/fxstatat.c
> b/sysdeps/unix/sysv/linux/mips/mips64/fxstatat.c index
> e384dbab8b..1c1fbb02c2 100644 ---
> a/sysdeps/unix/sysv/linux/mips/mips64/fxstatat.c +++
> b/sysdeps/unix/sysv/linux/mips/mips64/fxstatat.c @@ -21,12 +21,20 @@
> #include <kernel_stat.h>
> #include <sysdep.h>
> #include <xstatconv.h>
> +#include <shlib-compat.h>
> +
> +#if SHLIB_COMPAT(libc, GLIBC_2_4, GLIBC_2_33)
>
> /* Get information about the file FD in BUF. */
> int
> +attribute_compat_text_section
> __fxstatat (int vers, int fd, const char *file, struct stat *st, int
> flag) {
> struct kernel_stat kst;
> int r = INLINE_SYSCALL_CALL (newfstatat, fd, file, &kst, flag);
> return r ?: __xstat_conv (vers, &kst, st);
> }
> +
> +compat_symbol (libc, __fxstatat, __fxstatat, GLIBC_2_4);
> +
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c
> b/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c index
> cfd172d301..f40a2c5aa8 100644 ---
> a/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c +++
> b/sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c @@ -19,10 +19,14 @@
> #include <kernel_stat.h>
> #include <sysdep.h>
> #include <xstatconv.h>
> +#include <shlib-compat.h>
> +
> +#if SHLIB_COMPAT(libc, GLIBC_2_4, GLIBC_2_33)
>
> /* Get information about the file NAME in BUF. */
>
> int
> +attribute_compat_text_section
> __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st,
> int flag) {
> if (vers == _STAT_VER_LINUX)
> @@ -33,3 +37,7 @@ __fxstatat64 (int vers, int fd, const char *file,
> struct stat64 *st, int flag) }
> return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL);
> }
> +
> +compat_symbol (libc, __fxstatat64, __fxstatat64, GLIBC_2_4);
> +
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/lxstat64.c
> b/sysdeps/unix/sysv/linux/mips/mips64/lxstat64.c index
> 0f3934f8c8..752c5284a7 100644 ---
> a/sysdeps/unix/sysv/linux/mips/mips64/lxstat64.c +++
> b/sysdeps/unix/sysv/linux/mips/mips64/lxstat64.c @@ -20,12 +20,20 @@
> #include <kernel_stat.h>
> #include <sysdep.h>
> #include <xstatconv.h>
> +#include <shlib-compat.h>
> +
> +#if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_33)
>
> /* Get information about the file NAME in BUF. */
> int
> +attribute_compat_text_section
> __lxstat64 (int vers, const char *name, struct stat64 *buf)
> {
> struct kernel_stat kbuf;
> int r = INLINE_SYSCALL_CALL (lstat, name, &kbuf);
> return r ?: __xstat64_conv (vers, &kbuf, buf);
> }
> +
> +compat_symbol (libc, __lxstat64, __lxstat64, GLIBC_2_2);
> +
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/xstat64.c
> b/sysdeps/unix/sysv/linux/mips/mips64/xstat64.c index
> 64d2952276..a620ba2f1f 100644 ---
> a/sysdeps/unix/sysv/linux/mips/mips64/xstat64.c +++
> b/sysdeps/unix/sysv/linux/mips/mips64/xstat64.c @@ -20,13 +20,20 @@
> #include <kernel_stat.h>
> #include <sysdep.h>
> #include <xstatconv.h>
> +#include <shlib-compat.h>
>
> -/* Get information about the file NAME in BUF. */
> +#if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_33)
>
> +/* Get information about the file NAME in BUF. */
> int
> +attribute_compat_text_section
> __xstat64 (int vers, const char *name, struct stat64 *buf)
> {
> struct kernel_stat kbuf;
> int r = INLINE_SYSCALL_CALL (stat, name, &kbuf);
> return r ?: __xstat64_conv (vers, &kbuf, buf);
> }
> +
> +compat_symbol (libc, __xstat64, __xstat64, GLIBC_2_2);
> +
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/mips/xstat.c
> b/sysdeps/unix/sysv/linux/mips/xstat.c index d6ff5ccbe0..0748a3422d
> 100644 --- a/sysdeps/unix/sysv/linux/mips/xstat.c
> +++ b/sysdeps/unix/sysv/linux/mips/xstat.c
> @@ -21,9 +21,13 @@
> #include <kernel_stat.h>
> #include <sysdep.h>
> #include <xstatconv.h>
> +#include <shlib-compat.h>
> +
> +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
>
> /* Get information about the file NAME in BUF. */
> int
> +attribute_compat_text_section
> __xstat (int vers, const char *name, struct stat *buf)
> {
> switch (vers)
> @@ -39,3 +43,7 @@ __xstat (int vers, const char *name, struct stat
> *buf) }
> }
> }
> +
> +compat_symbol (libc, __xstat, __xstat, GLIBC_2_0);
> +
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/xstat.c
> b/sysdeps/unix/sysv/linux/xstat.c index a971e8cf6a..51329831b0 100644
> --- a/sysdeps/unix/sysv/linux/xstat.c
> +++ b/sysdeps/unix/sysv/linux/xstat.c
> @@ -20,13 +20,17 @@
> #include <fcntl.h>
> #include <kernel_stat.h>
> #include <sysdep.h>
> +#include <shlib-compat.h>
>
> #if !XSTAT_IS_XSTAT64
> # include <xstatconv.h>
> # include <xstatover.h>
>
> +# if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
> +
> /* Get information about the file NAME in BUF. */
> int
> +attribute_compat_text_section
> __xstat (int vers, const char *name, struct stat *buf)
> {
> switch (vers)
> @@ -57,4 +61,9 @@ __xstat (int vers, const char *name, struct stat
> *buf) }
> }
> }
> +
> +compat_symbol (libc, __xstat, __xstat, GLIBC_2_0);
> +# endif /* SHLIB_COMPAT */
> +
> #endif /* XSTAT_IS_XSTAT64 */
> +
> diff --git a/sysdeps/unix/sysv/linux/xstat64.c
> b/sysdeps/unix/sysv/linux/xstat64.c index e3a42966f5..4872d24694
> 100644 --- a/sysdeps/unix/sysv/linux/xstat64.c
> +++ b/sysdeps/unix/sysv/linux/xstat64.c
> @@ -24,10 +24,14 @@
> #include <sysdep.h>
> #include <xstatconv.h>
> #include <statx_cp.h>
> +#include <shlib-compat.h>
> +
> +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
>
> /* Get information about the file NAME in BUF. */
>
> int
> +attribute_compat_text_section
> ___xstat64 (int vers, const char *name, struct stat64 *buf)
> {
> #if XSTAT_IS_XSTAT64
> @@ -68,16 +72,17 @@ ___xstat64 (int vers, const char *name, struct
> stat64 *buf) }
>
> #if XSTAT_IS_XSTAT64
> -weak_alias (___xstat64, __xstat);
> -weak_alias (___xstat64, __GI___xstat);
> +strong_alias (___xstat64, __xstat_compat)
> +compat_symbol (libc, __xstat_compat, __xstat, GLIBC_2_2);
> #endif
>
> -#include <shlib-compat.h>
> -
> #if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
> -versioned_symbol (libc, ___xstat64, __xstat64, GLIBC_2_2);
> +compat_symbol (libc, ___xstat64, __xstat64, GLIBC_2_2);
> strong_alias (___xstat64, __old__xstat64)
> compat_symbol (libc, __old__xstat64, __xstat64, GLIBC_2_1);
> #else
> strong_alias (___xstat64, __xstat64)
> +compat_symbol (libc, ___xstat64, __xstat64, GLIBC_2_2);
> #endif
> +
> +#endif /* SHLIB_COMPAT */
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
* Adhemerval Zanella via Libc-alpha:
> diff --git a/sysdeps/unix/sysv/linux/alpha/fxstat64.c b/sysdeps/unix/sysv/linux/alpha/fxstat64.c
> index 9d6b8eca32..bcfb55050c 100644
> --- a/sysdeps/unix/sysv/linux/alpha/fxstat64.c
> +++ b/sysdeps/unix/sysv/linux/alpha/fxstat64.c
> @@ -22,9 +22,11 @@
> #include <kernel_stat.h>
> #include <sysdep.h>
> #include <xstatconv.h>
> +#include <shlib-compat.h>
>
> /* Get information about the file NAME in BUF. */
> int
> +attribute_compat_text_section
> __fxstat64 (int vers, int fd, struct stat64 *buf)
> {
> switch (vers)
> @@ -42,4 +44,12 @@ __fxstat64 (int vers, int fd, struct stat64 *buf)
> }
> }
> }
> -strong_alias (__fxstat64, __fxstat);
> +
> +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
> +strong_alias (__fxstat64, __fxstat_compat)
> +compat_symbol (libc, __fxstat_compat, __fxstat, GLIBC_2_0);
> +#endif
> +
> +#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_33)
> +compat_symbol (libc, __fxstat64, __fxstat64, GLIBC_2_1);
> +#endif
This change breaks a lot of static libraries out there. Do we really
want to do this immediately, or should we just stop using these symbols
from libc_nonshared.a, and defer the compat symbol treatment to a future
glibc version?
Thanks,
Florian
On 21/10/2020 02:21, Florian Weimer wrote:
> * Adhemerval Zanella via Libc-alpha:
>
>> diff --git a/sysdeps/unix/sysv/linux/alpha/fxstat64.c b/sysdeps/unix/sysv/linux/alpha/fxstat64.c
>> index 9d6b8eca32..bcfb55050c 100644
>> --- a/sysdeps/unix/sysv/linux/alpha/fxstat64.c
>> +++ b/sysdeps/unix/sysv/linux/alpha/fxstat64.c
>> @@ -22,9 +22,11 @@
>> #include <kernel_stat.h>
>> #include <sysdep.h>
>> #include <xstatconv.h>
>> +#include <shlib-compat.h>
>>
>> /* Get information about the file NAME in BUF. */
>> int
>> +attribute_compat_text_section
>> __fxstat64 (int vers, int fd, struct stat64 *buf)
>> {
>> switch (vers)
>> @@ -42,4 +44,12 @@ __fxstat64 (int vers, int fd, struct stat64 *buf)
>> }
>> }
>> }
>> -strong_alias (__fxstat64, __fxstat);
>> +
>> +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
>> +strong_alias (__fxstat64, __fxstat_compat)
>> +compat_symbol (libc, __fxstat_compat, __fxstat, GLIBC_2_0);
>> +#endif
>> +
>> +#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_33)
>> +compat_symbol (libc, __fxstat64, __fxstat64, GLIBC_2_1);
>> +#endif
>
> This change breaks a lot of static libraries out there. Do we really
> want to do this immediately, or should we just stop using these symbols
> from libc_nonshared.a, and defer the compat symbol treatment to a future
> glibc version?
This is the similar the libm finite symbols where my understanding was user
was supposed to rebuild the library.
The issue is only for static linking, by stopping using libc_nonshared.a we
need to provide the versioned stat symbols anyway. And we still need to handle
new ABIs where adding the old xstat symbols does not make sense (such as
riscv32 or any new 32-bit architecture).
It would required a new compat_symbol directive to export the symbols *just*
for static linking and some building tinkering to just build the xstat symbol
for dynamic object and static linking depending of support ABI version.
If we just defer the compat move, it would add the needless symbols on
newer ABIs that we will need to keep supporting indefinitely (even though they
won't be used anywhere unless user explicily links against a protected symbol)
and we would eventually need to handle the y2038 support on old ABIs (with the
_TIME_SIZE selection) by either adding proper 64-bit time support for by
removing the xstat for good.
* Adhemerval Zanella:
> On 21/10/2020 02:21, Florian Weimer wrote:
>> * Adhemerval Zanella via Libc-alpha:
>>
>>> diff --git a/sysdeps/unix/sysv/linux/alpha/fxstat64.c b/sysdeps/unix/sysv/linux/alpha/fxstat64.c
>>> index 9d6b8eca32..bcfb55050c 100644
>>> --- a/sysdeps/unix/sysv/linux/alpha/fxstat64.c
>>> +++ b/sysdeps/unix/sysv/linux/alpha/fxstat64.c
>>> @@ -22,9 +22,11 @@
>>> #include <kernel_stat.h>
>>> #include <sysdep.h>
>>> #include <xstatconv.h>
>>> +#include <shlib-compat.h>
>>>
>>> /* Get information about the file NAME in BUF. */
>>> int
>>> +attribute_compat_text_section
>>> __fxstat64 (int vers, int fd, struct stat64 *buf)
>>> {
>>> switch (vers)
>>> @@ -42,4 +44,12 @@ __fxstat64 (int vers, int fd, struct stat64 *buf)
>>> }
>>> }
>>> }
>>> -strong_alias (__fxstat64, __fxstat);
>>> +
>>> +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
>>> +strong_alias (__fxstat64, __fxstat_compat)
>>> +compat_symbol (libc, __fxstat_compat, __fxstat, GLIBC_2_0);
>>> +#endif
>>> +
>>> +#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_33)
>>> +compat_symbol (libc, __fxstat64, __fxstat64, GLIBC_2_1);
>>> +#endif
>>
>> This change breaks a lot of static libraries out there. Do we really
>> want to do this immediately, or should we just stop using these symbols
>> from libc_nonshared.a, and defer the compat symbol treatment to a future
>> glibc version?
>
> This is the similar the libm finite symbols where my understanding was
> user was supposed to rebuild the library.
I think the impact of that is a bit narrower because it requires special
compiler flags. But I suspect I will ask for reverting that in a year
as well. 8-/
> The issue is only for static linking, by stopping using
> libc_nonshared.a we need to provide the versioned stat symbols anyway.
> And we still need to handle new ABIs where adding the old xstat
> symbols does not make sense (such as riscv32 or any new 32-bit
> architecture).
You could use a SHLIB_COMPAT conditional without compat_symbol, the two
are separate.
> It would required a new compat_symbol directive to export the symbols
> *just* for static linking and some building tinkering to just build
> the xstat symbol for dynamic object and static linking depending of
> support ABI version.
The problem is not relying on the contents of libc_nonshared.a, that is
working still. It's code that calls __xstat et al. directly via the old
inline functions in the headers.
> If we just defer the compat move, it would add the needless symbols on
> newer ABIs that we will need to keep supporting indefinitely (even
> though they won't be used anywhere unless user explicily links against
> a protected symbol) and we would eventually need to handle the y2038
> support on old ABIs (with the _TIME_SIZE selection) by either adding
> proper 64-bit time support for by removing the xstat for good.
See above, we can (and should) remove it on newer ABIs only.
Thanks,
Florian
On 21/10/2020 09:57, Florian Weimer wrote:
> * Adhemerval Zanella:
>
>> On 21/10/2020 02:21, Florian Weimer wrote:
>>> * Adhemerval Zanella via Libc-alpha:
>>>
>>>> diff --git a/sysdeps/unix/sysv/linux/alpha/fxstat64.c b/sysdeps/unix/sysv/linux/alpha/fxstat64.c
>>>> index 9d6b8eca32..bcfb55050c 100644
>>>> --- a/sysdeps/unix/sysv/linux/alpha/fxstat64.c
>>>> +++ b/sysdeps/unix/sysv/linux/alpha/fxstat64.c
>>>> @@ -22,9 +22,11 @@
>>>> #include <kernel_stat.h>
>>>> #include <sysdep.h>
>>>> #include <xstatconv.h>
>>>> +#include <shlib-compat.h>
>>>>
>>>> /* Get information about the file NAME in BUF. */
>>>> int
>>>> +attribute_compat_text_section
>>>> __fxstat64 (int vers, int fd, struct stat64 *buf)
>>>> {
>>>> switch (vers)
>>>> @@ -42,4 +44,12 @@ __fxstat64 (int vers, int fd, struct stat64 *buf)
>>>> }
>>>> }
>>>> }
>>>> -strong_alias (__fxstat64, __fxstat);
>>>> +
>>>> +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
>>>> +strong_alias (__fxstat64, __fxstat_compat)
>>>> +compat_symbol (libc, __fxstat_compat, __fxstat, GLIBC_2_0);
>>>> +#endif
>>>> +
>>>> +#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_33)
>>>> +compat_symbol (libc, __fxstat64, __fxstat64, GLIBC_2_1);
>>>> +#endif
>>>
>>> This change breaks a lot of static libraries out there. Do we really
>>> want to do this immediately, or should we just stop using these symbols
>>> from libc_nonshared.a, and defer the compat symbol treatment to a future
>>> glibc version?
>>
>> This is the similar the libm finite symbols where my understanding was
>> user was supposed to rebuild the library.
>
> I think the impact of that is a bit narrower because it requires special
> compiler flags. But I suspect I will ask for reverting that in a year
> as well. 8-/
It is sad that we can't get rid of clunky and not well thought interface,
which kind of issues are you seeing that is making you thinking about
reverting the libm finite symbols?
>
>> The issue is only for static linking, by stopping using
>> libc_nonshared.a we need to provide the versioned stat symbols anyway.
>> And we still need to handle new ABIs where adding the old xstat
>> symbols does not make sense (such as riscv32 or any new 32-bit
>> architecture).
>
> You could use a SHLIB_COMPAT conditional without compat_symbol, the two
> are separate.
The problem is with:
#if SHLIB_COMPAT(libc, GLIBC_2_4, GLIBC_2_33)
int
__fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
{
}
#endif
It won't be built for static and without using SHLIB_COMPAT in this
case will build the interfaces for ABIs that doe not require it.
>
>> It would required a new compat_symbol directive to export the symbols
>> *just* for static linking and some building tinkering to just build
>> the xstat symbol for dynamic object and static linking depending of
>> support ABI version.
>
> The problem is not relying on the contents of libc_nonshared.a, that is
> working still. It's code that calls __xstat et al. directly via the old
> inline functions in the headers.
Yes, I am aware. I am outlining is I think we would need some thikering
to build for static case that is not easily support with the current
shlib-compat macros we have.
>
>> If we just defer the compat move, it would add the needless symbols on
>> newer ABIs that we will need to keep supporting indefinitely (even
>> though they won't be used anywhere unless user explicily links against
>> a protected symbol) and we would eventually need to handle the y2038
>> support on old ABIs (with the _TIME_SIZE selection) by either adding
>> proper 64-bit time support for by removing the xstat for good.
>
> See above, we can (and should) remove it on newer ABIs only.
So now is we are moving in providing what is supposed to be compat symbols
in the static library case as well. Do we really want to start supporting
such scenario?
* Adhemerval Zanella:
>> I think the impact of that is a bit narrower because it requires special
>> compiler flags. But I suspect I will ask for reverting that in a year
>> as well. 8-/
>
> It is sad that we can't get rid of clunky and not well thought interface,
> which kind of issues are you seeing that is making you thinking about
> reverting the libm finite symbols?
Based on the failures I've seen so far, Ocaml would have to start
distributing binaries for glibc 2.32 and earlier (probably built on
something like glibc 2.17) and glibc 2.33 and later (built on glibc
2.33). Other native code compilers are likely affected in the same way.
>>> The issue is only for static linking, by stopping using
>>> libc_nonshared.a we need to provide the versioned stat symbols anyway.
>>> And we still need to handle new ABIs where adding the old xstat
>>> symbols does not make sense (such as riscv32 or any new 32-bit
>>> architecture).
>>
>> You could use a SHLIB_COMPAT conditional without compat_symbol, the two
>> are separate.
>
> The problem is with:
>
> #if SHLIB_COMPAT(libc, GLIBC_2_4, GLIBC_2_33)
> int
> __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
> {
> }
> #endif
>
> It won't be built for static and without using SHLIB_COMPAT in this
> case will build the interfaces for ABIs that doe not require it.
We could rename TEST_COMPAT and use that, I think it already has the
right semantics. Or you could use “ifdef have-GLIBC_2.32” at the
makefile level.
>>> If we just defer the compat move, it would add the needless symbols on
>>> newer ABIs that we will need to keep supporting indefinitely (even
>>> though they won't be used anywhere unless user explicily links against
>>> a protected symbol) and we would eventually need to handle the y2038
>>> support on old ABIs (with the _TIME_SIZE selection) by either adding
>>> proper 64-bit time support for by removing the xstat for good.
>>
>> See above, we can (and should) remove it on newer ABIs only.
>
> So now is we are moving in providing what is supposed to be compat
> symbols in the static library case as well. Do we really want to start
> supporting such scenario?
Downstream, we do not need these symbols for fully static linking, so
SHLIB_COMPAT would actually be okay for our needs, I think.
I guess if upstream rejects this, we can provide a stub library that can
be used to link against the __xstat et al. symbols as a workaround. But
if we need it, Debian (with its lack of per-release mass rebuilds) will
likely need it too, and some other distributions probably as well. So
at that point, I think we need to ask ourselves as upstream developers
whether we are really serving the needs of our users.
Maybe this is coming across a bit strongly, I just want to put it out
there. If Fedora rawhide breaks after we make a change that is
technically correct because it affects officially unsupported
configurations only, it makes sense to pause and think if what we are
doing is really correct.
Thanks,
Florian
On 22/10/2020 07:08, Florian Weimer wrote:
> * Adhemerval Zanella:
>
>>> I think the impact of that is a bit narrower because it requires special
>>> compiler flags. But I suspect I will ask for reverting that in a year
>>> as well. 8-/
>>
>> It is sad that we can't get rid of clunky and not well thought interface,
>> which kind of issues are you seeing that is making you thinking about
>> reverting the libm finite symbols?
>
> Based on the failures I've seen so far, Ocaml would have to start
> distributing binaries for glibc 2.32 and earlier (probably built on
> something like glibc 2.17) and glibc 2.33 and later (built on glibc
> 2.33). Other native code compilers are likely affected in the same way.
Indeed it seems that Ocaml distributes static libraries with reference
xstat symbols. And I agree that this is only one example, I would
expect more libraries would use the xstat symbos.
>
>>>> The issue is only for static linking, by stopping using
>>>> libc_nonshared.a we need to provide the versioned stat symbols anyway.
>>>> And we still need to handle new ABIs where adding the old xstat
>>>> symbols does not make sense (such as riscv32 or any new 32-bit
>>>> architecture).
>>>
>>> You could use a SHLIB_COMPAT conditional without compat_symbol, the two
>>> are separate.
>>
>> The problem is with:
>>
>> #if SHLIB_COMPAT(libc, GLIBC_2_4, GLIBC_2_33)
>> int
>> __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
>> {
>> }
>> #endif
>>
>> It won't be built for static and without using SHLIB_COMPAT in this
>> case will build the interfaces for ABIs that doe not require it.
>
> We could rename TEST_COMPAT and use that, I think it already has the
> right semantics. Or you could use “ifdef have-GLIBC_2.32” at the
> makefile level.
I think TEST_COMPAT would be a better alternative since, it would give all
the information how the symbol should be handled ABI wise on the C file
instead of spreading over multiple files.
>
>>>> If we just defer the compat move, it would add the needless symbols on
>>>> newer ABIs that we will need to keep supporting indefinitely (even
>>>> though they won't be used anywhere unless user explicily links against
>>>> a protected symbol) and we would eventually need to handle the y2038
>>>> support on old ABIs (with the _TIME_SIZE selection) by either adding
>>>> proper 64-bit time support for by removing the xstat for good.
>>>
>>> See above, we can (and should) remove it on newer ABIs only.
>>
>> So now is we are moving in providing what is supposed to be compat
>> symbols in the static library case as well. Do we really want to start
>> supporting such scenario?
>
> Downstream, we do not need these symbols for fully static linking, so
> SHLIB_COMPAT would actually be okay for our needs, I think.
>
> I guess if upstream rejects this, we can provide a stub library that can
> be used to link against the __xstat et al. symbols as a workaround. But
> if we need it, Debian (with its lack of per-release mass rebuilds) will
> likely need it too, and some other distributions probably as well. So
> at that point, I think we need to ask ourselves as upstream developers
> whether we are really serving the needs of our users.
I really not sure how is the best way to handle this transitions, since
they tend to require a lot of time and affecting different releases.
And it does not make sense to provide this specific stub libraries as
different project, since it is a implementation detail from glibc itself.
>
> Maybe this is coming across a bit strongly, I just want to put it out
> there. If Fedora rawhide breaks after we make a change that is
> technically correct because it affects officially unsupported
> configurations only, it makes sense to pause and think if what we are
> doing is really correct.
Thanks for bring this up, and I agree with you that this breakage might
incur in more headaches than solutions. I will send a fix to export
the xstat symbols in static objects as well, while preserving the compat
symbols on shared objects.
It is unfortunate that we need to add such workarounds, but it seems
a better strategy.
* Adhemerval Zanella:
> Thanks for bring this up, and I agree with you that this breakage might
> incur in more headaches than solutions. I will send a fix to export
> the xstat symbols in static objects as well, while preserving the compat
> symbols on shared objects.
Sorry, I do not see how the compat symbols work for the Ocaml use case?
The compat symbol is what creates the Ocaml link failure. It has to be
a non-compat symbol. We have to rely on lack of use in the installed
headers (which does not seem to be a real problem in this particular
case).
By the way, I verified that glibc 2.0 binaries without symbol versioning
can bind to the __xstat compat symbol. Apparently binaries can do that
as long as they do not contain any version information at all:
165100: binding file /home/fweimer/src/my/glibc-test-binaries/gcc-2.7.2.3/i386/root/usr/bin/gcc [0] to ./libc.so.6 [0]: normal symbol `__xstat'
Thanks,
Florian
On 22/10/2020 12:37, Florian Weimer wrote:
> * Adhemerval Zanella:
>
>> Thanks for bring this up, and I agree with you that this breakage might
>> incur in more headaches than solutions. I will send a fix to export
>> the xstat symbols in static objects as well, while preserving the compat
>> symbols on shared objects.
>
> Sorry, I do not see how the compat symbols work for the Ocaml use case?
> The compat symbol is what creates the Ocaml link failure. It has to be
> a non-compat symbol. We have to rely on lack of use in the installed
> headers (which does not seem to be a real problem in this particular
> case).
So the issue is Ocaml is providing static libraries that are meant to
generate dynamic linked binaries? Does it provide the same facility to
build static binaries and if it were the case, how this is done?
In the end, do still need to keep providing the xstat symbols in the
static library as well or just remove the compat symbol directive would
be suffice?
>
> By the way, I verified that glibc 2.0 binaries without symbol versioning
> can bind to the __xstat compat symbol. Apparently binaries can do that
> as long as they do not contain any version information at all:
>
> 165100: binding file /home/fweimer/src/my/glibc-test-binaries/gcc-2.7.2.3/i386/root/usr/bin/gcc [0] to ./libc.so.6 [0]: normal symbol `__xstat'
>
> Thanks,
> Florian
>
On 22/10/2020 13:40, Adhemerval Zanella wrote:
>
>
> On 22/10/2020 12:37, Florian Weimer wrote:
>> * Adhemerval Zanella:
>>
>>> Thanks for bring this up, and I agree with you that this breakage might
>>> incur in more headaches than solutions. I will send a fix to export
>>> the xstat symbols in static objects as well, while preserving the compat
>>> symbols on shared objects.
>>
>> Sorry, I do not see how the compat symbols work for the Ocaml use case?
>> The compat symbol is what creates the Ocaml link failure. It has to be
>> a non-compat symbol. We have to rely on lack of use in the installed
>> headers (which does not seem to be a real problem in this particular
>> case).
>
> So the issue is Ocaml is providing static libraries that are meant to
> generate dynamic linked binaries? Does it provide the same facility to
> build static binaries and if it were the case, how this is done?
>
> In the end, do still need to keep providing the xstat symbols in the
> static library as well or just remove the compat symbol directive would
> be suffice?
>
>>
>> By the way, I verified that glibc 2.0 binaries without symbol versioning
>> can bind to the __xstat compat symbol. Apparently binaries can do that
>> as long as they do not contain any version information at all:
>>
>> 165100: binding file /home/fweimer/src/my/glibc-test-binaries/gcc-2.7.2.3/i386/root/usr/bin/gcc [0] to ./libc.so.6 [0]: normal symbol `__xstat'
Ok, I understood better the scenario Ocaml might be doing and this is
another fallback of using the libc_noshared wrapper. I will send patch
to revert and fix the fix the build for newer ABIS.
@@ -22,9 +22,11 @@
#include <kernel_stat.h>
#include <sysdep.h>
#include <xstatconv.h>
+#include <shlib-compat.h>
/* Get information about the file NAME in BUF. */
int
+attribute_compat_text_section
__fxstat64 (int vers, int fd, struct stat64 *buf)
{
switch (vers)
@@ -42,4 +44,12 @@ __fxstat64 (int vers, int fd, struct stat64 *buf)
}
}
}
-strong_alias (__fxstat64, __fxstat);
+
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
+strong_alias (__fxstat64, __fxstat_compat)
+compat_symbol (libc, __fxstat_compat, __fxstat, GLIBC_2_0);
+#endif
+
+#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_33)
+compat_symbol (libc, __fxstat64, __fxstat64, GLIBC_2_1);
+#endif
@@ -22,11 +22,18 @@
#include <kernel_stat.h>
#include <sysdep.h>
#include <xstatconv.h>
+#include <shlib-compat.h>
+#if SHLIB_COMPAT(libc, GLIBC_2_4, GLIBC_2_33)
/* Get information about the file NAME in BUF. */
int
+attribute_compat_text_section
__fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag)
{
return INLINE_SYSCALL_CALL (fstatat64, fd, file, st, flag);
}
-strong_alias (__fxstatat64, __fxstatat);
+strong_alias (__fxstatat64, __fxstatat_compat)
+compat_symbol (libc, __fxstatat_compat, __fxstatat, GLIBC_2_4);
+
+compat_symbol (libc, __fxstatat64, __fxstatat64, GLIBC_2_4);
+#endif
@@ -23,9 +23,11 @@
#include <kernel_stat.h>
#include <sysdep.h>
#include <xstatconv.h>
+#include <shlib-compat.h>
/* Get information about the file NAME in BUF. */
int
+attribute_compat_text_section
__lxstat64 (int vers, const char *name, struct stat64 *buf)
{
switch (vers)
@@ -43,4 +45,12 @@ __lxstat64 (int vers, const char *name, struct stat64 *buf)
}
}
}
-weak_alias (__lxstat64, __lxstat);
+
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
+strong_alias (__lxstat64, __lxstat_compat)
+compat_symbol (libc, __lxstat_compat, __lxstat, GLIBC_2_0);
+#endif
+
+#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_33)
+compat_symbol (libc, __lxstat64, __lxstat64, GLIBC_2_1);
+#endif
@@ -23,9 +23,11 @@
#include <kernel_stat.h>
#include <sysdep.h>
#include <xstatconv.h>
+#include <shlib-compat.h>
/* Get information about the file NAME in BUF. */
int
+attribute_compat_text_section
__xstat64 (int vers, const char *name, struct stat64 *buf)
{
switch (vers)
@@ -43,4 +45,12 @@ __xstat64 (int vers, const char *name, struct stat64 *buf)
}
}
}
-weak_alias (__xstat64, __xstat);
+
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
+strong_alias (__xstat64, __xstat_compat)
+compat_symbol (libc, __xstat_compat, __xstat, GLIBC_2_0);
+#endif
+
+#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_33)
+compat_symbol (libc, __xstat64, __xstat64, GLIBC_2_1);
+#endif
@@ -24,9 +24,13 @@
#if !XSTAT_IS_XSTAT64
# include <xstatconv.h>
# include <xstatover.h>
+# include <shlib-compat.h>
+
+# if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
/* Get information about the file FD in BUF. */
int
+attribute_compat_text_section
__fxstat (int vers, int fd, struct stat *buf)
{
switch (vers)
@@ -57,4 +61,8 @@ __fxstat (int vers, int fd, struct stat *buf)
}
}
}
+
+compat_symbol (libc, __fxstat, __fxstat, GLIBC_2_0);
+# endif /* SHLIB_COMPAT */
+
#endif /* XSTAT_IS_XSTAT64 */
@@ -24,10 +24,14 @@
#include <sysdep.h>
#include <xstatconv.h>
#include <statx_cp.h>
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
/* Get information about the file FD in BUF. */
int
+attribute_compat_text_section
___fxstat64 (int vers, int fd, struct stat64 *buf)
{
#if XSTAT_IS_XSTAT64
@@ -53,16 +57,18 @@ ___fxstat64 (int vers, int fd, struct stat64 *buf)
#endif /* XSTAT_IS_XSTAT64 */
}
-#include <shlib-compat.h>
-
#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
-versioned_symbol (libc, ___fxstat64, __fxstat64, GLIBC_2_2);
+compat_symbol (libc, ___fxstat64, __fxstat64, GLIBC_2_2);
strong_alias (___fxstat64, __old__fxstat64)
compat_symbol (libc, __old__fxstat64, __fxstat64, GLIBC_2_1);
#else
strong_alias (___fxstat64, __fxstat64)
+compat_symbol (libc, ___fxstat64, __fxstat64, GLIBC_2_2);
#endif
#if XSTAT_IS_XSTAT64
-strong_alias (__fxstat64, __fxstat);
+strong_alias (___fxstat64, __fxstat_compat)
+compat_symbol (libc, __fxstat_compat, __fxstat, GLIBC_2_2);
#endif
+
+#endif /* SHLIB_COMPAT */
@@ -24,9 +24,13 @@
#if !XSTAT_IS_XSTAT64
# include <xstatconv.h>
# include <xstatover.h>
+# include <shlib-compat.h>
+
+# if SHLIB_COMPAT(libc, GLIBC_2_4, GLIBC_2_33)
/* Get information about the file FD in BUF. */
int
+attribute_compat_text_section
__fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
{
#if STAT_IS_KERNEL_STAT
@@ -46,4 +50,8 @@ __fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
return r ?: __xstat32_conv (vers, &st64, st);
#endif
}
+
+compat_symbol (libc, __fxstatat, __fxstatat, GLIBC_2_4);
+# endif /* SHLIB_COMPAT */
+
#endif /* XSTAT_IS_XSTAT64 */
@@ -24,10 +24,14 @@
#include <sysdep.h>
#include <xstatconv.h>
#include <statx_cp.h>
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT(libc, GLIBC_2_4, GLIBC_2_33)
/* Get information about the file FD in BUF. */
int
+attribute_compat_text_section
__fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag)
{
#if XSTAT_IS_XSTAT64
@@ -61,6 +65,12 @@ __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag)
#endif
return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL);
}
+
+compat_symbol (libc, __fxstatat64, __fxstatat64, GLIBC_2_4);
+
#if XSTAT_IS_XSTAT64
-strong_alias (__fxstatat64, __fxstatat);
+strong_alias (__fxstatat64, __fxstatat_compat)
+compat_symbol (libc, __fxstatat_compat, __fxstatat, GLIBC_2_4);
#endif
+
+#endif /* SHLIB_COMPAT(libc, GLIBC_2_4, GLIBC_2_33) */
@@ -20,13 +20,17 @@
#include <fcntl.h>
#include <kernel_stat.h>
#include <sysdep.h>
+#include <shlib-compat.h>
#if !XSTAT_IS_XSTAT64
# include <xstatconv.h>
# include <xstatover.h>
+# if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
+
/* Get information about the file NAME in BUF. */
int
+attribute_compat_text_section
__lxstat (int vers, const char *name, struct stat *buf)
{
switch (vers)
@@ -58,4 +62,8 @@ __lxstat (int vers, const char *name, struct stat *buf)
}
}
}
+
+compat_symbol (libc, __lxstat, __lxstat, GLIBC_2_0);
+# endif /* SHLIB_COMPAT */
+
#endif /* XSTAT_IS_XSTAT64 */
@@ -24,10 +24,14 @@
#include <sysdep.h>
#include <xstatconv.h>
#include <statx_cp.h>
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_33)
/* Get information about the file NAME in BUF. */
int
+attribute_compat_text_section
___lxstat64 (int vers, const char *name, struct stat64 *buf)
{
#if XSTAT_IS_XSTAT64
@@ -70,17 +74,18 @@ ___lxstat64 (int vers, const char *name, struct stat64 *buf)
return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL);
}
-#if XSTAT_IS_XSTAT64
-weak_alias (___lxstat64, __lxstat);
-weak_alias (___lxstat64, __GI___lxstat);
-#endif
-
-#include <shlib-compat.h>
-
#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
-versioned_symbol (libc, ___lxstat64, __lxstat64, GLIBC_2_2);
+compat_symbol (libc, ___lxstat64, __lxstat64, GLIBC_2_2);
strong_alias (___lxstat64, __old__lxstat64)
compat_symbol (libc, __old__lxstat64, __lxstat64, GLIBC_2_1);
#else
strong_alias (___lxstat64, __lxstat64);
+compat_symbol (libc, ___lxstat64, __lxstat64, GLIBC_2_2);
#endif
+
+#if XSTAT_IS_XSTAT64
+strong_alias (___lxstat64,__lxstat_compat)
+compat_symbol (libc, __lxstat_compat, __lxstat, GLIBC_2_2);
+#endif
+
+#endif /* SHLIB_COMPAT */
@@ -21,9 +21,13 @@
#include <kernel_stat.h>
#include <sysdep.h>
#include <xstatconv.h>
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
/* Get information about the file NAME in BUF. */
int
+attribute_compat_text_section
__fxstat (int vers, int fd, struct stat *buf)
{
switch (vers)
@@ -39,3 +43,7 @@ __fxstat (int vers, int fd, struct stat *buf)
}
}
}
+
+compat_symbol (libc, __fxstat, __fxstat, GLIBC_2_0);
+
+#endif
@@ -21,9 +21,13 @@
#include <kernel_stat.h>
#include <sysdep.h>
#include <xstatconv.h>
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
/* Get information about the file NAME in BUF. */
int
+attribute_compat_text_section
__lxstat (int vers, const char *name, struct stat *buf)
{
switch (vers)
@@ -39,3 +43,7 @@ __lxstat (int vers, const char *name, struct stat *buf)
}
}
}
+
+compat_symbol (libc, __lxstat, __lxstat, GLIBC_2_0);
+
+#endif
@@ -20,10 +20,14 @@
#include <kernel_stat.h>
#include <sysdep.h>
#include <xstatconv.h>
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_33)
/* Get information about the file FD in BUF. */
int
+attribute_compat_text_section
__fxstat64 (int vers, int fd, struct stat64 *buf)
{
struct kernel_stat kbuf;
@@ -31,3 +35,7 @@ __fxstat64 (int vers, int fd, struct stat64 *buf)
return r ?: __xstat64_conv (vers, &kbuf, buf);
}
+
+compat_symbol (libc, __fxstat64, __fxstat64, GLIBC_2_2);
+
+#endif
@@ -21,12 +21,20 @@
#include <kernel_stat.h>
#include <sysdep.h>
#include <xstatconv.h>
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT(libc, GLIBC_2_4, GLIBC_2_33)
/* Get information about the file FD in BUF. */
int
+attribute_compat_text_section
__fxstatat (int vers, int fd, const char *file, struct stat *st, int flag)
{
struct kernel_stat kst;
int r = INLINE_SYSCALL_CALL (newfstatat, fd, file, &kst, flag);
return r ?: __xstat_conv (vers, &kst, st);
}
+
+compat_symbol (libc, __fxstatat, __fxstatat, GLIBC_2_4);
+
+#endif
@@ -19,10 +19,14 @@
#include <kernel_stat.h>
#include <sysdep.h>
#include <xstatconv.h>
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT(libc, GLIBC_2_4, GLIBC_2_33)
/* Get information about the file NAME in BUF. */
int
+attribute_compat_text_section
__fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag)
{
if (vers == _STAT_VER_LINUX)
@@ -33,3 +37,7 @@ __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag)
}
return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL);
}
+
+compat_symbol (libc, __fxstatat64, __fxstatat64, GLIBC_2_4);
+
+#endif
@@ -20,12 +20,20 @@
#include <kernel_stat.h>
#include <sysdep.h>
#include <xstatconv.h>
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_33)
/* Get information about the file NAME in BUF. */
int
+attribute_compat_text_section
__lxstat64 (int vers, const char *name, struct stat64 *buf)
{
struct kernel_stat kbuf;
int r = INLINE_SYSCALL_CALL (lstat, name, &kbuf);
return r ?: __xstat64_conv (vers, &kbuf, buf);
}
+
+compat_symbol (libc, __lxstat64, __lxstat64, GLIBC_2_2);
+
+#endif
@@ -20,13 +20,20 @@
#include <kernel_stat.h>
#include <sysdep.h>
#include <xstatconv.h>
+#include <shlib-compat.h>
-/* Get information about the file NAME in BUF. */
+#if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_33)
+/* Get information about the file NAME in BUF. */
int
+attribute_compat_text_section
__xstat64 (int vers, const char *name, struct stat64 *buf)
{
struct kernel_stat kbuf;
int r = INLINE_SYSCALL_CALL (stat, name, &kbuf);
return r ?: __xstat64_conv (vers, &kbuf, buf);
}
+
+compat_symbol (libc, __xstat64, __xstat64, GLIBC_2_2);
+
+#endif
@@ -21,9 +21,13 @@
#include <kernel_stat.h>
#include <sysdep.h>
#include <xstatconv.h>
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
/* Get information about the file NAME in BUF. */
int
+attribute_compat_text_section
__xstat (int vers, const char *name, struct stat *buf)
{
switch (vers)
@@ -39,3 +43,7 @@ __xstat (int vers, const char *name, struct stat *buf)
}
}
}
+
+compat_symbol (libc, __xstat, __xstat, GLIBC_2_0);
+
+#endif
@@ -20,13 +20,17 @@
#include <fcntl.h>
#include <kernel_stat.h>
#include <sysdep.h>
+#include <shlib-compat.h>
#if !XSTAT_IS_XSTAT64
# include <xstatconv.h>
# include <xstatover.h>
+# if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
+
/* Get information about the file NAME in BUF. */
int
+attribute_compat_text_section
__xstat (int vers, const char *name, struct stat *buf)
{
switch (vers)
@@ -57,4 +61,9 @@ __xstat (int vers, const char *name, struct stat *buf)
}
}
}
+
+compat_symbol (libc, __xstat, __xstat, GLIBC_2_0);
+# endif /* SHLIB_COMPAT */
+
#endif /* XSTAT_IS_XSTAT64 */
+
@@ -24,10 +24,14 @@
#include <sysdep.h>
#include <xstatconv.h>
#include <statx_cp.h>
+#include <shlib-compat.h>
+
+#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_33)
/* Get information about the file NAME in BUF. */
int
+attribute_compat_text_section
___xstat64 (int vers, const char *name, struct stat64 *buf)
{
#if XSTAT_IS_XSTAT64
@@ -68,16 +72,17 @@ ___xstat64 (int vers, const char *name, struct stat64 *buf)
}
#if XSTAT_IS_XSTAT64
-weak_alias (___xstat64, __xstat);
-weak_alias (___xstat64, __GI___xstat);
+strong_alias (___xstat64, __xstat_compat)
+compat_symbol (libc, __xstat_compat, __xstat, GLIBC_2_2);
#endif
-#include <shlib-compat.h>
-
#if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
-versioned_symbol (libc, ___xstat64, __xstat64, GLIBC_2_2);
+compat_symbol (libc, ___xstat64, __xstat64, GLIBC_2_2);
strong_alias (___xstat64, __old__xstat64)
compat_symbol (libc, __old__xstat64, __xstat64, GLIBC_2_1);
#else
strong_alias (___xstat64, __xstat64)
+compat_symbol (libc, ___xstat64, __xstat64, GLIBC_2_2);
#endif
+
+#endif /* SHLIB_COMPAT */