Subject: Re: ELF binary recognition
To: None <tech-kern@netbsd.org>
From: Jaromír <jdolecek@netbsd.org>
List: tech-kern
Date: 06/17/2001 23:08:17
While the 'catch all' ELF execsw[] entry might be optional on sysctl
and this would please all, I'd rather see it as a compile time
option only to avoid unnecessary bloat. This is probably something very
few people would actually _want_.

This change makes the catchall entry available only if option
EXEC_ELF_CATCHALL is defined (which it's not by default, of course).
Any problem with getting this into tree? The ELF32 case is tested
and no ill effects were seen so far.

Index: kern/exec_conf.c
===================================================================
RCS file: /cvsroot/syssrc/sys/kern/exec_conf.c,v
retrieving revision 1.56
diff -u -p -r1.56 exec_conf.c
--- kern/exec_conf.c	2001/05/15 02:00:12	1.56
+++ kern/exec_conf.c	2001/06/17 20:42:20
@@ -246,10 +246,12 @@ const struct execsw execsw_builtin[] = {
 	  IBCS2_ELF_AUX_ARGSIZ, elf32_copyargs, setregs },
 				/* SCO 32bit ELF bins (not 64bit safe) */
 #endif
+#ifdef EXEC_ELF_CATCHALL
 	{ sizeof (Elf32_Ehdr), exec_elf32_makecmds, { NULL },
-	  &emul_netbsd, EXECSW_PRIO_LAST,	/* catch all entry */
+	  &emul_netbsd, EXECSW_PRIO_LAST,
 	  howmany(ELF_AUX_ENTRIES * sizeof(Aux32Info), sizeof (Elf32_Addr)),
-	  elf32_copyargs, setregs },	/* NetBSD 32bit ELF bins */
+	  elf32_copyargs, setregs },  /* catch all - run as NetBSD 32bit ELF */
+#endif
 #endif /* EXEC_ELF32 */
 #ifdef EXEC_ELF64
 	/* 64bit ELF bins */
@@ -272,10 +274,12 @@ const struct execsw execsw_builtin[] = {
 	  SVR4_AUX_ARGSIZ64,
 	  svr4_copyargs64, svr4_setregs },	/* SVR4 64bit ELF bins (not 64bit safe) */
 #endif
+#ifdef EXEC_ELF_CATCHALL
 	{ sizeof (Elf64_Ehdr), exec_elf64_makecmds, { NULL },
 	  &emul_netbsd, EXECSW_PRIO_ANY,
 	  howmany(ELF_AUX_ENTRIES * sizeof(Aux64Info), sizeof (Elf64_Addr)),
-	  elf64_copyargs, setregs }, /* NetBSD 64bit ELF bins */
+	  elf64_copyargs, setregs }, /* catch all - run as NetBSD 64bit ELF */
+#endif
 #endif /* EXEC_ELF64 */
 #ifdef COMPAT_SUNOS
 #ifdef COMPAT_NETBSD32
Index: conf/files
===================================================================
RCS file: /cvsroot/syssrc/sys/conf/files,v
retrieving revision 1.447
diff -u -p -r1.447 files
--- conf/files	2001/06/16 12:00:03	1.447
+++ conf/files	2001/06/17 20:42:20
@@ -34,7 +34,7 @@ defopt	opt_poollog.h	POOL_LOGSIZE
 
 defopt	opt_revcache.h	NAMECACHE_ENTER_REVERSE
 
-defopt	opt_execfmt.h	EXEC_AOUT EXEC_COFF EXEC_ECOFF EXEC_ELF32 EXEC_ELF64 EXEC_SCRIPT
+defopt	opt_execfmt.h	EXEC_AOUT EXEC_COFF EXEC_ECOFF EXEC_ELF32 EXEC_ELF64 EXEC_SCRIPT EXEC_ELF_CATCHALL
 
 # compatibility options
 defopt	COMPAT_FREEBSD

Jaromir
-- 
Jaromir Dolecek <jdolecek@NetBSD.org>      http://www.ics.muni.cz/~dolecek/
NetBSD - just plain best OS! -=*=- Got spare MCA cards or docs? Hand me them!