On Fri, Apr 24, 2026 at 12:21 PM Arnd Bergmann <[email protected]> wrote: > > How hard would it be to have a private copy of the parts of the core > crate that the kernel actually needs? Since Linux is neither quite > hosted (using a full libc) nor entirely freestanding (still using > some library interfaces), the C implementation on most architectures > has a small subset of the libgcc that we ship with the kernel. > > I assume the core crate is larger than libgcc, but I don't know how > much of it is actually needed here.
It is fairly tied to the compiler version, so it would be a substantial effort to support across a bunch of versions. Instead of that, initially we asked to have some `cfg`s (i.e. conditional compilation) to customize it in the few places we need. We already pass `--cfg no_fp_fmt_parse` for instance. There were concerns about combinatorial explosion of `cfg`s, so we suggested `cfg(linux_kernel)` or similar instead, though nothing happened so far. The other option is to at least lint against certain operations, but I think it would be better to have a way to tell the compiler we really don't want them generated to begin with. Cheers, Miguel
