Skip to contentSkip to conversation

Skip building vDSO entirely

DISCUSSION Jonathan M. Wilbur 1 participant 1 message Sep 26, 2024

lore
Share & tools
lore
#0 lore raw

Hello,

I am trying to build the Linux kernel with as minimal tooling as possible. To give you an idea, I am writing binaries like "bc" that are hard-coded to do only what their invocation in the Linux kernel build steps require and nothing more, and I plan to do something similar for "ld" in the form of a single-file C program that can perform the absolutely minimal linking needed to build the kernel.

Based on my research, it looks like not a whole lot is actually needed from the linker. I believe a minimal kernel should be able to be built using static linking with few special flags, if any. However, the one big barnacle in all this is that vDSO is a shared library and seems to require a lot of shared-object functionality from ld. If vDSO could be omitted from the build, it would cut down on the code footprint needed to build the Linux kernel significantly. I tried setting CONFIG_VDSO to "n" and CONFIG_HAVE_GENERIC_VDSO to "n" and neither of these resulted in the vDSO shared object's omission from the build. I even ran an "allnoconfig" build of the Linux kernel, and I see that the vDSO shared object is still getting linked. Eventually, I ended up modifying the Makefiles only to find that I got linker errors ("undefined reference").

I wanted to ask (1) if I am doing something wrong and there actually is a way to skip vDSO (on x86 / x86-64), and (2) whether for some technical reason, vDSO absolutely must be built, even if this feature is not made available to userspace.

Thank you in advance,

- Jonathan M. Wilbur