From 3f1b4f1759240edff0a7097d224d7564e1ef5bbb Mon Sep 17 00:00:00 2001 From: ad Date: Fri, 2 May 2008 13:00:01 +0000 Subject: [PATCH] Keep the program table and section strings around after loading the object, since module_find_section() needs them. --- sys/kern/subr_kobj.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/sys/kern/subr_kobj.c b/sys/kern/subr_kobj.c index fd685b578f6c..53de391c63bd 100644 --- a/sys/kern/subr_kobj.c +++ b/sys/kern/subr_kobj.c @@ -1,4 +1,4 @@ -/* $NetBSD: subr_kobj.c,v 1.13 2008/05/01 17:07:10 ad Exp $ */ +/* $NetBSD: subr_kobj.c,v 1.14 2008/05/02 13:00:01 ad Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ #include "opt_modular.h" #include -__KERNEL_RCSID(0, "$NetBSD: subr_kobj.c,v 1.13 2008/05/01 17:07:10 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_kobj.c,v 1.14 2008/05/02 13:00:01 ad Exp $"); #define ELFSIZE ARCH_ELFSIZE @@ -255,17 +255,6 @@ kobj_close(kobj_t ko) ko->ko_source = NULL; - /* Program table and section strings are no longer needed. */ - if (ko->ko_progtab != NULL) { - kobj_free(ko, ko->ko_progtab, ko->ko_nprogtab * - sizeof(*ko->ko_progtab)); - ko->ko_progtab = NULL; - } - if (ko->ko_shstrtab) { - kobj_free(ko, ko->ko_shstrtab, ko->ko_shstrtabsz); - ko->ko_shstrtab = NULL; - } - /* If the object hasn't been loaded, then destroy it. */ if (!ko->ko_loaded) { kobj_unload(ko); @@ -688,6 +677,15 @@ kobj_unload(kobj_t ko) if (ko->ko_strtab != NULL) { kobj_free(ko, ko->ko_strtab, ko->ko_strtabsz); } + if (ko->ko_progtab != NULL) { + kobj_free(ko, ko->ko_progtab, ko->ko_nprogtab * + sizeof(*ko->ko_progtab)); + ko->ko_progtab = NULL; + } + if (ko->ko_shstrtab) { + kobj_free(ko, ko->ko_shstrtab, ko->ko_shstrtabsz); + ko->ko_shstrtab = NULL; + } /* * Notify MD code that a module has been unloaded.