The handle for the kernel is common. With this fix, ELF kernels can load

a.out kld modules, and a.out kernels can load ELF kld modules.
This commit is contained in:
Peter Wemm 1998-11-04 15:20:58 +00:00
parent 0ce10add93
commit 84e40f5627
5 changed files with 23 additions and 34 deletions

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: kern_linker.c,v 1.12 1998/11/03 13:09:31 peter Exp $
* $Id: kern_linker.c,v 1.13 1998/11/03 14:27:05 peter Exp $
*/
#include "opt_ddb.h"
@ -49,6 +49,7 @@
MALLOC_DEFINE(M_LINKER, "kld", "kernel linker");
linker_file_t linker_current_file;
linker_file_t linker_kernel_file;
static struct lock lock; /* lock for the file list */
static linker_class_list_t classes;

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: link_aout.c,v 1.15 1998/10/25 17:44:51 phk Exp $
* $Id: link_aout.c,v 1.16 1998/11/03 14:25:21 peter Exp $
*/
#ifndef __alpha__
@ -55,13 +55,6 @@ static int link_aout_search_symbol(linker_file_t lf, caddr_t value,
static void link_aout_unload_file(linker_file_t);
static void link_aout_unload_module(linker_file_t);
/*
* The file representing the currently running kernel. This contains
* the global symbol table.
*/
static linker_file_t linker_kernel_file;
static struct linker_class_ops link_aout_class_ops = {
link_aout_load_module,
};
@ -308,8 +301,10 @@ load_dependancies(linker_file_t lf)
/*
* All files are dependant on /kernel.
*/
linker_kernel_file->refs++;
linker_file_add_dependancy(lf, linker_kernel_file);
if (linker_kernel_file) {
linker_kernel_file->refs++;
linker_file_add_dependancy(lf, linker_kernel_file);
}
off = LD_NEED(af->dynamic);

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: link_elf.c,v 1.7 1998/10/16 03:55:00 peter Exp $
* $Id: link_elf.c,v 1.8 1998/10/25 17:44:51 phk Exp $
*/
#include <sys/param.h>
@ -58,13 +58,6 @@ static int link_elf_search_symbol(linker_file_t, caddr_t value,
static void link_elf_unload_file(linker_file_t);
static void link_elf_unload_module(linker_file_t);
/*
* The file representing the currently running kernel. This contains
* the global symbol table.
*/
linker_file_t linker_kernel_file;
static struct linker_class_ops link_elf_class_ops = {
link_elf_load_module,
};
@ -738,10 +731,11 @@ load_dependancies(linker_file_t lf)
/*
* All files are dependant on /kernel.
*/
linker_kernel_file->refs++;
linker_file_add_dependancy(lf, linker_kernel_file);
if (linker_kernel_file) {
linker_kernel_file->refs++;
linker_file_add_dependancy(lf, linker_kernel_file);
}
for (dp = ef->dynamic; dp->d_tag != DT_NULL; dp++) {
if (dp->d_tag == DT_NEEDED) {
name = ef->strtab + dp->d_un.d_val;

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: link_elf.c,v 1.7 1998/10/16 03:55:00 peter Exp $
* $Id: link_elf.c,v 1.8 1998/10/25 17:44:51 phk Exp $
*/
#include <sys/param.h>
@ -58,13 +58,6 @@ static int link_elf_search_symbol(linker_file_t, caddr_t value,
static void link_elf_unload_file(linker_file_t);
static void link_elf_unload_module(linker_file_t);
/*
* The file representing the currently running kernel. This contains
* the global symbol table.
*/
linker_file_t linker_kernel_file;
static struct linker_class_ops link_elf_class_ops = {
link_elf_load_module,
};
@ -738,10 +731,11 @@ load_dependancies(linker_file_t lf)
/*
* All files are dependant on /kernel.
*/
linker_kernel_file->refs++;
linker_file_add_dependancy(lf, linker_kernel_file);
if (linker_kernel_file) {
linker_kernel_file->refs++;
linker_file_add_dependancy(lf, linker_kernel_file);
}
for (dp = ef->dynamic; dp->d_tag != DT_NULL; dp++) {
if (dp->d_tag == DT_NEEDED) {
name = ef->strtab + dp->d_un.d_val;

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: linker.h,v 1.8 1998/10/09 23:07:27 peter Exp $
* $Id: linker.h,v 1.9 1998/10/16 03:55:01 peter Exp $
*/
#ifndef _SYS_LINKER_H_
@ -132,6 +132,11 @@ struct linker_class {
*/
extern linker_file_t linker_current_file;
/*
* The "file" for the kernel.
*/
extern linker_file_t linker_kernel_file;
/*
* Add a new file class to the linker.
*/