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 (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
31 static Elist
*bindto_list
= NULL
;
32 static Elist
*bindfrom_list
= NULL
;
33 static FILE *output
= stdout
;
37 la_version(uint_t version
)
39 if (version
< LAV_CURRENT
) {
40 (void) fprintf(stderr
,
41 "symbindrep.so: unexpected version: %d\n", version
);
45 build_env_list(&bindto_list
, (const char *)"SYMBINDREP_BINDTO");
46 build_env_list(&bindfrom_list
, (const char *)"SYMBINDREP_BINDFROM");
49 (void) fprintf(output
,
50 " Symbol Bindings\n\n"
51 "Referencing Defining\n"
52 "Object Object Symbol\n"
53 "---------------------------------------------------------------"
54 "-------------------\n");
56 (void) fprintf(output
,
57 " Symbol Bindings\n\n"
58 "Referencing Defining\n"
59 "Object Object Symbol\n"
60 "---------------------------------------------------------------"
68 la_objopen(Link_map
*lmp
, Lmid_t lmid
, uintptr_t *cookie
)
72 if ((bindto_list
== NULL
) ||
73 (check_list(bindto_list
, lmp
->l_name
)))
74 flags
= LA_FLG_BINDTO
;
78 if ((bindfrom_list
== NULL
) ||
79 (check_list(bindfrom_list
, lmp
->l_name
)))
80 flags
|= LA_FLG_BINDFROM
;
82 *cookie
= (uintptr_t)lmp
->l_name
;
90 la_symbind64(Elf64_Sym
*symp
, uint_t symndx
, uintptr_t *refcook
,
91 uintptr_t *defcook
, uint_t
*sb_flags
, const char *sym_name
)
94 la_symbind32(Elf32_Sym
*symp
, uint_t symndx
, uintptr_t *refcook
,
95 uintptr_t *defcook
, uint_t
*sb_flags
)
99 const char *sym_name
= (const char *)symp
->st_name
;
102 (void) fprintf(output
, "%-28s %-28s %s\n", (char *)(*refcook
),
103 (char *)(*defcook
), sym_name
);
105 return (symp
->st_value
);
109 * Since we only want to report on the symbol bindings for this
110 * process and we *do not* want the actual program to run we exit
115 la_preinit(uintptr_t *cookie
)
117 (void) fflush(output
);