xref: /onnv-gate/usr/src/cmd/sgs/libconv/common/symbols_machelf.c (revision 9273:9a0603d78ad3)
1*9273SAli.Bahrami@Sun.COM /*
2*9273SAli.Bahrami@Sun.COM  * CDDL HEADER START
3*9273SAli.Bahrami@Sun.COM  *
4*9273SAli.Bahrami@Sun.COM  * The contents of this file are subject to the terms of the
5*9273SAli.Bahrami@Sun.COM  * Common Development and Distribution License (the "License").
6*9273SAli.Bahrami@Sun.COM  * You may not use this file except in compliance with the License.
7*9273SAli.Bahrami@Sun.COM  *
8*9273SAli.Bahrami@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*9273SAli.Bahrami@Sun.COM  * or http://www.opensolaris.org/os/licensing.
10*9273SAli.Bahrami@Sun.COM  * See the License for the specific language governing permissions
11*9273SAli.Bahrami@Sun.COM  * and limitations under the License.
12*9273SAli.Bahrami@Sun.COM  *
13*9273SAli.Bahrami@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
14*9273SAli.Bahrami@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*9273SAli.Bahrami@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
16*9273SAli.Bahrami@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
17*9273SAli.Bahrami@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
18*9273SAli.Bahrami@Sun.COM  *
19*9273SAli.Bahrami@Sun.COM  * CDDL HEADER END
20*9273SAli.Bahrami@Sun.COM  */
21*9273SAli.Bahrami@Sun.COM 
22*9273SAli.Bahrami@Sun.COM /*
23*9273SAli.Bahrami@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24*9273SAli.Bahrami@Sun.COM  * Use is subject to license terms.
25*9273SAli.Bahrami@Sun.COM  */
26*9273SAli.Bahrami@Sun.COM 
27*9273SAli.Bahrami@Sun.COM /*
28*9273SAli.Bahrami@Sun.COM  * String conversion routines for symbol attributes.
29*9273SAli.Bahrami@Sun.COM  */
30*9273SAli.Bahrami@Sun.COM #include	<stdio.h>
31*9273SAli.Bahrami@Sun.COM #include	<_machelf.h>
32*9273SAli.Bahrami@Sun.COM #include	<sys/elf_SPARC.h>
33*9273SAli.Bahrami@Sun.COM #include	<sys/elf_amd64.h>
34*9273SAli.Bahrami@Sun.COM #include	"_conv.h"
35*9273SAli.Bahrami@Sun.COM #include	"symbols_msg.h"
36*9273SAli.Bahrami@Sun.COM 
37*9273SAli.Bahrami@Sun.COM const char *
conv_sym_value(Half mach,uchar_t type,Addr value,Conv_inv_buf_t * inv_buf)38*9273SAli.Bahrami@Sun.COM conv_sym_value(Half mach, uchar_t type, Addr value, Conv_inv_buf_t *inv_buf)
39*9273SAli.Bahrami@Sun.COM {
40*9273SAli.Bahrami@Sun.COM 	if (((mach == EM_SPARC) || (mach == EM_SPARC32PLUS) ||
41*9273SAli.Bahrami@Sun.COM 	    (mach == EM_SPARCV9)) && (type == STT_SPARC_REGISTER))
42*9273SAli.Bahrami@Sun.COM 		return (conv_sym_SPARC_value(value, 0, inv_buf));
43*9273SAli.Bahrami@Sun.COM 
44*9273SAli.Bahrami@Sun.COM 	(void) snprintf(inv_buf->buf, sizeof (inv_buf->buf),
45*9273SAli.Bahrami@Sun.COM 	    MSG_ORIG(MSG_SYM_FMT_VAL), EC_ADDR(value));
46*9273SAli.Bahrami@Sun.COM 	return (inv_buf->buf);
47*9273SAli.Bahrami@Sun.COM }
48