[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
untangling the compat mess
After investigating a dependency issue that got me highly confused the other
day, I've ended up with an implementation that partly untangles the compat
mess. The result is not excellent, but it already improves the situation.
Currently, the common compat functions located in compat/common/* are built
as part of libcompat. (Don't get confused, there are actually two libcompat,
and I'm only talking about the kernel one.) These functions are used by
several compat options like compat_linux. libcompat being a library, each
function present in it that is not used is removed at link time.
The problem, is that while a function may not be used at link time, it can be
at run time if a kernel module is loaded from the filesystem later on. Because
of this problem, it is not possible to modload compat_linux.kmod if we don't
enable a wide range of other compat options like COMPAT_43. If we take
COMPAT_43 as example:
(*) If it is not enabled in the kernel, several compat_43_* functions are
removed. Later on, modload will fail to load compat_linux.kmod, since it needs
(*) If it is enabled in the kernel, then there happen to be places where the
functions are used, and this causes them not to be removed. Later on, modload
will succeed since the functions are here.
To fix this problem, we need to make sure that the common compat functions are
built in the kernel, whether or not they are used at link time. This implies
not building them as part of libcompat, but as a regular option.
I ended up with this implementation . libcompat is dropped, and instead the
common functions are compiled iff COMPAT_NETBSD is set. Due to the fact that
the kernel actually needs some of the common functions by default,
COMPAT_NETBSD is set by default.
Unfortunately, it is now not possible to modload compat.kmod and
compat_sysv_ipc.kmod, because the functions they contain are compiled by
default and collide. I think the compat half of sysv_ipc should be merged into
compat.kmod, which itself should then be revisited.
The result is:
(*) COMPAT_NETBSD controls whether the functions are compiled.
(*) COMPAT_43/COMPAT_09/.../COMPAT_70 control whether the functions are
referenced dynamically (added in the syscall array for example).
As opposed to the current implementation, where COMPAT_43/etc implicitly
control both the availability and the reference.
With this change, it is now possible to modload compat_linux.kmod without
enabling any compat option (except COMPAT_NETBSD, which is enabled by default
in std). Even though it is not perfect, it already untangles the compat mess
After this change several dependencies can be fixed, for example COMPAT_LINUX
that wrongly depends on COMPAT_16.
Main Index |
Thread Index |