gcc7: fix build w/glibc-2.31

Applied a patch from the `gcc9` branch for `gcc7` to fix `libsanitizer`
for glibc-2.31.
This commit is contained in:
Maximilian Bosch 2020-02-20 02:06:23 +01:00
parent 4847222db1
commit cff1a1eefc
No known key found for this signature in database
GPG key ID: 091DBF4D1FC46B8E
2 changed files with 64 additions and 0 deletions

View file

@ -0,0 +1,62 @@
From 2d03b6eaf823fc2db6a32b4a95e18f8a7474b47f Mon Sep 17 00:00:00 2001
From: Maximilian Bosch <maximilian@mbosch.me>
Date: Thu, 20 Feb 2020 01:56:42 +0100
Subject: [PATCH] Fix build for glibc 2.31
---
.../sanitizer_platform_limits_posix.cc | 5 +++--
.../sanitizer_platform_limits_posix.h | 15 +--------------
2 files changed, 4 insertions(+), 16 deletions(-)
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
index 97eae3fc7..4089d4695 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -1145,8 +1145,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)
-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */
+#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
+/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit
+ on many architectures. */
CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
#endif
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
index c13932283..3456fb2db 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -204,27 +204,14 @@ namespace __sanitizer {
unsigned __seq;
u64 __unused1;
u64 __unused2;
-#elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__)
- unsigned int mode;
- unsigned short __seq;
- unsigned short __pad1;
- unsigned long __unused1;
- unsigned long __unused2;
#elif defined(__sparc__)
-# if defined(__arch64__)
unsigned mode;
- unsigned short __pad1;
-# else
- unsigned short __pad1;
- unsigned short mode;
unsigned short __pad2;
-# endif
unsigned short __seq;
unsigned long long __unused1;
unsigned long long __unused2;
#else
- unsigned short mode;
- unsigned short __pad1;
+ unsigned int mode;
unsigned short __seq;
unsigned short __pad2;
#if defined(__x86_64__) && !defined(_LP64)
--
2.25.0

View file

@ -53,6 +53,8 @@ let majorVersion = "7";
./riscv-pthread-reentrant.patch
# https://gcc.gnu.org/ml/gcc-patches/2018-03/msg00297.html
./riscv-no-relax.patch
./0001-Fix-build-for-glibc-2.31.patch
]
++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
++ optionals targetPlatform.isNetBSD [