1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-02-19 17:39:34 +00:00

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.
This commit is contained in:
Maximilian Bosch 2020-06-28 23:15:25 +02:00
parent 114f97e77e
commit 116f39ff82
No known key found for this signature in database
GPG key ID: 091DBF4D1FC46B8E
2 changed files with 51 additions and 0 deletions

View file

@ -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

View file

@ -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)