gcc: Fix building with glibc >= 2.28
[people/pmueller/ipfire-2.x.git] / src / patches / gcc-7-glibc-2.28-ustat.patch
1 --- libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc    2018/04/25 07:39:32     259630
2 +++ libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc    2018/05/24 20:07:25     260687
3 @@ -157,7 +157,6 @@
4  # include <sys/procfs.h>
5  #endif
6  #include <sys/user.h>
7 -#include <sys/ustat.h>
8  #include <linux/cyclades.h>
9  #include <linux/if_eql.h>
10  #include <linux/if_plip.h>
11 @@ -250,7 +249,19 @@
12  #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
13  
14  #if SANITIZER_LINUX && !SANITIZER_ANDROID
15 -  unsigned struct_ustat_sz = sizeof(struct ustat);
16 +  // Use pre-computed size of struct ustat to avoid <sys/ustat.h> which
17 +  // has been removed from glibc 2.28.
18 +#if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \
19 +  || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \
20 +  || defined(__x86_64__)
21 +#define SIZEOF_STRUCT_USTAT 32
22 +#elif defined(__arm__) || defined(__i386__) || defined(__mips__) \
23 +  || defined(__powerpc__) || defined(__s390__)
24 +#define SIZEOF_STRUCT_USTAT 20
25 +#else
26 +#error Unknown size of struct ustat
27 +#endif
28 +  unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT;
29    unsigned struct_rlimit64_sz = sizeof(struct rlimit64);
30    unsigned struct_statvfs64_sz = sizeof(struct statvfs64);
31  #endif // SANITIZER_LINUX && !SANITIZER_ANDROID