diff --git a/srcpkgs/sun7i-kernel/patches/0001-ARM-fix-put_user-for-gcc-8.patch b/srcpkgs/sun7i-kernel/patches/0001-ARM-fix-put_user-for-gcc-8.patch new file mode 100644 index 00000000000..00570f8cf3e --- /dev/null +++ b/srcpkgs/sun7i-kernel/patches/0001-ARM-fix-put_user-for-gcc-8.patch @@ -0,0 +1,45 @@ +From 0ca85fc310e8c24cba10ed241a0188795e177683 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Thu, 26 Jul 2018 10:13:23 +0200 +Subject: [PATCH] ARM: fix put_user() for gcc-8 + +Building kernels before linux-4.7 with gcc-8 results in many build failures +when gcc triggers a check that was meant to catch broken compilers: + +/tmp/ccCGMQmS.s:648: Error: .err encountered + +According to the discussion in the gcc bugzilla, a local "register +asm()" variable is still supposed to be the correct way to force an +inline assembly to use a particular register, but marking it 'const' +lets the compiler do optimizations that break that, i.e the compiler is +free to treat the variable as either 'const' or 'register' in that case. + +Upstream commit 9f73bd8bb445 ("ARM: uaccess: remove put_user() code +duplication") fixed this problem in linux-4.8 as part of a larger change, +but seems a little too big to be backported to 4.4. + +Let's take the simplest fix and change only the one broken line in the +same way as newer kernels. + +Suggested-by: Bernd Edlinger +Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85745 +Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86673 +Signed-off-by: Arnd Bergmann +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm/include/asm/uaccess.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h +index 35c9db857ebe..cd8b589111ba 100644 +--- a/arch/arm/include/asm/uaccess.h ++++ b/arch/arm/include/asm/uaccess.h +@@ -251,7 +251,7 @@ extern int __put_user_8(void *, unsigned long long); + ({ \ + unsigned long __limit = current_thread_info()->addr_limit - 1; \ + const typeof(*(p)) __user *__tmp_p = (p); \ +- register const typeof(*(p)) __r2 asm("r2") = (x); \ ++ register typeof(*(p)) __r2 asm("r2") = (x); \ + register const typeof(*(p)) __user *__p asm("r0") = __tmp_p; \ + register unsigned long __l asm("r1") = __limit; \ + register int __e asm("r0"); \ diff --git a/srcpkgs/sun7i-kernel/patches/fix-cflags.patch b/srcpkgs/sun7i-kernel/patches/fix-cflags.patch new file mode 100644 index 00000000000..16117cfaf9f --- /dev/null +++ b/srcpkgs/sun7i-kernel/patches/fix-cflags.patch @@ -0,0 +1,13 @@ +Index: arch/arm/mach-sun7i/pm/standby/Makefile +=================================================================== +--- a/arch/arm/mach-sun7i/pm/standby/Makefile.orig ++++ b/arch/arm/mach-sun7i/pm/standby/Makefile +@@ -15,6 +15,8 @@ LD_FILE = standby.xn + KBUILD_CFLAGS := $(LINUXINCLUDE) -I$(srctree)/arch/arm/mach-sun7i/pm -Os -g -c + KBUILD_CFLAGS += -nostdlib -march=armv7-a -marm -mlittle-endian -D__STANDBY_MODULE__ + KBUILD_CFLAGS += -fno-unwind-tables -fno-asynchronous-unwind-tables ++KBUILD_CFLAGS += -fno-builtin -fno-tree-loop-distribute-patterns ++KBUILD_CFLAGS += -fno-stack-protector + KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ + + LDFLAGS_standby.elf := -T diff --git a/srcpkgs/sun7i-kernel/template b/srcpkgs/sun7i-kernel/template index 755636a526d..e8d90d53015 100644 --- a/srcpkgs/sun7i-kernel/template +++ b/srcpkgs/sun7i-kernel/template @@ -20,9 +20,11 @@ checksum="e3de775107e7ba6ad0cf3345844fca1d61c8a11037fa71a5238ead439d15a166 eeceb6459f2f40c91a6a5be8d8c60e68dec2631ec84d6165721edacb059507c4 f0bba58788f090dd213df0bde1ea0ce38999a8d28bebe443c899cb9cbc2b5eed" -create_wrksrc=yes -build_wrksrc="linux-sunxi-${_githash}" +wrksrc="linux-sunxi-${_githash}" _kernver="${version}_${revision}" +skip_extraction=" + 0001-Backport-firmware-loader.patch + 0001-Backport-msdos-partition-UUIDs.patch" nostrip=yes noverifyrdeps=yes @@ -30,6 +32,8 @@ archs="armv7l*" hostmakedepends="perl python kmod uboot-mkimage libressl bc" makedepends="ncurses-devel" triggers="kernel-hooks" +patch_args=-Np1 +python_version=2 # These files could be modified when an external module is built. mutable_files=" /usr/lib/modules/${_kernver}/modules.dep @@ -40,12 +44,11 @@ mutable_files=" /usr/lib/modules/${_kernver}/modules.alias.bin /usr/lib/modules/${_kernver}/modules.devname" -post_extract() { - cd "${build_wrksrc}" +post_patch() { # Apply backported kernel firmware changes required by eudev>=2.1. - patch -p1 -i ../0001-Backport-firmware-loader.patch + patch -p1 -i $XBPS_SRCDISTDIR/${pkgname}-${version}/0001-Backport-firmware-loader.patch # Apply backported kernel msdos partition UUID changes - patch -p1 -i ../0001-Backport-msdos-partition-UUIDs.patch + patch -p1 -i $XBPS_SRCDISTDIR/${pkgname}-${version}/0001-Backport-msdos-partition-UUIDs.patch } do_configure() {