gnu: clang-runtime: Fix build with glibc 2.31.

* gnu/packages/patches/clang-runtime-3.8-libsanitizer-mode-field.patch,
gnu/packages/patches/clang-runtime-3.9-libsanitizer-mode-field.patch,
gnu/packages/patches/clang-runtime-9-libsanitizer-mode-field.patch: New files.
* gnu/local.mk (dist_patch_DATA): Adjust accordingly.
* gnu/packages/llvm.scm (clang-runtime, clang-runtime-8, clang-runtime-7,
clang-runtime-6, clang-runtime-3.9.1, clang-runtime-3.8, clang-runtime-3.7):
Add the respective patches.
This commit is contained in:
Marius Bakke 2020-03-05 17:27:20 +01:00
parent 3fd9c90c4a
commit af88972bb8
No known key found for this signature in database
GPG key ID: A2A06DF2A33A54FA
5 changed files with 176 additions and 6 deletions

View file

@ -783,6 +783,9 @@ dist_patch_DATA = \
%D%/packages/patches/clang-9.0-libc-search-path.patch \
%D%/packages/patches/clang-runtime-asan-build-fixes.patch \
%D%/packages/patches/clang-runtime-esan-build-fixes.patch \
%D%/packages/patches/clang-runtime-9-libsanitizer-mode-field.patch \
%D%/packages/patches/clang-runtime-3.9-libsanitizer-mode-field.patch \
%D%/packages/patches/clang-runtime-3.8-libsanitizer-mode-field.patch \
%D%/packages/patches/classpath-aarch64-support.patch \
%D%/packages/patches/clementine-fix-sqlite.patch \
%D%/packages/patches/clementine-remove-crypto++-dependency.patch \

View file

@ -404,7 +404,8 @@ (define (make-clang-toolchain clang)
(define-public clang-runtime
(clang-runtime-from-llvm
llvm
"0xwh79g3zggdabxgnd0bphry75asm1qz7mv3hcqihqwqr6aspgy2"))
"0xwh79g3zggdabxgnd0bphry75asm1qz7mv3hcqihqwqr6aspgy2"
'("clang-runtime-9-libsanitizer-mode-field.patch")))
(define-public clang
(clang-from-llvm llvm clang-runtime
@ -434,7 +435,8 @@ (define-public llvm-8
(define-public clang-runtime-8
(clang-runtime-from-llvm
llvm-8
"1c919wsm17xnv7lr8bhpq2wkq8113lzlw6hzhfr737j59x3wfddl"))
"1c919wsm17xnv7lr8bhpq2wkq8113lzlw6hzhfr737j59x3wfddl"
'("clang-runtime-9-libsanitizer-mode-field.patch")))
(define-public clang-8
(clang-from-llvm llvm-8 clang-runtime-8
@ -458,7 +460,8 @@ (define-public llvm-7
(define-public clang-runtime-7
(clang-runtime-from-llvm
llvm-7
"065ybd8fsc4h2hikbdyricj6pyv4r7r7kpcikhb2y5zf370xybkq"))
"065ybd8fsc4h2hikbdyricj6pyv4r7r7kpcikhb2y5zf370xybkq"
'("clang-runtime-9-libsanitizer-mode-field.patch")))
(define-public clang-7
(clang-from-llvm llvm-7 clang-runtime-7
@ -482,7 +485,8 @@ (define-public llvm-6
(define-public clang-runtime-6
(clang-runtime-from-llvm
llvm-6
"1fcr3jn24yr8lh36nc0c4ikli4744i2q9m1ik67p1jymwwaixkgl"))
"1fcr3jn24yr8lh36nc0c4ikli4744i2q9m1ik67p1jymwwaixkgl"
'("clang-runtime-9-libsanitizer-mode-field.patch")))
(define-public clang-6
(clang-from-llvm llvm-6 clang-runtime-6
@ -514,7 +518,8 @@ (define-public clang-runtime-3.9.1
(clang-runtime-from-llvm
llvm-3.9.1
"16gc2gdmp5c800qvydrdhsp0bzb97s8wrakl6i8a4lgslnqnf2fk"
'("clang-runtime-asan-build-fixes.patch"
'("clang-runtime-3.9-libsanitizer-mode-field.patch"
"clang-runtime-asan-build-fixes.patch"
"clang-runtime-esan-build-fixes.patch"
"clang-3.5-libsanitizer-ustat-fix.patch")))
@ -540,6 +545,7 @@ (define-public clang-runtime-3.8
llvm-3.8
"0p0y85c7izndbpg2l816z7z7558axq11d5pwkm4h11sdw7d13w0d"
'("clang-runtime-asan-build-fixes.patch"
"clang-runtime-3.8-libsanitizer-mode-field.patch"
"clang-3.5-libsanitizer-ustat-fix.patch")))
(define-public clang-3.8
@ -563,6 +569,7 @@ (define-public clang-runtime-3.7
llvm-3.7
"10c1mz2q4bdq9bqfgr3dirc6hz1h3sq8573srd5q5lr7m7j6jiwx"
'("clang-runtime-asan-build-fixes.patch"
"clang-runtime-3.8-libsanitizer-mode-field.patch"
"clang-3.5-libsanitizer-ustat-fix.patch")))
(define-public clang-3.7
@ -585,7 +592,7 @@ (define-public clang-runtime-3.6
(clang-runtime-from-llvm
llvm-3.6
"11qx8d3pbfqjaj2x207pvlvzihbs1z2xbw4crpz7aid6h1yz6bqg"
'("clang-runtime-asan-build-fixes.patch")))
'("clang-runtime-asan-build-fixes.patch")))
(define-public clang-3.6
(clang-from-llvm llvm-3.6 clang-runtime-3.6

View file

@ -0,0 +1,50 @@
Adjust libsanitizer to ABI change in glibc 2.31.
Adapted to 3.x from this upstream commit:
https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce
diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -1130,8 +1130,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
#ifndef __GLIBC_PREREQ
#define __GLIBC_PREREQ(x, y) 0
#endif
-#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/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/lib/sanitizer_common/sanitizer_platform_limits_posix.h
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -188,17 +188,16 @@ namespace __sanitizer {
unsigned __seq;
u64 __unused1;
u64 __unused2;
-#elif defined(__mips__) || defined(__aarch64__)
- unsigned int mode;
- unsigned short __seq;
- unsigned short __pad1;
- unsigned long __unused1;
- unsigned long __unused2;
+#elif defined(__sparc__)
+ unsigned mode;
+ unsigned short __pad2;
+ unsigned short __seq;
+ unsigned long long __unused1;
+ unsigned long long __unused2;
#else
- unsigned short mode;
- unsigned short __pad1;
- unsigned short __seq;
- unsigned short __pad2;
+ unsigned int mode;
+ unsigned short __seq;
+ unsigned short __pad2;
#if defined(__x86_64__) && !defined(_LP64)
u64 __unused1;
u64 __unused2;

View file

@ -0,0 +1,50 @@
Adjust libsanitizer to ABI change in glibc 2.31.
Adapted to 3.x from this upstream commit:
https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce
diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -1139,8 +1139,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/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -194,17 +194,16 @@ 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__)
+ unsigned mode;
+ unsigned short __pad2;
+ unsigned short __seq;
+ unsigned long long __unused1;
+ unsigned long long __unused2;
#else
- unsigned short mode;
- unsigned short __pad1;
- unsigned short __seq;
- unsigned short __pad2;
+ unsigned int mode;
+ unsigned short __seq;
+ unsigned short __pad2;
#if defined(__x86_64__) && !defined(_LP64)
u64 __unused1;
u64 __unused2;

View file

@ -0,0 +1,60 @@
Adjust libsanitizer to ABI change in glibc 2.31.
Taken from this upstream commit:
https://github.com/llvm/llvm-project/commit/947f9692440836dcb8d88b74b69dd379d85974ce
diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -1126,8 +1126,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
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -203,28 +203,15 @@ 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;
+ unsigned mode;
+ unsigned short __pad2;
+ unsigned short __seq;
+ unsigned long long __unused1;
+ unsigned long long __unused2;
#else
- unsigned short mode;
- unsigned short __pad1;
- unsigned short __seq;
- unsigned short __pad2;
+ unsigned int mode;
+ unsigned short __seq;
+ unsigned short __pad2;
#if defined(__x86_64__) && !defined(_LP64)
u64 __unused1;
u64 __unused2;