+ # Same as above for the v4.4 branch
+ if ( { vergte "${kversion}" "4.4"; } && { verlt "${kversion}" "4.4.257"; } ); then
+ patch_linux_kernel 3140b0740b31cc63cf2ee08bc3f746b423eb068d
+ if grep -q elfcore.o kernel/Makefile ; then
+ sed -i '/^.* += elfcore.o$/d' kernel/Makefile
+ fi
+ fi
+
+ if { vergte "${kversion}" "4.5"; } && { verlt "${kversion}" "4.8"; } ; then
+ # Kernels between v4.5 and v4.8 built with gcc >= 8 on arm will hit an
+ # assembler error :
+ #
+ # kernel/.tmp_fork.s: Assembler messages:
+ # kernel/.tmp_fork.s:1790: Error: .err encountered
+ #
+ # @see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85745
+ #
+ patch_linux_kernel 9f73bd8bb445e0cbe4bcef6d4cfc788f1e184007
+ fi
+
+ if ( { vergte "${kversion}" "4.4"; } && { verlt "${kversion}" "4.4.136"; } ) ||
+ ( { vergte "${kversion}" "4.5"; } && { verlt "${kversion}" "4.8"; } ); then
+ # Hacky patch to deal with the following build error:
+ # Cannot find symbol for section 7: .text.unlikely.
+ # kernel/kexec_file.o: failed
+ # make[1]: *** [scripts/Makefile.build:291: kernel/kexec_file.o] Error 1
+ #
+ # This error happens with binutils 2.36 and 2.37, but should probably not
+ # be an issue with binutils 2.38.
+ # @see https://github.com/linuxppc/issues/issues/388
+ # @see https://github.com/bminor/binutils-gdb/commit/c09c8b42021180eee9495bd50d8b35e683d3901b
+ #
+ # There is some sort of config (unspecified in past discussions) which
+ # provokes the error, and there was never a potential fix merged in
+ # this discussion, in part because the build systems of the kernel
+ # switched to objtool instead.
+ #
+ # @see https://lore.kernel.org/all/20210215162209.5e2a475b@gandalf.local.home/
+ #
+ sed -i 's/return txtname;/return shdr0->sh_size ? txtname : NULL;/' scripts/recordmcount.h
+
+ # After applying the above patch, the build continues but fails with
+ # head64.c:(.text.exit+0x5): undefined reference to `__gcov_exit'
+ #
+ scripts/config --disable CONFIG_GCOV_KERNEL
+ fi
+
+ if { vergte "${kversion}" "4.5"; } && { verlt "${kversion}" "4.5.5"; } ; then
+ # drivers/staging/wilc1000/wilc_spi.c:123:34: error: storage size of ‘wilc1000_spi_ops’ isn’t known
+ patch_linux_kernel ce7b516f3f9e11fe4ee06fad0d7e853bb6e8f160
+ fi