From 116f39ff8264b2084c613c088b6876e7eeba43f9 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sun, 28 Jun 2020 23:15:25 +0200 Subject: swift: fix build w/glibc-2.31 https://hydra.nixos.org/build/123279517 Internally used `compiler-rt` had to be fixed for `glibc-2.31`, basically the same approach as in the LLVM fix (7137183bbe05738246be2be0e704c1be9bf19947). As soon as a newer `compiler-rt` is used for `swift`, this patch can be removed again. --- pkgs/development/compilers/swift/default.nix | 3 ++ .../compilers/swift/patches/swift-llvm.patch | 48 ++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 pkgs/development/compilers/swift/patches/swift-llvm.patch (limited to 'pkgs/development') diff --git a/pkgs/development/compilers/swift/default.nix b/pkgs/development/compilers/swift/default.nix index 1ebef9a9ba5..b838aa59177 100644 --- a/pkgs/development/compilers/swift/default.nix +++ b/pkgs/development/compilers/swift/default.nix @@ -182,6 +182,9 @@ stdenv.mkDerivation { ''; patchPhase = '' + # Glibc 2.31 fix + patch -p1 -i ${./patches/swift-llvm.patch} + # Just patch all the things for now, we can focus this later patchShebangs $SWIFT_SOURCE_ROOT diff --git a/pkgs/development/compilers/swift/patches/swift-llvm.patch b/pkgs/development/compilers/swift/patches/swift-llvm.patch new file mode 100644 index 00000000000..fcd9533fd72 --- /dev/null +++ b/pkgs/development/compilers/swift/patches/swift-llvm.patch @@ -0,0 +1,48 @@ +diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc +index bc6675bf4..2f3514b64 100644 +--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc ++++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc +@@ -1129,8 +1129,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/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h +index de69852d3..652d5cb3b 100644 +--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h ++++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h +@@ -204,26 +204,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) -- cgit 1.4.1