This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: How to implement a kernel feature check in the crt* files?
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Andreas Krebbel <krebbel at linux dot vnet dot ibm dot com>
- Cc: roland at redhat dot com, libc-help at sourceware dot org, schwidefsky at de dot ibm dot com, uweigand at de dot ibm dot com
- Date: Thu, 7 Jan 2010 07:16:22 -0500
- Subject: Re: How to implement a kernel feature check in the crt* files?
- References: <4B45CCAC.8020703@linux.vnet.ibm.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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