xref: /onnv-gate/usr/src/uts/sparc/krtld/kobj_convrelstr.c (revision 5648:161f8007cab9)
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 /*
23*5648Ssetje  * Copyright 2007 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>
29*5648Ssetje #include	"krtld/reloc.h"
300Sstevel@tonic-gate 
311169Srie static const char	*rels[R_SPARC_NUM] = {
321169Srie 	"R_SPARC_NONE",			"R_SPARC_8",
331169Srie 	"R_SPARC_16",			"R_SPARC_32",
341169Srie 	"R_SPARC_DISP8",		"R_SPARC_DISP16",
351169Srie 	"R_SPARC_DISP32",		"R_SPARC_WDISP30",
361169Srie 	"R_SPARC_WDISP22",		"R_SPARC_HI22",
371169Srie 	"R_SPARC_22",			"R_SPARC_13",
381169Srie 	"R_SPARC_LO10",			"R_SPARC_GOT10",
391169Srie 	"R_SPARC_GOT13",		"R_SPARC_GOT22",
401169Srie 	"R_SPARC_PC10",			"R_SPARC_PC22",
411169Srie 	"R_SPARC_WPLT30",		"R_SPARC_COPY",
421169Srie 	"R_SPARC_GLOB_DAT",		"R_SPARC_JMP_SLOT",
431169Srie 	"R_SPARC_RELATIVE",		"R_SPARC_UA32",
441169Srie 	"R_SPARC_PLT32",		"R_SPARC_HIPLT22",
451169Srie 	"R_SPARC_LOPLT10",		"R_SPARC_PCPLT32",
461169Srie 	"R_SPARC_PCPLT22",		"R_SPARC_PCPLT10",
471169Srie 	"R_SPARC_10",			"R_SPARC_11",
481169Srie 	"R_SPARC_64",			"R_SPARC_OLO10",
491169Srie 	"R_SPARC_HH22",			"R_SPARC_HM10",
501169Srie 	"R_SPARC_LM22",			"R_SPARC_PC_HH22",
511169Srie 	"R_SPARC_PC_HM10",		"R_SPARC_PC_LM22",
521169Srie 	"R_SPARC_WDISP16",		"R_SPARC_WDISP19",
531169Srie 	"R_SPARC_GLOB_JMP",		"R_SPARC_7",
541169Srie 	"R_SPARC_5",			"R_SPARC_6",
551169Srie 	"R_SPARC_DISP64",		"R_SPARC_PLT64",
561169Srie 	"R_SPARC_HIX22",		"R_SPARC_LOX10",
571169Srie 	"R_SPARC_H44",			"R_SPARC_M44",
581169Srie 	"R_SPARC_L44",			"R_SPARC_REGISTER",
591169Srie 	"R_SPARC_UA64",			"R_SPARC_UA16",
601169Srie 	"R_SPARC_TLS_GD_HI22",		"R_SPARC_TLS_GD_LO10",
611169Srie 	"R_SPARC_TLS_GD_ADD",		"R_SPARC_TLS_GD_CALL",
621169Srie 	"R_SPARC_TLS_LDM_HI22",		"R_SPARC_TLS_LDM_LO10",
631169Srie 	"R_SPARC_TLS_LDM_ADD",		"R_SPARC_TLS_LDM_CALL",
641169Srie 	"R_SPARC_TLS_LDO_HIX22",	"R_SPARC_TLS_LDO_LOX10",
651169Srie 	"R_SPARC_TLS_LDO_ADD",		"R_SPARC_TLS_IE_HI22",
661169Srie 	"R_SPARC_TLS_IE_LO10",		"R_SPARC_TLS_IE_LD",
671169Srie 	"R_SPARC_TLS_IE_LDX",		"R_SPARC_TLS_IE_ADD",
681169Srie 	"R_SPARC_TLS_LE_HIX22",		"R_SPARC_TLS_LE_LOX10",
691169Srie 	"R_SPARC_TLS_DTPMOD32",		"R_SPARC_TLS_DTPMOD64",
701169Srie 	"R_SPARC_TLS_DTPOFF32",		"R_SPARC_TLS_DTPOFF64",
711169Srie 	"R_SPARC_TLS_TPOFF32",		"R_SPARC_TLS_TPOFF64",
721169Srie 	"R_SPARC_GOTDATA_HIX22",	"R_SPARC_GOTDATA_LOX10",
731169Srie 	"R_SPARC_GOTDATA_OP_HIX22",	"R_SPARC_GOTDATA_OP_LOX10",
742850Srie 	"R_SPARC_GOTDATA_OP",		"R_SPARC_H34",
752850Srie 	"R_SPARC_SIZE32",		"R_SPARC_SIZE64"
761169Srie };
770Sstevel@tonic-gate 
782850Srie #if	(R_SPARC_NUM != (R_SPARC_SIZE64 + 1))
791169Srie #error	"R_SPARC_NUM has grown"
800Sstevel@tonic-gate #endif
810Sstevel@tonic-gate 
820Sstevel@tonic-gate /*
831169Srie  * This is a 'stub' of the orignal version defined in liblddbg.so.  This stub
841169Srie  * returns the 'int string' of the relocation in question instead of converting
851169Srie  * the relocation to it's full syntax.
860Sstevel@tonic-gate  */
870Sstevel@tonic-gate const char *
conv_reloc_SPARC_type(Word type)881618Srie conv_reloc_SPARC_type(Word type)
890Sstevel@tonic-gate {
901169Srie 	static char 	strbuf[32];
911169Srie 	int		ndx = 31;
921169Srie 
931169Srie 	if (type < R_SPARC_NUM)
941169Srie 		return (rels[type]);
951169Srie 
961169Srie 	strbuf[ndx--] = '\0';
971169Srie 	do {
981169Srie 		strbuf[ndx--] = '0' + (type % 10);
991169Srie 		type = type / 10;
1001169Srie 	} while ((ndx >= (int)0) && (type > (Word)0));
1011169Srie 
1021169Srie 	return (&strbuf[ndx + 1]);
1030Sstevel@tonic-gate }
104