Like the title says, external kernel modules like nvidia-drivers or virtualbox-modules fail with cryptic error messages when this package is not installed while the option is set. This doesn't break the kernel build itself, so a careless user might not notice it. Steps to reproduce - build kernel with CONFIG_STACK_VALIDATION=y, without elfutils installed - try building external kernel modules against it - observe failure - install elfutils, rebuild kernel - try again - observe success IMHO it might be worth making a config check and bail out if elfutils are not provided. When building the kernel a warning can be seen "Cannot use CONFIG_STACK_VALIDATION, please install libelf-dev or elfutils-libelf-devel" although it doesn't break the kernel, and can be easily missed on -j4 or higher parallel builds. The kernel error msg also mentions libelf package might be a satisfactory dependency, but i have not tested this.
I have observed with x11-drivers/nvidia-drivers that it doesn't build either way when CONFIG_STACK_VALIDATION is set. Without libelf it tries to invoke the linker before any source files have been compiled: x86_64-pc-linux-gnu-ld: cannot find /var/tmp/portage/x11-drivers/nvidia-drivers-378.13/work/kernel/nvidia/nv-frontend.o: No such file or directory x86_64-pc-linux-gnu-ld: cannot find /var/tmp/portage/x11-drivers/nvidia-drivers-378.13/work/kernel/nvidia/nv-instance.o: No such file or directory x86_64-pc-linux-gnu-ld: cannot find /var/tmp/portage/x11-drivers/nvidia-drivers-378.13/work/kernel/nvidia/nv.o: No such file or directory (...) With libelf it raised a different compile error: error reading elf file /var/tmp/portage/x11-drivers/nvidia-drivers-378.13/work/kernel/nvidia/nv-frontend.o I solved it on my system by disabling the offending kernel config and rerunning make modules_prepare In addition, trying to formulate reproduction steps have lead to the conclusion that the kernel Makefile probably caches more than it should. For the first error this could be enough: uninstall libelf if necessary enable CONFIG_STACK_VALIDATION in /usr/src/linux, run make oldconfig in /usr/src/linux/tools/objtool, run make clean in /usr/src/linux, run make modules_prepare emerge nvidia-drivers the second error then follows: emerge libelf in /usr/src/linux, run make modules_prepare emerge nvidia-drivers I haven't tried installing elfutils as the kernel did not hint at that, and the two packages block each other. kernel version used is 4.9.6-gentoo-r1 nvidia-drivers version used is 378.13 I'd recommend that ebuilds throw an error if libelf is not installed in conjunction with CONFIG_STACK_VALIDATION when it would be expected (suggestion to test for the presence of objtool in the kernel in addition to libelf.so). NVidia drivers not compiling regardless of this might well be a separate issue but at least the error messages can now appear in google and save the next person from a day's worth of frustration ;)
*** Bug 646590 has been marked as a duplicate of this bug. ***
This seems more an external driver issue and not an kernel issue. ionen, you have thoughts concerning nvidia here?
Believe this was already handled by: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f9b2693b32b7c7c7c561ae417cbd757624184327 So I don't think there's anything that needs to be done here, virtual/libelf (and so elfutils) should always be on the system if using kernel sources. (In reply to Marcel Sondaar from comment #1) > I have observed with x11-drivers/nvidia-drivers that it doesn't build either > way when CONFIG_STACK_VALIDATION is set. I can't reproduce this, if anything CONFIG_STACK_VALIDATION is a default option of `make defconfig` (as mentioned in above commit) and nvidia-drivers been building with this for a long time. I think this is just obsolete