Skip to content

Commit

Permalink
gcc8: fix build w/glibc-2.31
Browse files Browse the repository at this point in the history
  • Loading branch information
Ma27 committed Feb 20, 2020
1 parent 03296bf commit 6c2b298
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 2 deletions.
@@ -0,0 +1,61 @@
From 8d87a4ae8d48e837082198ea985241aaf5ecfbcb Mon Sep 17 00:00:00 2001
From: Maximilian Bosch <maximilian@mbosch.me>
Date: Thu, 20 Feb 2020 17:26:04 +0100
Subject: [PATCH] Fix build with 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 a915d37cd..5c720b2e7 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -1147,8 +1147,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 4d11d0717..9c1429623 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -210,26 +210,13 @@ namespace __sanitizer {
u64 __unused1;
u64 __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;
-#elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__)
- unsigned int mode;
- unsigned short __seq;
- unsigned short __pad1;
- unsigned long __unused1;
- unsigned 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

4 changes: 2 additions & 2 deletions pkgs/development/compilers/gcc/8/default.nix
Expand Up @@ -47,8 +47,8 @@ let majorVersion = "8";

inherit (stdenv) buildPlatform hostPlatform targetPlatform;

patches =
optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
patches = [ ./0001-Fix-build-with-glibc-2.31.patch ]
++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
++ optional noSysDirs ../no-sys-dirs.patch
/* ++ optional (hostPlatform != buildPlatform) (fetchpatch { # XXX: Refine when this should be applied
url = "https://git.busybox.net/buildroot/plain/package/gcc/${version}/0900-remove-selftests.patch?id=11271540bfe6adafbc133caf6b5b902a816f5f02";
Expand Down

0 comments on commit 6c2b298

Please sign in to comment.