[PATCH] io: fix ftw ABI on MIPS n64
Xi Ruoyao
xry111@xry111.site
Tue Jul 21 17:27:37 GMT 2026
On MIPS n64 off_t is same as off64_t, but struct stat is not same as
struct stat64 (very peculiar but see the "as tempting as it..." comment
in linux/mips/kernel_stat.h). As the ftw/ftw64 callback accepts a
pointer to a function who accepts struct stat/stat64, for MIPS n64 we
must use different implementations for ftw and ftw64.
Thus for testing if ftw64 can be aliased to ftw, we should check
XSTAT_IS_XSTAT64 instead of __OFF_T_MATCHES_OFF64_T.
This resolves the io/tst-ftw-lnk failure observed on MIPS n64.
Link: https://sourceware.org/glibc/wiki/Testing/Tests/io/tst-ftw-lnk
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
---
Tested on x86_64-linux and mips64-linux.
io/ftw.c | 2 +-
io/ftw64.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/io/ftw.c b/io/ftw.c
index ed0eeb3904..79259518f6 100644
--- a/io/ftw.c
+++ b/io/ftw.c
@@ -18,7 +18,7 @@
#include <sys/types.h>
-#ifndef __OFF_T_MATCHES_OFF64_T
+#ifndef XSTAT_IS_XSTAT64
# include "ftw-common.c"
versioned_symbol (libc, __new_nftw, nftw, GLIBC_2_3_3);
diff --git a/io/ftw64.c b/io/ftw64.c
index d3cd14c21a..6d9e6dfe22 100644
--- a/io/ftw64.c
+++ b/io/ftw64.c
@@ -44,7 +44,7 @@ versioned_symbol (libc, __new_nftw64, nftw64, GLIBC_2_3_3);
compat_symbol (libc, __old_nftw64, nftw64, GLIBC_2_1);
#endif
-#ifdef __OFF_T_MATCHES_OFF64_T
+#ifdef XSTAT_IS_XSTAT64
weak_alias (__ftw64, ftw)
versioned_symbol (libc, __new_nftw64, nftw, GLIBC_2_3_3);
# if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_3_3)
--
2.55.0
More information about the Libc-alpha
mailing list