xref: /onnv-gate/usr/src/uts/intel/ia32/krtld/kobj_convrelstr.c (revision 2850:689acf945b89)
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
51618Srie  * Common Development and Distribution License (the "License").
61618Srie  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
211169Srie 
220Sstevel@tonic-gate /*
231618Srie  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
241169Srie  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
270Sstevel@tonic-gate 
280Sstevel@tonic-gate #include	<sys/types.h>
290Sstevel@tonic-gate #include	"reloc.h"
300Sstevel@tonic-gate 
311169Srie static const char	*rels[R_386_NUM] = {
321169Srie 	"R_386_NONE",			"R_386_32",
331169Srie 	"R_386_PC32",			"R_386_GOT32",
341169Srie 	"R_386_PLT32",			"R_386_COPY",
351169Srie 	"R_386_GLOB_DAT",		"R_386_JMP_SLOT",
361169Srie 	"R_386_RELATIVE",		"R_386_GOTOFF",
371169Srie 	"R_386_GOTPC",			"R_386_32PLT",
381169Srie 	"R_386_TLS_GD_PLT",		"R_386_TLS_LDM_PLT",
391169Srie 	"R_386_TLS_TPOFF",		"R_386_TLS_IE",
401169Srie 	"R_386_TLS_GOTIE",		"R_386_TLS_LE",
411169Srie 	"R_386_TLS_GD",			"R_386_TLS_LDM",
421169Srie 	"R_386_16",			"R_386_PC16",
431169Srie 	"R_386_8",			"R_386_PC8",
441169Srie 	"R_386_UNKNOWN24",		"R_386_UNKNOWN25",
451169Srie 	"R_386_UNKNOWN26",		"R_386_UNKNOWN27",
461169Srie 	"R_386_UNKNOWN28",		"R_386_UNKNOWN29",
471169Srie 	"R_386_UNKNOWN30",		"R_386_UNKNOWN31",
481169Srie 	"R_386_TLS_LDO_32",		"R_386_UNKNOWN33",
491169Srie 	"R_386_UNKNOWN34",		"R_386_TLS_DTPMOD32",
50*2850Srie 	"R_386_TLS_DTPOFF32",		"R_386_UNKNOWN37",
51*2850Srie 	"R_386_SIZE32"
521169Srie };
530Sstevel@tonic-gate 
54*2850Srie #if	(R_386_NUM != (R_386_SIZE32 + 1))
551169Srie #error	"R_386_NUM has grown"
560Sstevel@tonic-gate #endif
570Sstevel@tonic-gate 
580Sstevel@tonic-gate /*
591169Srie  * This is a 'stub' of the orignal version defined in liblddbg.so.  This stub
601169Srie  * returns the 'int string' of the relocation in question instead of converting
611169Srie  * the relocation to it's full syntax.
620Sstevel@tonic-gate  */
630Sstevel@tonic-gate const char *
conv_reloc_386_type(Word type)641618Srie conv_reloc_386_type(Word type)
650Sstevel@tonic-gate {
661169Srie 	static char 	strbuf[32];
671169Srie 	int		ndx = 31;
681169Srie 
691169Srie 	if (type < R_386_NUM)
701169Srie 		return (rels[type]);
711169Srie 
721169Srie 	strbuf[ndx--] = '\0';
731169Srie 	do {
741169Srie 		strbuf[ndx--] = '0' + (type % 10);
751169Srie 		type = type / 10;
761169Srie 	} while ((ndx >= (int)0) && (type > (Word)0));
771169Srie 
781169Srie 	return (&strbuf[ndx + 1]);
790Sstevel@tonic-gate }
80