17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
55aefb655Srie  * Common Development and Distribution License (the "License").
65aefb655Srie  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
21552ff457Srie 
227c478bd9Sstevel@tonic-gate /*
23*986fd29aSsetje  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24552ff457Srie  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate #include	<sys/types.h>
29*986fd29aSsetje #include	"krtld/reloc.h"
307c478bd9Sstevel@tonic-gate 
31552ff457Srie static const char	*rels[R_SPARC_NUM] = {
32552ff457Srie 	"R_SPARC_NONE",			"R_SPARC_8",
33552ff457Srie 	"R_SPARC_16",			"R_SPARC_32",
34552ff457Srie 	"R_SPARC_DISP8",		"R_SPARC_DISP16",
35552ff457Srie 	"R_SPARC_DISP32",		"R_SPARC_WDISP30",
36552ff457Srie 	"R_SPARC_WDISP22",		"R_SPARC_HI22",
37552ff457Srie 	"R_SPARC_22",			"R_SPARC_13",
38552ff457Srie 	"R_SPARC_LO10",			"R_SPARC_GOT10",
39552ff457Srie 	"R_SPARC_GOT13",		"R_SPARC_GOT22",
40552ff457Srie 	"R_SPARC_PC10",			"R_SPARC_PC22",
41552ff457Srie 	"R_SPARC_WPLT30",		"R_SPARC_COPY",
42552ff457Srie 	"R_SPARC_GLOB_DAT",		"R_SPARC_JMP_SLOT",
43552ff457Srie 	"R_SPARC_RELATIVE",		"R_SPARC_UA32",
44552ff457Srie 	"R_SPARC_PLT32",		"R_SPARC_HIPLT22",
45552ff457Srie 	"R_SPARC_LOPLT10",		"R_SPARC_PCPLT32",
46552ff457Srie 	"R_SPARC_PCPLT22",		"R_SPARC_PCPLT10",
47552ff457Srie 	"R_SPARC_10",			"R_SPARC_11",
48552ff457Srie 	"R_SPARC_64",			"R_SPARC_OLO10",
49552ff457Srie 	"R_SPARC_HH22",			"R_SPARC_HM10",
50552ff457Srie 	"R_SPARC_LM22",			"R_SPARC_PC_HH22",
51552ff457Srie 	"R_SPARC_PC_HM10",		"R_SPARC_PC_LM22",
52552ff457Srie 	"R_SPARC_WDISP16",		"R_SPARC_WDISP19",
53552ff457Srie 	"R_SPARC_GLOB_JMP",		"R_SPARC_7",
54552ff457Srie 	"R_SPARC_5",			"R_SPARC_6",
55552ff457Srie 	"R_SPARC_DISP64",		"R_SPARC_PLT64",
56552ff457Srie 	"R_SPARC_HIX22",		"R_SPARC_LOX10",
57552ff457Srie 	"R_SPARC_H44",			"R_SPARC_M44",
58552ff457Srie 	"R_SPARC_L44",			"R_SPARC_REGISTER",
59552ff457Srie 	"R_SPARC_UA64",			"R_SPARC_UA16",
60552ff457Srie 	"R_SPARC_TLS_GD_HI22",		"R_SPARC_TLS_GD_LO10",
61552ff457Srie 	"R_SPARC_TLS_GD_ADD",		"R_SPARC_TLS_GD_CALL",
62552ff457Srie 	"R_SPARC_TLS_LDM_HI22",		"R_SPARC_TLS_LDM_LO10",
63552ff457Srie 	"R_SPARC_TLS_LDM_ADD",		"R_SPARC_TLS_LDM_CALL",
64552ff457Srie 	"R_SPARC_TLS_LDO_HIX22",	"R_SPARC_TLS_LDO_LOX10",
65552ff457Srie 	"R_SPARC_TLS_LDO_ADD",		"R_SPARC_TLS_IE_HI22",
66552ff457Srie 	"R_SPARC_TLS_IE_LO10",		"R_SPARC_TLS_IE_LD",
67552ff457Srie 	"R_SPARC_TLS_IE_LDX",		"R_SPARC_TLS_IE_ADD",
68552ff457Srie 	"R_SPARC_TLS_LE_HIX22",		"R_SPARC_TLS_LE_LOX10",
69552ff457Srie 	"R_SPARC_TLS_DTPMOD32",		"R_SPARC_TLS_DTPMOD64",
70552ff457Srie 	"R_SPARC_TLS_DTPOFF32",		"R_SPARC_TLS_DTPOFF64",
71552ff457Srie 	"R_SPARC_TLS_TPOFF32",		"R_SPARC_TLS_TPOFF64",
72552ff457Srie 	"R_SPARC_GOTDATA_HIX22",	"R_SPARC_GOTDATA_LOX10",
73552ff457Srie 	"R_SPARC_GOTDATA_OP_HIX22",	"R_SPARC_GOTDATA_OP_LOX10",
742926dd2eSrie 	"R_SPARC_GOTDATA_OP",		"R_SPARC_H34",
752926dd2eSrie 	"R_SPARC_SIZE32",		"R_SPARC_SIZE64"
767c478bd9Sstevel@tonic-gate };
77552ff457Srie 
782926dd2eSrie #if	(R_SPARC_NUM != (R_SPARC_SIZE64 + 1))
79552ff457Srie #error	"R_SPARC_NUM has grown"
807c478bd9Sstevel@tonic-gate #endif
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate /*
83552ff457Srie  * This is a 'stub' of the orignal version defined in liblddbg.so.  This stub
84552ff457Srie  * returns the 'int string' of the relocation in question instead of converting
85552ff457Srie  * the relocation to it's full syntax.
867c478bd9Sstevel@tonic-gate  */
877c478bd9Sstevel@tonic-gate const char *
conv_reloc_SPARC_type(Word type)885aefb655Srie conv_reloc_SPARC_type(Word type)
897c478bd9Sstevel@tonic-gate {
90552ff457Srie 	static char 	strbuf[32];
91552ff457Srie 	int		ndx = 31;
92552ff457Srie 
93552ff457Srie 	if (type < R_SPARC_NUM)
94552ff457Srie 		return (rels[type]);
95552ff457Srie 
96552ff457Srie 	strbuf[ndx--] = '\0';
97552ff457Srie 	do {
98552ff457Srie 		strbuf[ndx--] = '0' + (type % 10);
99552ff457Srie 		type = type / 10;
100552ff457Srie 	} while ((ndx >= (int)0) && (type > (Word)0));
101552ff457Srie 
102552ff457Srie 	return (&strbuf[ndx + 1]);
1037c478bd9Sstevel@tonic-gate }
104