xref: /titanic_44/usr/src/uts/intel/ia32/krtld/kobj_convrelstr.c (revision 49b225e1cfa7bbf7738d4df0a03f18e3283426eb)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
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.
12  *
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]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 #pragma ident	"%Z%%M%	%I%	%E% SMI"
27 
28 #include	<sys/types.h>
29 #include	"reloc.h"
30 
31 static const char	*rels[R_386_NUM] = {
32 	"R_386_NONE",			"R_386_32",
33 	"R_386_PC32",			"R_386_GOT32",
34 	"R_386_PLT32",			"R_386_COPY",
35 	"R_386_GLOB_DAT",		"R_386_JMP_SLOT",
36 	"R_386_RELATIVE",		"R_386_GOTOFF",
37 	"R_386_GOTPC",			"R_386_32PLT",
38 	"R_386_TLS_GD_PLT",		"R_386_TLS_LDM_PLT",
39 	"R_386_TLS_TPOFF",		"R_386_TLS_IE",
40 	"R_386_TLS_GOTIE",		"R_386_TLS_LE",
41 	"R_386_TLS_GD",			"R_386_TLS_LDM",
42 	"R_386_16",			"R_386_PC16",
43 	"R_386_8",			"R_386_PC8",
44 	"R_386_UNKNOWN24",		"R_386_UNKNOWN25",
45 	"R_386_UNKNOWN26",		"R_386_UNKNOWN27",
46 	"R_386_UNKNOWN28",		"R_386_UNKNOWN29",
47 	"R_386_UNKNOWN30",		"R_386_UNKNOWN31",
48 	"R_386_TLS_LDO_32",		"R_386_UNKNOWN33",
49 	"R_386_UNKNOWN34",		"R_386_TLS_DTPMOD32",
50 	"R_386_TLS_DTPOFF32",		"R_386_UNKNOWN37",
51 	"R_386_SIZE32"
52 };
53 
54 #if	(R_386_NUM != (R_386_SIZE32 + 1))
55 #error	"R_386_NUM has grown"
56 #endif
57 
58 /*
59  * This is a 'stub' of the orignal version defined in liblddbg.so.  This stub
60  * returns the 'int string' of the relocation in question instead of converting
61  * the relocation to it's full syntax.
62  */
63 const char *
64 conv_reloc_386_type(Word type)
65 {
66 	static char 	strbuf[32];
67 	int		ndx = 31;
68 
69 	if (type < R_386_NUM)
70 		return (rels[type]);
71 
72 	strbuf[ndx--] = '\0';
73 	do {
74 		strbuf[ndx--] = '0' + (type % 10);
75 		type = type / 10;
76 	} while ((ndx >= (int)0) && (type > (Word)0));
77 
78 	return (&strbuf[ndx + 1]);
79 }
80