[llvm] hurd: Fix accessing f_type field of statvfs (PR #71851)

Samuel Thibault via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 9 11:15:11 PST 2023


https://github.com/sthibaul created https://github.com/llvm/llvm-project/pull/71851

f4719c4d2cda ("Add support for GNU Hurd in Path.inc and other places") made llvm use an internal __f_type name for the f_type field (which it is not supposed to since accessing double-underscore names is explicitly not supported by standards). In glibc 2.39 this field was renamed to f_type so application can now access the field as the standard says.

>From 71c1eb392988db336ff813cb383e11f1d82014a1 Mon Sep 17 00:00:00 2001
From: Samuel Thibault <samuel.thibault at ens-lyon.org>
Date: Thu, 9 Nov 2023 19:27:15 +0100
Subject: [PATCH] hurd: Fix accessing f_type field of statvfs

f4719c4d2cda ("Add support for GNU Hurd in Path.inc and other places")
made llvm use an internal __f_type name for the f_type field (which it is
not supposed to since accessing double-underscore names is explicitly not
supported by standards). In glibc 2.39 this field was renamed to f_type so
application can now access the field as the standard says.
---
 llvm/lib/Support/Unix/Path.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc
index 68ca58fda3b8fe0..6ea0c4cac4d4def 100644
--- a/llvm/lib/Support/Unix/Path.inc
+++ b/llvm/lib/Support/Unix/Path.inc
@@ -487,7 +487,7 @@ static bool is_local_impl(struct STATVFS &Vfs) {
 #ifndef CIFS_MAGIC_NUMBER
 #define CIFS_MAGIC_NUMBER 0xFF534D42
 #endif
-#ifdef __GNU__
+#if defined(__GNU__) && ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 39)))
   switch ((uint32_t)Vfs.__f_type) {
 #else
   switch ((uint32_t)Vfs.f_type) {



More information about the llvm-commits mailing list