]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
io: fix ftw ABI on MIPS n64
authorXi Ruoyao <xry111@xry111.site>
Wed, 22 Jul 2026 11:26:10 +0000 (19:26 +0800)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 3 Aug 2026 18:53:12 +0000 (15:53 -0300)
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>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
io/ftw.c
io/ftw64.c

index ed0eeb39042aa438a22f0881c90029705aabc9af..a9368a706ea7ad652710226e91808dd2cc39c4cd 100644 (file)
--- a/io/ftw.c
+++ b/io/ftw.c
@@ -18,7 +18,9 @@
 
 #include <sys/types.h>
 
-#ifndef __OFF_T_MATCHES_OFF64_T
+#include <kernel_stat.h>
+
+#if !XSTAT_IS_XSTAT64
 # include "ftw-common.c"
 
 versioned_symbol (libc, __new_nftw, nftw, GLIBC_2_3_3);
index d3cd14c21a45110b2d9c5b81bc13b5b0ddeb5277..fa7b05df22a61649cfdd5cc055ba9b93f92d8416 100644 (file)
@@ -31,6 +31,9 @@
 #define ftw __rename_ftw
 #define nftw __rename_nftw
 
+#include <sys/types.h>
+
+#include <kernel_stat.h>
 #include <shlib-compat.h>
 #include "ftw-common.c"
 
@@ -44,7 +47,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
+#if 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)