On Tue, Jul 1, 2014 at 9:03 AM, Maxime Villard <m...@m00nbsd.net> wrote: > Hi, > I would like to improve the priorities of the binary loader. When the kernel > loads a binary, it basically loops and calls different loaders (for aout, ELF, > ...). There are several ELF loaders, for native and emulated binaries. This > loop has a particular order: the 32bit compat loaders are called *before* > the native ones. Which means that when you launch a simple 64bit binary on a > 64bit system, the kernel first tries to load it through the netbsd32 and > linux32 > compat loaders. The priority is obviously wrong, the native loaders should be > called first; it also has a non-negligible performance impact when executing > many binaries (when compiling something, for example).
FreeBSD recently ( http://svnweb.freebsd.org/base?view=revision&revision=264269 ) added elf header signature parsing to decide how to execute binaries (based on the Linux binfmt_misc). The main use case is for qemu emulation, but it could also apply to this type of issue. It is obviously a bigger change, but could be worth considering. Justin