4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
22 #pragma ident "%Z%%M% %I% %E% SMI"
25 * Copyright (c) 1987 by Sun Microsystems, Inc.
29 * Link editor public definitions.
36 * Structure describing logical name and requirements on an object
37 * which is to be loaded dynamically.
39 struct old_link_object
{
40 char *lo_name
; /* name of object */
41 int lo_library
: 1, /* searched for by library rules */
43 short lo_major
; /* major version number */
44 short lo_minor
; /* minor version number */
48 long lo_name
; /* name (often relative) */
49 int lo_library
: 1, /* searched for by library rules */
51 short lo_major
; /* major version number */
52 short lo_minor
; /* minor version number */
53 long lo_next
; /* next one (often relative) */
57 * Structure describing name and placement of dynamically loaded
58 * objects in a process' address space.
61 caddr_t lm_addr
; /* address at which object mapped */
62 char *lm_name
; /* full name of loaded object */
63 struct link_map
*lm_next
; /* next object in map */
64 struct link_object
*lm_lop
; /* link object that got us here */
65 caddr_t lm_lob
; /* base address for said link object */
66 int lm_rwt
: 1; /* text is read/write */
67 struct link_dynamic
*lm_ld
; /* dynamic structure */
68 caddr_t lm_lpd
; /* loader private data */
72 * Version 1 of dynamic linking information. With the exception of
73 * ld_loaded (determined at execution time) and ld_stab_hash (a special
74 * case of relocation handled at execution time), the values in this
75 * structure reflect offsets from the containing link_dynamic structure.
77 struct link_dynamic_1
{
78 struct link_map
*ld_loaded
; /* list of loaded objects */
79 long ld_need
; /* list of needed objects */
80 long ld_rules
; /* search rules for library objects */
81 long ld_got
; /* global offset table */
82 long ld_plt
; /* procedure linkage table */
83 long ld_rel
; /* relocation table */
84 long ld_hash
; /* symbol hash table */
85 long ld_stab
; /* symbol table itself */
86 long (*ld_stab_hash
)(); /* "pointer" to symbol hash function */
87 long ld_buckets
; /* number of hash buckets */
88 long ld_symbols
; /* symbol strings */
89 long ld_symb_size
; /* size of symbol strings */
90 long ld_text
; /* size of text area */
93 struct link_dynamic_2
{
94 struct link_map
*ld_loaded
; /* list of loaded objects */
95 long ld_need
; /* list of needed objects */
96 long ld_rules
; /* search rules for library objects */
97 long ld_got
; /* global offset table */
98 long ld_plt
; /* procedure linkage table */
99 long ld_rel
; /* relocation table */
100 long ld_hash
; /* symbol hash table */
101 long ld_stab
; /* symbol table itself */
102 long (*ld_stab_hash
)(); /* "pointer" to symbol hash function */
103 long ld_buckets
; /* number of hash buckets */
104 long ld_symbols
; /* symbol strings */
105 long ld_symb_size
; /* size of symbol strings */
106 long ld_text
; /* size of text area */
107 long ld_plt_sz
; /* size of procedure linkage table */
111 * Structure pointing to run time allocated common symbols and
115 struct nlist
*rtc_sp
; /* symbol for common */
116 struct rtc_symb
*rtc_next
; /* next common */
120 * Debugger interface structure.
123 int ldd_version
; /* version # of interface */
124 int ldd_in_debugger
; /* a debugger is running us */
125 int ldd_sym_loaded
; /* we loaded some symbols */
126 char *ldd_bp_addr
; /* place for ld-generated bpt */
127 int ldd_bp_inst
; /* instruction which was there */
128 struct rtc_symb
*ldd_cp
; /* commons we built */
132 * Structure associated with each object which may be or which requires
133 * execution-time link editing. Used by the run-time linkage editor to
134 * identify needed objects and symbol definitions and references.
136 struct old_link_dynamic
{
137 int ld_version
; /* version # of this structure */
139 struct link_dynamic_1 ld_1
;
146 struct rtc_symb
*cp
; /* pointer to an array of runtime */
147 /* allocated common symbols. */
150 struct link_dynamic
{
151 int ld_version
; /* version # of this structure */
152 struct ld_debug
*ldd
;
154 struct link_dynamic_1
*ld_1
;
155 struct link_dynamic_2
*ld_2
;
159 #define v2 ld_un.ld_2
160 #define v1 ld_un.ld_1
163 * get size of relocations
165 #define GETGOTSZ(x) (x->ld_version < 2 ? ((struct old_link_dynamic *) x)->v1.ld_plt - ((struct old_link_dynamic *) x)->v1.ld_got : (x)->v2->ld_plt - (x)->v2->ld_got)
167 #define GETPLTSZ(x) (x->ld_version < 2 ? ((struct old_link_dynamic *) x)->v1.ld_rel - ((struct old_link_dynamic *) x)->v1.ld_plt : (x)->v2->ld_rel - (x)->v2->ld_plt)
169 #define GETRELSZ(x) (x->ld_version < 2 ? ((struct old_link_dynamic *) x)->v1.ld_hash - ((struct old_link_dynamic *) x)->v1.ld_rel : (x)->v2->ld_hash - (x)->v2->ld_rel)
171 #define GETHASHSZ(x) (x->ld_version < 2 ? ((struct old_link_dynamic *) x)->v1.ld_stab - ((struct old_link_dynamic *) x)->v1.ld_hash : (x)->v2->ld_stab - (x)->v2->ld_hash)
173 #define GETSTABSZ(x) (x->ld_version < 2 ? ((struct old_link_dynamic *) x)->v1.ld_symbols - ((struct old_link_dynamic *) x)->v1.ld_stab : (x)->v2->ld_symbols - (x)->v2->ld_stab)