How to implement a kernel feature check in the crt* files?
Jakub Jelinek
jakub@redhat.com
Thu Jan 7 12:16:00 GMT 2010
On Thu, Jan 07, 2010 at 12:59:40PM +0100, Andreas Krebbel wrote:
> I'm looking for a way to match a kernel capability against a
> requirement of an ELF binary in order to prevent the binary from being
> executed in case the kernel doesn't support it.
I'd prefer e_flags bit. No idea why you want to implement this in crt1.o,
I'd just do this in elf_machine_matches_host and in kernel's ELF loader.
For some examples see e.g. sparc, which doesn't use e_flags bit, but
has a special EM_ code EM_SPARC32PLUS.
The advantage of e_flags is that it can be easily merged during linking
from multiple input objects (if any of the input objects has the bit set,
set it in the output), and can be cheaply tested by the kernel.
Jakub
More information about the Libc-help
mailing list