Search for "elf32 kernel" (and elf64) and "elf32 module" (and elf64)

as well as "elf kernel" and "elf module".  This is a precursor to
x86-64 support in the i386 loader so it can load an elf64 x86-64 kernel.
This commit is contained in:
Peter Wemm 2003-04-06 05:20:00 +00:00
parent f7e19a98fd
commit 67db8b23c3
2 changed files with 12 additions and 4 deletions

View File

@ -258,7 +258,9 @@ link_elf_init(void* arg)
dp = (Elf_Dyn*) &_DYNAMIC;
modname = NULL;
modptr = preload_search_by_type("elf kernel");
modptr = preload_search_by_type("elf" __XSTRING(__ELF_WORD_SIZE) " kernel");
if (modptr == NULL)
modptr = preload_search_by_type("elf kernel");
if (modptr)
modname = (char *)preload_search_info(modptr, MODINFO_NAME);
if (modname == NULL)
@ -462,7 +464,9 @@ link_elf_link_preload(linker_class_t cls,
baseptr = preload_search_info(modptr, MODINFO_ADDR);
sizeptr = preload_search_info(modptr, MODINFO_SIZE);
dynptr = preload_search_info(modptr, MODINFO_METADATA|MODINFOMD_DYNAMIC);
if (type == NULL || strcmp(type, "elf module") != 0)
if (type == NULL ||
(strcmp(type, "elf" __XSTRING(__ELF_WORD_SIZE) " module") != 0 &&
strcmp(type, "elf module") != 0))
return (EFTYPE);
if (baseptr == NULL || sizeptr == NULL || dynptr == NULL)
return (EINVAL);

View File

@ -258,7 +258,9 @@ link_elf_init(void* arg)
dp = (Elf_Dyn*) &_DYNAMIC;
modname = NULL;
modptr = preload_search_by_type("elf kernel");
modptr = preload_search_by_type("elf" __XSTRING(__ELF_WORD_SIZE) " kernel");
if (modptr == NULL)
modptr = preload_search_by_type("elf kernel");
if (modptr)
modname = (char *)preload_search_info(modptr, MODINFO_NAME);
if (modname == NULL)
@ -462,7 +464,9 @@ link_elf_link_preload(linker_class_t cls,
baseptr = preload_search_info(modptr, MODINFO_ADDR);
sizeptr = preload_search_info(modptr, MODINFO_SIZE);
dynptr = preload_search_info(modptr, MODINFO_METADATA|MODINFOMD_DYNAMIC);
if (type == NULL || strcmp(type, "elf module") != 0)
if (type == NULL ||
(strcmp(type, "elf" __XSTRING(__ELF_WORD_SIZE) " module") != 0 &&
strcmp(type, "elf module") != 0))
return (EFTYPE);
if (baseptr == NULL || sizeptr == NULL || dynptr == NULL)
return (EINVAL);