Ejemplo n.º 1
0
static void
link_elf_obj_init(void *arg)
{
#if ELF_TARG_CLASS == ELFCLASS32
	linker_add_class("elf32", NULL, &link_elf_obj_class_ops);
#else
	linker_add_class("elf64", NULL, &link_elf_obj_class_ops);
#endif
}
Ejemplo n.º 2
0
static void
link_elf_init(void* arg)
{
    Elf_Dyn	*dp;
    caddr_t	modptr, baseptr, sizeptr;
    elf_file_t	ef;
    char	*modname;

#if ELF_TARG_CLASS == ELFCLASS32
    linker_add_class("elf32", NULL, &link_elf_class_ops);
#else
    linker_add_class("elf64", NULL, &link_elf_class_ops);
#endif

    dp = (Elf_Dyn*) &_DYNAMIC;
    if (dp) {
	ef = kmalloc(sizeof(struct elf_file), M_LINKER, M_INTWAIT | M_ZERO);
	ef->address = NULL;
#ifdef SPARSE_MAPPING
	ef->object = NULL;
#endif
	ef->dynamic = dp;
	modname = NULL;
	modptr = preload_search_by_type("elf kernel");
	if (modptr)
	    modname = (char *)preload_search_info(modptr, MODINFO_NAME);
	if (modname == NULL)
	    modname = "kernel";
	linker_kernel_file = linker_make_file(modname, ef, &link_elf_file_ops);
	if (linker_kernel_file == NULL)
	    panic("link_elf_init: Can't create linker structures for kernel");
	parse_dynamic(linker_kernel_file);
#if defined(__amd64__) && defined(_KERNEL_VIRTUAL)
	fprintf(stderr, "WARNING: KERNBASE being used\n");
#endif
	linker_kernel_file->address = (caddr_t) KERNBASE;
	linker_kernel_file->size = -(intptr_t)linker_kernel_file->address;

	if (modptr) {
	    ef->modptr = modptr;
	    baseptr = preload_search_info(modptr, MODINFO_ADDR);
	    if (baseptr)
		linker_kernel_file->address = *(caddr_t *)baseptr;
	    sizeptr = preload_search_info(modptr, MODINFO_SIZE);
	    if (sizeptr)
		linker_kernel_file->size = *(size_t *)sizeptr;
	}
	parse_module_symbols(linker_kernel_file);
	linker_current_file = linker_kernel_file;
	linker_kernel_file->flags |= LINKER_FILE_LINKED;
    }
}
Ejemplo n.º 3
0
static void
link_elf_init(void *arg)
{

	linker_add_class(&link_elf_class);
}