From: Emil Velikov Date: Sun, 15 Sep 2024 00:40:14 +0000 (+0100) Subject: build: check for __xstat declarations X-Git-Tag: v34~336 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0766f541927f50879599e62fdaa5a2e51b9791d3;p=thirdparty%2Fkmod.git build: check for __xstat declarations Currently we check the function is resolved at link time. Although what we really care is if the headers are silently transposing any of our stat calls to __xstat{,64}. If so, we'd want to wrap the latter functions. As the now-removed comment says, glibc 2.33 was the first release to no longer have static inline wrappers that do the transposition. See the glibc commit 8ed005daf0ab ("Remove stat wrapper functions, move them to exported symbols") for more details. So change the checking to check_decl/has_header_symbol and keep them for distributions with older glibc. NOTE: to summarise/contrast this wrt the previous open64, etc - here: we had inline wrappers and declarations (as below) - others: no inline wrappers and optionally declarations glibc 2.32 extern ... __xstat(); extern inline stat(...) { return __xstat(...); } glibc 2.33 extern stat(...); Note we group the 64 variant as well, since the codepath has been identical (wrt core logic) to the normal __xstat(). Signed-off-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/131 Signed-off-by: Lucas De Marchi --- diff --git a/configure.ac b/configure.ac index 39e33690..15def643 100644 --- a/configure.ac +++ b/configure.ac @@ -39,7 +39,6 @@ AC_PROG_CC_C99 # Function and structure checks ##################################################################### -AC_CHECK_FUNCS_ONCE(__xstat) AC_CHECK_FUNCS_ONCE([open64 stat64 fopen64 __stat64_time64]) AC_CHECK_FUNCS_ONCE([__secure_getenv secure_getenv]) @@ -48,16 +47,13 @@ CC_CHECK_FUNC_BUILTIN([__builtin_types_compatible_p]) CC_CHECK_FUNC_BUILTIN([__builtin_uaddl_overflow], [ ], [ ]) CC_CHECK_FUNC_BUILTIN([__builtin_uaddll_overflow], [ ], [ ]) -# Non glibc compilers (musl and newer versions of bionic) do not need -# the 64 LFS API wrapping. -AC_CHECK_DECLS_ONCE([[__GLIBC__]], [], [], [[#include ]]) - # dietlibc doesn't have st.st_mtim struct member AC_CHECK_MEMBERS([struct stat.st_mtim], [], [], [#include ]) # basename may be only available in libgen.h with the POSIX behavior, # not desired here AC_CHECK_DECLS_ONCE([[basename]], [], [], [[#include ]]) +AC_CHECK_DECLS_ONCE([[__xstat]], [], [], [[#include