Subject: Re: ELF binary recognition
To: =?ISO-8859-1?Q?Jarom=EDr_Dolecek?= <email@example.com>
From: Emmanuel Dreyfus <firstname.lastname@example.org>
Date: 06/02/2001 15:45:53
> Binaries are explicitly identified as NetBSD/ELF, and if it's so,
> they are run under NetBSD "emulation" explicitly (see kern/exec_conf.c).
> It's just that the current behaviour is to run ELF binaries which
> are not recognized to be of any particular OS under NetBSD emulation.
> My understanding is this behaviour matches what other OSes do.
I assume that ldconfig is a static binary, forget about this post if it
is not the case.
I encountered problems with Linux emulation on PowerPC because static
binaries were not matched correctly. I never understood why NetBSD/i386
was able to match them whereas NetBSD/PowerPC was unable to do it with
the same code. This PR suggests that NetBSD/i386 is sometimes (always?)
unable to match static ELF binaries too. Because there are not a lot of
static binaries on a Linux system, this might have staid unoticed for a
To workaround the problem, I added an extra test that match static Linux
binaries. It is located in sys/compat/linux/common/linux_exec_elf32.c,
and is enabled with the LINUX_ATEXIT_SIGNATURE macro. It is fully
documented in the paper I published on Linux emulation implementation,
This new test has not been tested on non PowerPC ports, so it's only
enabled for PowerPC yet. There is no reason why it shouldn't work for
i386, alpha and m64k, therfore I suggest to just add
* LINUX_ATEXIT_SIGNATURE enable the atexit_signature test. See
#define LINUX_ATEXIT_SIGNATURE 1
to sys/compat/linux/arch/i386/linux_exec.h. It might be enough to fix
the problem. If it does, then it might be usefull to pull-up the file