summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorRuben Van Boxem2017-09-17 21:17:57 +0200
committerRuben Van Boxem2017-09-17 21:17:57 +0200
commit97906617b3386b612dda39f42d1ae2e5bdfe0ebd (patch)
tree18729d4cd4354224b013d916bf084c4d868a06a3
parent9d13031e7f3c1a89f841e58a98a685f4dbc724d5 (diff)
downloadaur-97906617b3386b612dda39f42d1ae2e5bdfe0ebd.tar.gz
Fix build for glibc 2.26
-rw-r--r--.SRCINFO6
-rw-r--r--0000-gcc-4.9.ucontext.patch17
-rw-r--r--0001-gcc-4.9-SIGSEGV.patch14
-rw-r--r--0002-gcc-4.9-__res_state.patch15
-rw-r--r--PKGBUILD26
5 files changed, 76 insertions, 2 deletions
diff --git a/.SRCINFO b/.SRCINFO
index a666f36390b..ba589d3aebe 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -18,9 +18,15 @@ pkgbase = gcc49
source = ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.9.4/gcc-4.9.4.tar.bz2
source = ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-0.12.2.tar.bz2
source = ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-0.18.1.tar.gz
+ source = 0000-gcc-4.9.ucontext.patch
+ source = 0001-gcc-4.9-SIGSEGV.patch
+ source = 0002-gcc-4.9-__res_state.patch
md5sums = 87c24a4090c1577ba817ec6882602491
md5sums = e039bfcfb6c2ab039b8ee69bf883e824
md5sums = e34fca0540d840e5d0f6427e98c92252
+ md5sums = 4a0dc704f1d92ceb4dd8608811241cec
+ md5sums = e787a03f0c38434490515a5823eca0b8
+ md5sums = c64d1e20274ff4fbfacdd11bef2e1273
pkgname = gcc49
diff --git a/0000-gcc-4.9.ucontext.patch b/0000-gcc-4.9.ucontext.patch
new file mode 100644
index 00000000000..db82c22e3bc
--- /dev/null
+++ b/0000-gcc-4.9.ucontext.patch
@@ -0,0 +1,17 @@
+--- libsanitizer/sanitizer_common/sanitizer_linux.h.orig 2013-12-05 04:18:38.000000000 -0500
++++ libsanitizer/sanitizer_common/sanitizer_linux.h 2017-09-12 18:30:52.178616638 -0400
+@@ -14,13 +14,13 @@
+ #include "sanitizer_platform.h"
+ #if SANITIZER_LINUX
+ #include "sanitizer_common.h"
+ #include "sanitizer_internal_defs.h"
+ #include "sanitizer_platform_limits_posix.h"
++#include <sys/ucontext.h>
+
+ struct link_map; // Opaque type returned by dlopen().
+-struct sigaltstack;
+
+ namespace __sanitizer {
+ // Dirent structure for getdents(). Note that this structure is different from
+ // the one in <dirent.h>, which is used by readdir().
+ struct linux_dirent;
diff --git a/0001-gcc-4.9-SIGSEGV.patch b/0001-gcc-4.9-SIGSEGV.patch
new file mode 100644
index 00000000000..78baa6bef4f
--- /dev/null
+++ b/0001-gcc-4.9-SIGSEGV.patch
@@ -0,0 +1,14 @@
+--- libsanitizer/asan/asan_linux.cc.orig 2013-12-05 04:18:38.000000000 -0500
++++ libsanitizer/asan/asan_linux.cc 2017-09-12 18:59:45.310819390 -0400
+@@ -27,10 +27,11 @@
+ #include <fcntl.h>
+ #include <pthread.h>
+ #include <stdio.h>
+ #include <unistd.h>
+ #include <unwind.h>
++#include <signal.h>
+
+ #if !SANITIZER_ANDROID
+ // FIXME: where to get ucontext on Android?
+ #include <sys/ucontext.h>
+ #endif
diff --git a/0002-gcc-4.9-__res_state.patch b/0002-gcc-4.9-__res_state.patch
new file mode 100644
index 00000000000..2b45ccd5a92
--- /dev/null
+++ b/0002-gcc-4.9-__res_state.patch
@@ -0,0 +1,15 @@
+--- libsanitizer/tsan/tsan_platform_linux.cc.orig 2013-12-05 04:18:38.000000000 -0500
++++ libsanitizer/tsan/tsan_platform_linux.cc 2017-09-12 19:25:25.698833952 -0400
+@@ -349,11 +349,11 @@ bool IsGlobalVar(uptr addr) {
+ // Extract file descriptors passed to glibc internal __res_iclose function.
+ // This is required to properly "close" the fds, because we do not see internal
+ // closes within glibc. The code is a pure hack.
+ int ExtractResolvFDs(void *state, int *fds, int nfd) {
+ int cnt = 0;
+- __res_state *statp = (__res_state*)state;
++ res_state statp = (res_state)state;
+ for (int i = 0; i < MAXNS && cnt < nfd; i++) {
+ if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1)
+ fds[cnt++] = statp->_u._ext.nssocks[i];
+ }
+ return cnt;
diff --git a/PKGBUILD b/PKGBUILD
index f205e5b2bfb..9ef36e0c7b8 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -18,10 +18,16 @@ checkdepends=('dejagnu' 'inetutils')
options=('!emptydirs')
source=("ftp://gcc.gnu.org/pub/gcc/releases/gcc-${pkgver}/gcc-${pkgver}.tar.bz2"
"ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-${_islver}.tar.bz2"
- "ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-${_cloogver}.tar.gz")
+ "ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-${_cloogver}.tar.gz"
+ "0000-gcc-4.9.ucontext.patch"
+ "0001-gcc-4.9-SIGSEGV.patch"
+ "0002-gcc-4.9-__res_state.patch")
md5sums=('87c24a4090c1577ba817ec6882602491'
'e039bfcfb6c2ab039b8ee69bf883e824'
- 'e34fca0540d840e5d0f6427e98c92252')
+ 'e34fca0540d840e5d0f6427e98c92252'
+ '4a0dc704f1d92ceb4dd8608811241cec'
+ 'e787a03f0c38434490515a5823eca0b8'
+ 'c64d1e20274ff4fbfacdd11bef2e1273')
_basedir=gcc-${pkgver}
_libdir="usr/lib/gcc/$CHOST/$pkgver"
@@ -43,6 +49,22 @@ prepare() {
# hack! - some configure tests for header files using "$CPP $CPPFLAGS"
sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {libiberty,gcc}/configure
+
+ # fix build with glibc 2.26
+ #diff -pNau5 libsanitizer/sanitizer_common/sanitizer_linux.h{.orig,} > '../0000-gcc-4.9.ucontext.patch'
+ patch -Nbup0 -i "${srcdir}/0000-gcc-4.9.ucontext.patch" # https://gcc.gnu.org/bugzilla/attachment.cgi?id=41921
+ #diff -pNau5 libsanitizer/asan/asan_linux.cc{.orig,} > '../0001-gcc-4.9-SIGSEGV.patch'
+ patch -Nbup0 -i "${srcdir}/0001-gcc-4.9-SIGSEGV.patch"
+ #diff -pNau5 libsanitizer/tsan/tsan_platform_linux.cc{.orig,} > '../0002-gcc-4.9-__res_state.patch'
+ patch -Nbup0 -i "${srcdir}/0002-gcc-4.9-__res_state.patch" # https://gcc.gnu.org/bugzilla/attachment.cgi?id=41922
+ sed -e 's:\bstruct ucontext\b:ucontext_t:g' -i $(grep --include '*.[ch]' --include '*.cc' -lre '\bstruct ucontext\b')
+ sed -e 's:\bstruct sigaltstack\b:stack_t:g' -i $(grep --include '*.[ch]' --include '*.cc' -lre '\bstruct sigaltstack\b')
+ sed -e '/^struct ucontext_t/,/^};/ d' -i 'libsanitizer/tsan/tsan_interceptors.cc'
+ if grep -e '^struct ucontext_t' 'libsanitizer/tsan/tsan_interceptors.cc'; then
+ set +u
+ echo 'Failed to remove ^struct ucontext_t'
+ false
+ fi
mkdir ${srcdir}/gcc-build
}