This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to implement a kernel feature check in the crt* files?


Hi Jakub,

Jakub Jelinek wrote:
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.

The check will only ever trigger when running a binary requiring the kernel feature on an older kernel not providing it. And an older kernel would then also not have the check. So as I understand it the binary itself already has to come with the check otherwise there is no way to do it.


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.

Yes the e_flags mechanism would be very easy to implement. I've an experimental binutils patch for that with less than 100 lines.


Bye,

-Andreas-


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]