Add an optional hook for adjusting module string table after load.

Currently to be used for rump "SAOS" namespace trick.
This commit is contained in:
pooka 2010-04-26 22:58:53 +00:00
parent 445cf1a49a
commit da792af712
3 changed files with 22 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_stub.c,v 1.26 2010/04/19 18:24:27 dyoung Exp $ */
/* $NetBSD: kern_stub.c,v 1.27 2010/04/26 22:58:53 pooka Exp $ */
/*-
* Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.26 2010/04/19 18:24:27 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.27 2010/04/26 22:58:53 pooka Exp $");
#include "opt_ptrace.h"
#include "opt_ktrace.h"
@ -129,6 +129,8 @@ __weak_alias(bus_space_tag_create, eopnotsupp);
__weak_alias(bus_space_tag_destroy, voidop);
__weak_alias(bus_space_is_equal, default_bus_space_is_equal);
__weak_alias(kobj_renamespace, nullop);
#if !defined(KERN_SA)
/*
* Scheduler activations system calls. These need to remain, even when

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr_kobj.c,v 1.40 2009/11/27 17:54:11 pooka Exp $ */
/* $NetBSD: subr_kobj.c,v 1.41 2010/04/26 22:58:53 pooka Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -63,7 +63,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: subr_kobj.c,v 1.40 2009/11/27 17:54:11 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: subr_kobj.c,v 1.41 2010/04/26 22:58:53 pooka Exp $");
#include "opt_modular.h"
@ -336,6 +336,15 @@ kobj_load(kobj_t ko)
goto out;
}
/*
* Adjust module symbol namespace, if necessary (e.g. with rump)
*/
error = kobj_renamespace(ko->ko_symtab, ko->ko_symcnt,
&ko->ko_strtab, &ko->ko_strtabsz);
if (error != 0) {
goto out;
}
/*
* Do we have a string table for the section names?
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: kobj.h,v 1.13 2010/01/19 22:17:45 pooka Exp $ */
/* $NetBSD: kobj.h,v 1.14 2010/04/26 22:58:53 pooka Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -29,6 +29,9 @@
#ifndef _SYS_KOBJ_H_
#define _SYS_KOBJ_H_
#define ELFSIZE ARCH_ELFSIZE
#include <sys/exec_elf.h>
typedef struct kobj *kobj_t;
/* External interface. */
@ -44,4 +47,7 @@ uintptr_t kobj_sym_lookup(kobj_t, uintptr_t);
int kobj_reloc(kobj_t, uintptr_t, const void *, bool, bool);
int kobj_machdep(kobj_t, void *, size_t, bool);
/* implementation interface. */
int kobj_renamespace(Elf_Sym *, size_t, char **, size_t *);
#endif /* !_SYS_KOBJ_H_ */