From c945b47a25d4fa0c0ac342291b2142eb9807a746 Mon Sep 17 00:00:00 2001 From: Ivan Kozik Date: Tue, 10 Nov 2020 21:57:51 +0000 Subject: [PATCH] linuxPackages.wireguard: fix the build on linux 5.4.76 Patch copied from https://github.com/archlinux/svntogit-packages/blob/packages/wireguard-dkms/trunk/lts.diff This fixes: ``` In file included from : /build/source/src/compat/compat-asm.h:44: warning: "SYM_FUNC_START" redefined 44 | #define SYM_FUNC_START ENTRY | In file included from /build/source/src/compat/compat-asm.h:9, from : /nix/store/cz60577g5hwk78c2z7rhxl21bklaqr0d-linux-5.4.77-dev/lib/modules/5.4.77-hardened/source/include/linux/linkage.h:218: note: this is the location of the previous definition 218 | #define SYM_FUNC_START(name) \ | In file included from : /build/source/src/compat/compat-asm.h:45: warning: "SYM_FUNC_END" redefined 45 | #define SYM_FUNC_END ENDPROC | In file included from /build/source/src/compat/compat-asm.h:9, from : /nix/store/cz60577g5hwk78c2z7rhxl21bklaqr0d-linux-5.4.77-dev/lib/modules/5.4.77-hardened/source/include/linux/linkage.h:265: note: this is the location of the previous definition 265 | #define SYM_FUNC_END(name) \ | /build/source/src/crypto/zinc/blake2s/blake2s-x86_64.S: Assembler messages: /build/source/src/crypto/zinc/blake2s/blake2s-x86_64.S:50: Error: invalid character '(' in mnemonic /build/source/src/crypto/zinc/blake2s/blake2s-x86_64.S:176: Error: invalid character '(' in mnemonic /build/source/src/crypto/zinc/blake2s/blake2s-x86_64.S:180: Error: invalid character '(' in mnemonic /build/source/src/crypto/zinc/blake2s/blake2s-x86_64.S:257: Error: invalid character '(' in mnemonic make[3]: *** [/nix/store/cz60577g5hwk78c2z7rhxl21bklaqr0d-linux-5.4.77-dev/lib/modules/5.4.77-hardened/source/scripts/Makefile.build:348: /build/source/src/crypto/zinc/blake2s/blake2s-x86_64.o] Error 1 make[3]: *** Waiting for unfinished jobs.... In file included from : /build/source/src/compat/compat-asm.h:44: warning: "SYM_FUNC_START" redefined 44 | #define SYM_FUNC_START ENTRY | In file included from /build/source/src/compat/compat-asm.h:9, from : /nix/store/cz60577g5hwk78c2z7rhxl21bklaqr0d-linux-5.4.77-dev/lib/modules/5.4.77-hardened/source/include/linux/linkage.h:218: note: this is the location of the previous definition 218 | #define SYM_FUNC_START(name) \ | In file included from : /build/source/src/compat/compat-asm.h:45: warning: "SYM_FUNC_END" redefined 45 | #define SYM_FUNC_END ENDPROC | In file included from /build/source/src/compat/compat-asm.h:9, from : /nix/store/cz60577g5hwk78c2z7rhxl21bklaqr0d-linux-5.4.77-dev/lib/modules/5.4.77-hardened/source/include/linux/linkage.h:265: note: this is the location of the previous definition 265 | #define SYM_FUNC_END(name) \ | /build/source/src/crypto/zinc/chacha20/chacha20-x86_64.S: Assembler messages: /build/source/src/crypto/zinc/chacha20/chacha20-x86_64.S:123: Error: invalid character '(' in mnemonic /build/source/src/crypto/zinc/chacha20/chacha20-x86_64.S:185: Error: invalid character '(' in mnemonic /build/source/src/crypto/zinc/chacha20/chacha20-x86_64.S:187: Error: invalid character '(' in mnemonic /build/source/src/crypto/zinc/chacha20/chacha20-x86_64.S:319: Error: invalid character '(' in mnemonic /build/source/src/crypto/zinc/chacha20/chacha20-x86_64.S:1016: Error: invalid character '(' in mnemonic /build/source/src/crypto/zinc/chacha20/chacha20-x86_64.S:1616: Error: invalid character '(' in mnemonic /build/source/src/crypto/zinc/chacha20/chacha20-x86_64.S:1620: Error: invalid character '(' in mnemonic /build/source/src/crypto/zinc/chacha20/chacha20-x86_64.S:1810: Error: invalid character '(' in mnemonic /build/source/src/crypto/zinc/chacha20/chacha20-x86_64.S:1812: Error: invalid character '(' in mnemonic /build/source/src/crypto/zinc/chacha20/chacha20-x86_64.S:1959: Error: invalid character '(' in mnemonic make[3]: *** [/nix/store/cz60577g5hwk78c2z7rhxl21bklaqr0d-linux-5.4.77-dev/lib/modules/5.4.77-hardened/source/scripts/Makefile.build:348: /build/source/src/crypto/zinc/chacha20/chacha20-x86_64.o] Error 1 make[2]: *** [/nix/store/cz60577g5hwk78c2z7rhxl21bklaqr0d-linux-5.4.77-dev/lib/modules/5.4.77-hardened/source/Makefile:1729: /build/source/src] Error 2 make[1]: *** [/nix/store/cz60577g5hwk78c2z7rhxl21bklaqr0d-linux-5.4.77-dev/lib/modules/5.4.77-hardened/source/Makefile:179: sub-make] Error 2 make: *** [Makefile:26: module] Error 2 builder for '/nix/store/hll3sjyrwa55arzlsxnbacqdd8s842l1-wireguard-1.0.20200908.drv' failed with exit code 2 ``` --- pkgs/os-specific/linux/wireguard/default.nix | 4 ++++ .../linux/wireguard/linux-5.4.76-fix.patch | 12 ++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 pkgs/os-specific/linux/wireguard/linux-5.4.76-fix.patch diff --git a/pkgs/os-specific/linux/wireguard/default.nix b/pkgs/os-specific/linux/wireguard/default.nix index b8b65fecafc2..ef81dd54a736 100644 --- a/pkgs/os-specific/linux/wireguard/default.nix +++ b/pkgs/os-specific/linux/wireguard/default.nix @@ -14,6 +14,10 @@ stdenv.mkDerivation rec { sha256 = "1nd2kc3c62907kxm1084dw7krd8xsy3hxydmcpz4jvk03vm5dnkg"; }; + patches = [ + ./linux-5.4.76-fix.patch + ]; + hardeningDisable = [ "pic" ]; KERNELDIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"; diff --git a/pkgs/os-specific/linux/wireguard/linux-5.4.76-fix.patch b/pkgs/os-specific/linux/wireguard/linux-5.4.76-fix.patch new file mode 100644 index 000000000000..78c3365bcb32 --- /dev/null +++ b/pkgs/os-specific/linux/wireguard/linux-5.4.76-fix.patch @@ -0,0 +1,12 @@ +diff -u -r wireguard-linux-compat-1.0.20200908/src/compat/compat-asm.h wireguard-linux-compat-1.0.20200908-lts/src/compat/compat-asm.h +--- wireguard-linux-compat-1.0.20200908/src/compat/compat-asm.h 2020-09-08 16:22:40.000000000 +0000 ++++ wireguard-linux-compat-1.0.20200908-lts/src/compat/compat-asm.h 2020-11-10 15:05:43.720093522 +0000 +@@ -40,7 +40,7 @@ + #undef pull + #endif + +-#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0) ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 76) + #define SYM_FUNC_START ENTRY + #define SYM_FUNC_END ENDPROC + #endif