diff --git a/pkgs/development/compilers/gcc/7/0001-Fix-build-for-glibc-2.31.patch b/pkgs/development/compilers/gcc/7/0001-Fix-build-for-glibc-2.31.patch new file mode 100644 index 000000000000..d8aad14942bf --- /dev/null +++ b/pkgs/development/compilers/gcc/7/0001-Fix-build-for-glibc-2.31.patch @@ -0,0 +1,62 @@ +From 2d03b6eaf823fc2db6a32b4a95e18f8a7474b47f Mon Sep 17 00:00:00 2001 +From: Maximilian Bosch +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 + diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index 89933c22edd4..dcd129ff25a7 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -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 [