summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorneeshy2020-03-06 22:58:14 +0000
committerneeshy2020-03-07 14:30:12 -0500
commit144e24d84e48cade3aaf7643056565ce6831f013 (patch)
treed8ebf079103d289696872899e6c881db36599f67
parent8fd409ebfd98bcbd0e7416e77831ae448df35cf0 (diff)
downloadaur-144e24d84e48cade3aaf7643056565ce6831f013.tar.gz
hcc: Add patch for build failures on llvm
-rw-r--r--.SRCINFO2
-rw-r--r--Fix-sanitizer-common-build-with-glibc-2.31.patch87
-rw-r--r--PKGBUILD9
3 files changed, 96 insertions, 2 deletions
diff --git a/.SRCINFO b/.SRCINFO
index c0920bc2383e..1021afc51245 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -14,9 +14,11 @@ pkgbase = hcc
source = hcc-roc-hcc-3.1.0.tar.gz::https://github.com/RadeonOpenCompute/hcc/archive/roc-hcc-3.1.0.tar.gz
source = llvm-project-roc-hcc-3.1.0.tar.gz::https://github.com/RadeonOpenCompute/llvm-project/archive/roc-hcc-3.1.0.tar.gz
source = ROCm-Device-Libs-roc-hcc-3.1.0.tar.gz::https://github.com/RadeonOpenCompute/ROCm-Device-Libs/archive/roc-hcc-3.1.0.tar.gz
+ source = Fix-sanitizer-common-build-with-glibc-2.31.patch
sha256sums = c9274230aa282e6ae90be5885e3f5b71b02153ca60980fc2122d61a5870bf2a2
sha256sums = f76648116a2771a520545b9b5b3c931a8eb391f6f711f232924d92e8d1b43fc1
sha256sums = 42bd4f910dd44d6f0dd7bab7ebdadcf2e7cd4449ed7160dacc4471039584402c
+ sha256sums = 3d3e623d394d00b412735aa7c76e5971b605c0c9792f240b0500385caf9d5d47
pkgname = hcc
diff --git a/Fix-sanitizer-common-build-with-glibc-2.31.patch b/Fix-sanitizer-common-build-with-glibc-2.31.patch
new file mode 100644
index 000000000000..e06a002e39c7
--- /dev/null
+++ b/Fix-sanitizer-common-build-with-glibc-2.31.patch
@@ -0,0 +1,87 @@
+From 947f9692440836dcb8d88b74b69dd379d85974ce Mon Sep 17 00:00:00 2001
+From: Evgenii Stepanov <eugenis@google.com>
+Date: Mon, 25 Nov 2019 13:52:17 -0800
+Subject: [PATCH] Fix sanitizer-common build with glibc 2.31
+
+Summary:
+As mentioned in D69104, glibc changed ABI recently with the [[ https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=2f959dfe849e0646e27403f2e4091536496ac0f0| 2f959dfe ]] change.
+D69104 dealt with just 32-bit ARM, but that is just one of the many affected architectures.
+E.g. x86_64, i?86, riscv64, sparc 32-bit, s390 31-bit are affected too (and various others).
+
+This patch instead of adding a long list of further architectures that wouldn't be checked ever next to arm 32-bit changes the structures to match the 2.31 layout and performs the checking on Linux for ipc_perm mode position/size only on non-Linux or on Linux with glibc 2.31 or later. I think this matches what is done for aarch64 already.
+If needed, we could list architectures that haven't changed ABI (e.g. powerpc), so that they would be checked even with older glibcs. AFAIK sanitizers don't actually use ipc_perm.mode and
+so all they care about is the size and alignment of the whole structure.
+
+Note, s390 31-bit and arm 32-bit big-endian changed ABI even further, there will now be shmctl with old symbol version and shmctl@@GLIBC_2.31 which will be incompatible. I'm afraid this isn't really solvable unless the sanitizer libraries are symbol versioned and use matching symbol versions to glibc symbols for stuff they intercept, plus use dlvsym.
+This patch doesn't try to address that.
+
+Patch by Jakub Jelinek.
+
+Reviewers: kcc, eugenis, dvyukov
+
+Reviewed By: eugenis
+
+Subscribers: jyknight, kristof.beyls, fedor.sergeev, simoncook, PkmX, s.egerton, steven.zhang, #sanitizers, llvm-commits
+
+Tags: #sanitizers, #llvm
+
+Differential Revision: https://reviews.llvm.org/D70662
+---
+ .../sanitizer_platform_limits_posix.cpp | 8 +++-----
+ .../sanitizer_platform_limits_posix.h | 15 +--------------
+ 2 files changed, 4 insertions(+), 19 deletions(-)
+
+diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
+index b4f8f67b664..aa845df4dde 100644
+--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
++++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
+@@ -1128,11 +1128,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)) && \
+- !defined(__arm__)
+-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */
+-/* On Arm newer glibc provide a different mode field, it's hard to detect
+- so just disable the check. */
++#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 7789bc5887a..5337b26b29b 100644
+--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
++++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+@@ -207,26 +207,13 @@ struct __sanitizer_ipc_perm {
+ 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.17.1
+
diff --git a/PKGBUILD b/PKGBUILD
index 2be73530dd1b..7f4078f64661 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -14,15 +14,20 @@ makedepends=('cmake' 'python')
options=(!staticlibs strip)
source=("hcc-roc-hcc-$pkgver.tar.gz::https://github.com/RadeonOpenCompute/hcc/archive/roc-hcc-$pkgver.tar.gz"
"llvm-project-roc-hcc-$pkgver.tar.gz::https://github.com/RadeonOpenCompute/llvm-project/archive/roc-hcc-$pkgver.tar.gz"
- "ROCm-Device-Libs-roc-hcc-$pkgver.tar.gz::https://github.com/RadeonOpenCompute/ROCm-Device-Libs/archive/roc-hcc-$pkgver.tar.gz")
+ "ROCm-Device-Libs-roc-hcc-$pkgver.tar.gz::https://github.com/RadeonOpenCompute/ROCm-Device-Libs/archive/roc-hcc-$pkgver.tar.gz"
+ "Fix-sanitizer-common-build-with-glibc-2.31.patch")
sha256sums=('c9274230aa282e6ae90be5885e3f5b71b02153ca60980fc2122d61a5870bf2a2'
'f76648116a2771a520545b9b5b3c931a8eb391f6f711f232924d92e8d1b43fc1'
- '42bd4f910dd44d6f0dd7bab7ebdadcf2e7cd4449ed7160dacc4471039584402c')
+ '42bd4f910dd44d6f0dd7bab7ebdadcf2e7cd4449ed7160dacc4471039584402c'
+ '3d3e623d394d00b412735aa7c76e5971b605c0c9792f240b0500385caf9d5d47')
prepare() {
cd "$srcdir"
mv -T "llvm-project-roc-hcc-$pkgver" "hcc-roc-hcc-$pkgver/llvm-project"
mv -T "ROCm-Device-Libs-roc-hcc-$pkgver" "hcc-roc-hcc-$pkgver/rocdl"
+
+ cd "$srcdir/hcc-roc-hcc-$pkgver/llvm-project"
+ patch -Np1 -i "$srcdir/Fix-sanitizer-common-build-with-glibc-2.31.patch"
}
build() {