4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
26 * Update the symbol table entries:
28 * o If addr is non-zero then every symbol entry is updated to indicate the
29 * new location to which the object will be mapped.
31 * o The address of the `_edata' and `_end' symbols, and their associated
32 * section, is updated to reflect any new heap addition.
34 #pragma ident "%Z%%M% %I% %E% SMI"
44 update_sym(Cache
*cache
, Cache
*_cache
, Addr edata
, Half endx
, Addr addr
)
52 * Set up to read the symbol table and its associated string table.
54 shdr
= _cache
->c_shdr
;
55 syms
= (Sym
*)_cache
->c_data
->d_buf
;
56 symn
= shdr
->sh_size
/ shdr
->sh_entsize
;
58 strs
= (char *)cache
[shdr
->sh_link
].c_data
->d_buf
;
61 * Loop through the symbol table looking for `_end' and `_edata'.
63 for (cnt
= 0; cnt
< symn
; cnt
++, syms
++) {
64 char *name
= strs
+ syms
->st_name
;
68 syms
->st_value
+= addr
;
71 if ((name
[0] != '_') || (name
[1] != 'e'))
73 if (strcmp(name
, MSG_ORIG(MSG_SYM_END
)) &&
74 strcmp(name
, MSG_ORIG(MSG_SYM_EDATA
)))
77 syms
->st_value
= edata
+ addr
;
79 syms
->st_shndx
= endx
;
84 syminfo(Cache
*_cache
, Alist
**nodirect
)
90 shdr
= _cache
->c_shdr
;
91 info
= (Syminfo
*)_cache
->c_data
->d_buf
;
92 num
= (Word
)(shdr
->sh_size
/ shdr
->sh_entsize
);
95 * Traverse the syminfo section recording the index of all nodirect
98 for (ndx
= 1, info
++; ndx
< num
; ndx
++, info
++) {
99 if ((info
->si_flags
& SYMINFO_FLG_NOEXTDIRECT
) == 0)
102 if (alist_append(nodirect
, &ndx
, sizeof (Word
), 20) == 0)