xref: /onnv-gate/usr/src/uts/intel/ia32/krtld/kobj_convrelstr.c (revision 1169:c1bfcc795896)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
50Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
60Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
70Sstevel@tonic-gate  * with the License.
80Sstevel@tonic-gate  *
90Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
100Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
110Sstevel@tonic-gate  * See the License for the specific language governing permissions
120Sstevel@tonic-gate  * and limitations under the License.
130Sstevel@tonic-gate  *
140Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
150Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
160Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
170Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
180Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
190Sstevel@tonic-gate  *
200Sstevel@tonic-gate  * CDDL HEADER END
210Sstevel@tonic-gate  */
22*1169Srie 
230Sstevel@tonic-gate /*
24*1169Srie  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
25*1169Srie  * Use is subject to license terms.
260Sstevel@tonic-gate  */
270Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #include	<sys/types.h>
300Sstevel@tonic-gate #include	"reloc.h"
310Sstevel@tonic-gate 
32*1169Srie static const char	*rels[R_386_NUM] = {
33*1169Srie 	"R_386_NONE",			"R_386_32",
34*1169Srie 	"R_386_PC32",			"R_386_GOT32",
35*1169Srie 	"R_386_PLT32",			"R_386_COPY",
36*1169Srie 	"R_386_GLOB_DAT",		"R_386_JMP_SLOT",
37*1169Srie 	"R_386_RELATIVE",		"R_386_GOTOFF",
38*1169Srie 	"R_386_GOTPC",			"R_386_32PLT",
39*1169Srie 	"R_386_TLS_GD_PLT",		"R_386_TLS_LDM_PLT",
40*1169Srie 	"R_386_TLS_TPOFF",		"R_386_TLS_IE",
41*1169Srie 	"R_386_TLS_GOTIE",		"R_386_TLS_LE",
42*1169Srie 	"R_386_TLS_GD",			"R_386_TLS_LDM",
43*1169Srie 	"R_386_16",			"R_386_PC16",
44*1169Srie 	"R_386_8",			"R_386_PC8",
45*1169Srie 	"R_386_UNKNOWN24",		"R_386_UNKNOWN25",
46*1169Srie 	"R_386_UNKNOWN26",		"R_386_UNKNOWN27",
47*1169Srie 	"R_386_UNKNOWN28",		"R_386_UNKNOWN29",
48*1169Srie 	"R_386_UNKNOWN30",		"R_386_UNKNOWN31",
49*1169Srie 	"R_386_TLS_LDO_32",		"R_386_UNKNOWN33",
50*1169Srie 	"R_386_UNKNOWN34",		"R_386_TLS_DTPMOD32",
51*1169Srie 	"R_386_TLS_DTPOFF32",		"R_386_UNKNOWN37"
52*1169Srie };
530Sstevel@tonic-gate 
54*1169Srie #if	(R_386_NUM != (R_386_UNKNOWN37 + 1))
55*1169Srie #error	"R_386_NUM has grown"
560Sstevel@tonic-gate #endif
570Sstevel@tonic-gate 
580Sstevel@tonic-gate /*
59*1169Srie  * This is a 'stub' of the orignal version defined in liblddbg.so.  This stub
60*1169Srie  * returns the 'int string' of the relocation in question instead of converting
61*1169Srie  * the relocation to it's full syntax.
620Sstevel@tonic-gate  */
630Sstevel@tonic-gate const char *
64*1169Srie conv_reloc_386_type_str(uint_t type)
650Sstevel@tonic-gate {
66*1169Srie 	static char 	strbuf[32];
67*1169Srie 	int		ndx = 31;
68*1169Srie 
69*1169Srie 	if (type < R_386_NUM)
70*1169Srie 		return (rels[type]);
71*1169Srie 
72*1169Srie 	strbuf[ndx--] = '\0';
73*1169Srie 	do {
74*1169Srie 		strbuf[ndx--] = '0' + (type % 10);
75*1169Srie 		type = type / 10;
76*1169Srie 	} while ((ndx >= (int)0) && (type > (Word)0));
77*1169Srie 
78*1169Srie 	return (&strbuf[ndx + 1]);
790Sstevel@tonic-gate }
80