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