Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ivan/2ab781098efced0dc725f33c60c6666f to your computer and use it in GitHub Desktop.
NVIDIA DKMS build trying to link nonexistent object files on Linux 4.14.9
@ivan
Copy link
Author

ivan commented Dec 25, 2017

This ridiculous-looking build failure will happen if your kernel packaging does not include objtool. 4.14.9 enabled CONFIG_UNWINDER_ORC by default, replacing CONFIG_UNWINDER_FRAME_POINTER, and the ORC unwinder requires that kernel code include metadata generated by objtool, so out-of-tree module builds now require objtool. When objtool is missing, make can silently assume that it successfully built the .o files, because make is not good.

To go back to the old unwinder that doesn't require objtool:

From be2b9403ca1c04831096b282d2f3b21ceb28ad9a Mon Sep 17 00:00:00 2001
From: Ivan Kozik <ivan@ludios.org>
Date: Sun, 24 Dec 2017 17:51:30 +0000
Subject: [PATCH] Unset CONFIG_UNWINDER_ORC and set
 CONFIG_UNWINDER_FRAME_POINTER=y to avoid requiring header/kbuild packaging to
 include objtool (the lack of which causes make to silently fail to build .o
 files)

---
 arch/x86/Kconfig.debug            | 2 +-
 arch/x86/configs/x86_64_defconfig | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 6293a8768a91..1bb619d19377 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -359,7 +359,7 @@ config PUNIT_ATOM_DEBUG

 choice
        prompt "Choose kernel unwinder"
-       default UNWINDER_ORC if X86_64
+       default UNWINDER_FRAME_POINTER if X86_64
        default UNWINDER_FRAME_POINTER if X86_32
        ---help---
          This determines which method will be used for unwinding kernel stack
diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig
index e32fc1f274d8..fec9ecfbe1d5 100644
--- a/arch/x86/configs/x86_64_defconfig
+++ b/arch/x86/configs/x86_64_defconfig
@@ -299,7 +299,8 @@ CONFIG_DEBUG_STACKOVERFLOW=y
 # CONFIG_DEBUG_RODATA_TEST is not set
 CONFIG_DEBUG_BOOT_PARAMS=y
 CONFIG_OPTIMIZE_INLINING=y
-CONFIG_UNWINDER_ORC=y
+# CONFIG_UNWINDER_ORC is not set
+CONFIG_UNWINDER_FRAME_POINTER=y
 CONFIG_SECURITY=y
 CONFIG_SECURITY_NETWORK=y
 CONFIG_SECURITY_SELINUX=y
--
2.11.0

You're welcome that you didn't have to spend 10 hours figuring this out.

BTW, it will still use CONFIG_UNWINDER_ORC=y if you don't change the default as the patch does (maybe due to Debian packaging?); let me know if you have a better suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment