gnu: opendht: Update to 2.2.0rc4.
[jackhill/guix/guix.git] / gnu / packages / patches / gcc-libsanitizer-ustat.patch
1 Remove use of deprecated ustat interface in glibc 2.28:
2
3 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85835
4
5 Taken from upstream:
6
7 https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=260684
8
9 diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
10 index 858bb2184505..de18e56d11cf 100644
11 --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
12 +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
13 @@ -157,7 +157,6 @@ typedef struct user_fpregs elf_fpregset_t;
14 # include <sys/procfs.h>
15 #endif
16 #include <sys/user.h>
17 -#include <sys/ustat.h>
18 #include <linux/cyclades.h>
19 #include <linux/if_eql.h>
20 #include <linux/if_plip.h>
21 @@ -250,7 +249,19 @@ namespace __sanitizer {
22 #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
23
24 #if SANITIZER_LINUX && !SANITIZER_ANDROID
25 - unsigned struct_ustat_sz = sizeof(struct ustat);
26 + // Use pre-computed size of struct ustat to avoid <sys/ustat.h> which
27 + // has been removed from glibc 2.28.
28 +#if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \
29 + || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \
30 + || defined(__x86_64__)
31 +#define SIZEOF_STRUCT_USTAT 32
32 +#elif defined(__arm__) || defined(__i386__) || defined(__mips__) \
33 + || defined(__powerpc__) || defined(__s390__)
34 +#define SIZEOF_STRUCT_USTAT 20
35 +#else
36 +#error Unknown size of struct ustat
37 +#endif
38 + unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT;
39 unsigned struct_rlimit64_sz = sizeof(struct rlimit64);
40 unsigned struct_statvfs64_sz = sizeof(struct statvfs64);
41 #endif // SANITIZER_LINUX && !SANITIZER_ANDROID