Skip to content

Instantly share code, notes, and snippets.

@bbidulock
Last active March 19, 2020 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bbidulock/263c5c3aee34e3a1b09dca0b937c210b to your computer and use it in GitHub Desktop.
Save bbidulock/263c5c3aee34e3a1b09dca0b937c210b to your computer and use it in GitHub Desktop.
Patch file for compiling older kernels for x86_64.
diff -up linux-4.4/arch/x86/Makefile.orig linux-4.4/arch/x86/Makefile
--- linux-4.4/arch/x86/Makefile.orig 2020-03-19 03:08:53.569999999 -0600
+++ linux-4.4/arch/x86/Makefile 2020-03-19 03:38:57.889999999 -0600
@@ -218,6 +218,14 @@ KBUILD_CFLAGS += -fno-asynchronous-unwin
KBUILD_CFLAGS += $(mflags-y)
KBUILD_AFLAGS += $(mflags-y)
+#
+# Binutils 2.34 cannot handle sysexit, this corrects for now.
+#
+ifdef CONFIG_X86_64
+KBUILD_AFLAGS += -Wa,-mintel64
+KBUILD_CFLAGS += -Wa,-mintel64
+endif
+
# Avoid indirect branches in kernel to deal with Spectre
ifdef CONFIG_RETPOLINE
RETPOLINE_CFLAGS += $(call cc-option,-mindirect-branch=thunk-extern -mindirect-branch-register)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment