xref: /freebsd/sys/kern/linker_if.m (revision 23f282aa31e9b6fceacd449020e936e98d6f2298)
1#
2# Copyright (c) 2000 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#    notice, this list of conditions and the following disclaimer.
10# 2. Redistributions in binary form must reproduce the above copyright
11#    notice, this list of conditions and the following disclaimer in the
12#    documentation and/or other materials provided with the distribution.
13#
14# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
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# $FreeBSD$
27#
28
29#include <sys/linker.h>
30
31INTERFACE linker;
32
33#
34# Lookup a symbol in the file's symbol table.  If the symbol is not
35# found then return ENOENT, otherwise zero.
36#
37METHOD int lookup_symbol {
38    linker_file_t	file;
39    const char*		name;
40    c_linker_sym_t*	symp;
41};
42
43METHOD int symbol_values {
44    linker_file_t	file;
45    c_linker_sym_t	sym;
46    linker_symval_t*	valp;
47};
48
49METHOD int search_symbol {
50    linker_file_t	file;
51    caddr_t		value;
52    c_linker_sym_t*	symp;
53    long*		diffp;
54};
55
56#
57# Unload a file, releasing dependancies and freeing storage.
58#
59METHOD void unload {
60    linker_file_t	file;
61};
62
63#
64# Load a file, returning the new linker_file_t in *result.  If
65# the class does not recognise the file type, zero should be
66# returned, without modifying *result.  If the file is
67# recognised, the file should be loaded, *result set to the new
68# file and zero returned.  If some other error is detected an
69# appropriate errno should be returned.
70#
71STATICMETHOD int load_file {
72    linker_class_t	cls;
73    const char*		filename;
74    linker_file_t*	result;
75};
76STATICMETHOD int link_preload {
77    linker_class_t	cls;
78    const char*		filename;
79    linker_file_t*	result;
80};
81STATICMETHOD int link_preload_finish {
82    linker_file_t	file;
83};
84