link_elf.c (f5ef029e9226c3849bdd1100b4ffe4eb60fec3d0) link_elf.c (84e40f5627ce2825f905f40131e31017b458613c)
1/*-
2 * Copyright (c) 1998 Doug Rabson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1998 Doug Rabson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $Id: link_elf.c,v 1.7 1998/10/16 03:55:00 peter Exp $
26 * $Id: link_elf.c,v 1.8 1998/10/25 17:44:51 phk Exp $
27 */
28
29#include <sys/param.h>
30#include <sys/kernel.h>
31#include <sys/systm.h>
32#include <sys/malloc.h>
33#include <sys/proc.h>
34#include <sys/namei.h>

--- 18 unchanged lines hidden (view full) ---

53 linker_sym_t*);
54static int link_elf_symbol_values(linker_file_t, linker_sym_t, linker_symval_t*);
55static int link_elf_search_symbol(linker_file_t, caddr_t value,
56 linker_sym_t* sym, long* diffp);
57
58static void link_elf_unload_file(linker_file_t);
59static void link_elf_unload_module(linker_file_t);
60
27 */
28
29#include <sys/param.h>
30#include <sys/kernel.h>
31#include <sys/systm.h>
32#include <sys/malloc.h>
33#include <sys/proc.h>
34#include <sys/namei.h>

--- 18 unchanged lines hidden (view full) ---

53 linker_sym_t*);
54static int link_elf_symbol_values(linker_file_t, linker_sym_t, linker_symval_t*);
55static int link_elf_search_symbol(linker_file_t, caddr_t value,
56 linker_sym_t* sym, long* diffp);
57
58static void link_elf_unload_file(linker_file_t);
59static void link_elf_unload_module(linker_file_t);
60
61/*
62 * The file representing the currently running kernel. This contains
63 * the global symbol table.
64 */
65
66linker_file_t linker_kernel_file;
67
68static struct linker_class_ops link_elf_class_ops = {
69 link_elf_load_module,
70};
71
72static struct linker_file_ops link_elf_file_ops = {
73 link_elf_lookup_symbol,
74 link_elf_symbol_values,
75 link_elf_search_symbol,

--- 657 unchanged lines hidden (view full) ---

733 linker_file_t lfdep;
734 char* name;
735 const Elf_Dyn *dp;
736 int error = 0;
737
738 /*
739 * All files are dependant on /kernel.
740 */
61static struct linker_class_ops link_elf_class_ops = {
62 link_elf_load_module,
63};
64
65static struct linker_file_ops link_elf_file_ops = {
66 link_elf_lookup_symbol,
67 link_elf_symbol_values,
68 link_elf_search_symbol,

--- 657 unchanged lines hidden (view full) ---

726 linker_file_t lfdep;
727 char* name;
728 const Elf_Dyn *dp;
729 int error = 0;
730
731 /*
732 * All files are dependant on /kernel.
733 */
741 linker_kernel_file->refs++;
742 linker_file_add_dependancy(lf, linker_kernel_file);
734 if (linker_kernel_file) {
735 linker_kernel_file->refs++;
736 linker_file_add_dependancy(lf, linker_kernel_file);
737 }
743
738
744
745 for (dp = ef->dynamic; dp->d_tag != DT_NULL; dp++) {
746 if (dp->d_tag == DT_NEEDED) {
747 name = ef->strtab + dp->d_un.d_val;
748
749 error = linker_load_file(name, &lfdep);
750 if (error)
751 goto out;
752 error = linker_file_add_dependancy(lf, lfdep);

--- 220 unchanged lines hidden ---
739 for (dp = ef->dynamic; dp->d_tag != DT_NULL; dp++) {
740 if (dp->d_tag == DT_NEEDED) {
741 name = ef->strtab + dp->d_un.d_val;
742
743 error = linker_load_file(name, &lfdep);
744 if (error)
745 goto out;
746 error = linker_file_add_dependancy(lf, lfdep);

--- 220 unchanged lines hidden ---