On Mon, Feb 11, 2002 at 06:34:14AM +0000, Tony Finch wrote: > In article <[EMAIL PROTECTED]> you write: > > > >I need to look into it a bit more, and figure out exactly what FreeBSD does > >and doesn't do with this. > > Everything you need to know is in /usr/src/sys/kern/imgact_elf.c: > > /* We support three types of branding -- (1) the ELF EI_OSABI field > * that SCO added to the ELF spec, (2) FreeBSD 3.x's traditional string > * branding w/in the ELF header, and (3) path of the `interp_path' > * field. We should also look for an ".note.ABI-tag" ELF section now > * in all Linux ELF binaries, FreeBSD 4.1+, and some NetBSD ones. > */ > > There's a table of the supported ABIs which is scanned when executing an > ELF binary. On the first scan an ABI is found if either the OSABI field > matches (number 1 above) or if the second eight bytes of the ELF header > match (which used to be "FreeBSD" instead of nulls as is usual) (number > 2 above). On the second scan an ABI is found if the file's .interp > section matches (number 3 above).
To work correctly with a normal gcc (not hacked like the one in the FreeBSD sources), it needs to do the .note.ABI-tag check. #3 doesn't work for static binaries because they don't have an interpreter, which would be why my test box didn't boot the first time I tried it. I guess I'll have to see about coding support for .note.ABI-tag sometime. Think they'd accept a patch for that?