xref: /titanic_44/usr/src/uts/sparc/krtld/kobj_convrelstr.c (revision c138f478d2bc94e73ab8f6a084e323bec25e62f5)
1 /*
2  * CDDL HEADER START
3  *
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
7  * with the License.
8  *
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.
13  *
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]
19  *
20  * CDDL HEADER END
21  */
22 
23 /*
24  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
25  * Use is subject to license terms.
26  */
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 #include	<sys/types.h>
30 #include	"reloc.h"
31 
32 static const char	*rels[R_SPARC_NUM] = {
33 	"R_SPARC_NONE",			"R_SPARC_8",
34 	"R_SPARC_16",			"R_SPARC_32",
35 	"R_SPARC_DISP8",		"R_SPARC_DISP16",
36 	"R_SPARC_DISP32",		"R_SPARC_WDISP30",
37 	"R_SPARC_WDISP22",		"R_SPARC_HI22",
38 	"R_SPARC_22",			"R_SPARC_13",
39 	"R_SPARC_LO10",			"R_SPARC_GOT10",
40 	"R_SPARC_GOT13",		"R_SPARC_GOT22",
41 	"R_SPARC_PC10",			"R_SPARC_PC22",
42 	"R_SPARC_WPLT30",		"R_SPARC_COPY",
43 	"R_SPARC_GLOB_DAT",		"R_SPARC_JMP_SLOT",
44 	"R_SPARC_RELATIVE",		"R_SPARC_UA32",
45 	"R_SPARC_PLT32",		"R_SPARC_HIPLT22",
46 	"R_SPARC_LOPLT10",		"R_SPARC_PCPLT32",
47 	"R_SPARC_PCPLT22",		"R_SPARC_PCPLT10",
48 	"R_SPARC_10",			"R_SPARC_11",
49 	"R_SPARC_64",			"R_SPARC_OLO10",
50 	"R_SPARC_HH22",			"R_SPARC_HM10",
51 	"R_SPARC_LM22",			"R_SPARC_PC_HH22",
52 	"R_SPARC_PC_HM10",		"R_SPARC_PC_LM22",
53 	"R_SPARC_WDISP16",		"R_SPARC_WDISP19",
54 	"R_SPARC_GLOB_JMP",		"R_SPARC_7",
55 	"R_SPARC_5",			"R_SPARC_6",
56 	"R_SPARC_DISP64",		"R_SPARC_PLT64",
57 	"R_SPARC_HIX22",		"R_SPARC_LOX10",
58 	"R_SPARC_H44",			"R_SPARC_M44",
59 	"R_SPARC_L44",			"R_SPARC_REGISTER",
60 	"R_SPARC_UA64",			"R_SPARC_UA16",
61 	"R_SPARC_TLS_GD_HI22",		"R_SPARC_TLS_GD_LO10",
62 	"R_SPARC_TLS_GD_ADD",		"R_SPARC_TLS_GD_CALL",
63 	"R_SPARC_TLS_LDM_HI22",		"R_SPARC_TLS_LDM_LO10",
64 	"R_SPARC_TLS_LDM_ADD",		"R_SPARC_TLS_LDM_CALL",
65 	"R_SPARC_TLS_LDO_HIX22",	"R_SPARC_TLS_LDO_LOX10",
66 	"R_SPARC_TLS_LDO_ADD",		"R_SPARC_TLS_IE_HI22",
67 	"R_SPARC_TLS_IE_LO10",		"R_SPARC_TLS_IE_LD",
68 	"R_SPARC_TLS_IE_LDX",		"R_SPARC_TLS_IE_ADD",
69 	"R_SPARC_TLS_LE_HIX22",		"R_SPARC_TLS_LE_LOX10",
70 	"R_SPARC_TLS_DTPMOD32",		"R_SPARC_TLS_DTPMOD64",
71 	"R_SPARC_TLS_DTPOFF32",		"R_SPARC_TLS_DTPOFF64",
72 	"R_SPARC_TLS_TPOFF32",		"R_SPARC_TLS_TPOFF64",
73 	"R_SPARC_GOTDATA_HIX22",	"R_SPARC_GOTDATA_LOX10",
74 	"R_SPARC_GOTDATA_OP_HIX22",	"R_SPARC_GOTDATA_OP_LOX10",
75 	"R_SPARC_GOTDATA_OP",		"R_SPARC_H34"
76 };
77 
78 #if	(R_SPARC_NUM != (R_SPARC_H34 + 1))
79 #error	"R_SPARC_NUM has grown"
80 #endif
81 
82 /*
83  * This is a 'stub' of the orignal version defined in liblddbg.so.  This stub
84  * returns the 'int string' of the relocation in question instead of converting
85  * the relocation to it's full syntax.
86  */
87 const char *
88 conv_reloc_SPARC_type_str(uint_t type)
89 {
90 	static char 	strbuf[32];
91 	int		ndx = 31;
92 
93 	if (type < R_SPARC_NUM)
94 		return (rels[type]);
95 
96 	strbuf[ndx--] = '\0';
97 	do {
98 		strbuf[ndx--] = '0' + (type % 10);
99 		type = type / 10;
100 	} while ((ndx >= (int)0) && (type > (Word)0));
101 
102 	return (&strbuf[ndx + 1]);
103 }
104