xref: /onnv-gate/usr/src/cmd/sgs/libconv/common/relocate_sparc.c (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
27*0Sstevel@tonic-gate 
28*0Sstevel@tonic-gate /*
29*0Sstevel@tonic-gate  * String conversion routine for relocation types.
30*0Sstevel@tonic-gate  */
31*0Sstevel@tonic-gate #include	<stdio.h>
32*0Sstevel@tonic-gate #include	<sys/elf_SPARC.h>
33*0Sstevel@tonic-gate #include	"_conv.h"
34*0Sstevel@tonic-gate #include	"relocate_sparc_msg.h"
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate /*
37*0Sstevel@tonic-gate  * SPARC specific relocations.
38*0Sstevel@tonic-gate  */
39*0Sstevel@tonic-gate static const Msg rels[R_SPARC_NUM] = {
40*0Sstevel@tonic-gate 	MSG_R_SPARC_NONE,	MSG_R_SPARC_8,		MSG_R_SPARC_16,
41*0Sstevel@tonic-gate 	MSG_R_SPARC_32,		MSG_R_SPARC_DISP8,	MSG_R_SPARC_DISP16,
42*0Sstevel@tonic-gate 	MSG_R_SPARC_DISP32,	MSG_R_SPARC_WDISP30,	MSG_R_SPARC_WDISP22,
43*0Sstevel@tonic-gate 	MSG_R_SPARC_HI22,	MSG_R_SPARC_22,		MSG_R_SPARC_13,
44*0Sstevel@tonic-gate 	MSG_R_SPARC_LO10,	MSG_R_SPARC_GOT10,	MSG_R_SPARC_GOT13,
45*0Sstevel@tonic-gate 	MSG_R_SPARC_GOT22,	MSG_R_SPARC_PC10,	MSG_R_SPARC_PC22,
46*0Sstevel@tonic-gate 	MSG_R_SPARC_WPLT30,	MSG_R_SPARC_COPY,	MSG_R_SPARC_GLOB_DAT,
47*0Sstevel@tonic-gate 	MSG_R_SPARC_JMP_SLOT,	MSG_R_SPARC_RELATIVE,	MSG_R_SPARC_UA32,
48*0Sstevel@tonic-gate 	MSG_R_SPARC_PLT32,	MSG_R_SPARC_HIPLT22,	MSG_R_SPARC_LOPLT10,
49*0Sstevel@tonic-gate 	MSG_R_SPARC_PCPLT32,	MSG_R_SPARC_PCPLT22,	MSG_R_SPARC_PCPLT10,
50*0Sstevel@tonic-gate 	MSG_R_SPARC_10,		MSG_R_SPARC_11,		MSG_R_SPARC_64,
51*0Sstevel@tonic-gate 	MSG_R_SPARC_OLO10,	MSG_R_SPARC_HH22,	MSG_R_SPARC_HM10,
52*0Sstevel@tonic-gate 	MSG_R_SPARC_LM22,	MSG_R_SPARC_PC_HH22,	MSG_R_SPARC_PC_HM10,
53*0Sstevel@tonic-gate 	MSG_R_SPARC_PC_LM22,	MSG_R_SPARC_WDISP16,	MSG_R_SPARC_WDISP19,
54*0Sstevel@tonic-gate 	MSG_R_SPARC_GLOB_JMP,	MSG_R_SPARC_7,		MSG_R_SPARC_5,
55*0Sstevel@tonic-gate 	MSG_R_SPARC_6,		MSG_R_SPARC_DISP64,	MSG_R_SPARC_PLT64,
56*0Sstevel@tonic-gate 	MSG_R_SPARC_HIX22,	MSG_R_SPARC_LOX10,	MSG_R_SPARC_H44,
57*0Sstevel@tonic-gate 	MSG_R_SPARC_M44,	MSG_R_SPARC_L44,	MSG_R_SPARC_REGISTER,
58*0Sstevel@tonic-gate 	MSG_R_SPARC_UA64,	MSG_R_SPARC_UA16,
59*0Sstevel@tonic-gate 	MSG_R_SPARC_TLS_GD_HI22,	MSG_R_SPARC_TLS_GD_LO10,
60*0Sstevel@tonic-gate 	MSG_R_SPARC_TLS_GD_ADD,		MSG_R_SPARC_TLS_GD_CALL,
61*0Sstevel@tonic-gate 	MSG_R_SPARC_TLS_LDM_HI22,	MSG_R_SPARC_TLS_LDM_LO10,
62*0Sstevel@tonic-gate 	MSG_R_SPARC_TLS_LDM_ADD,	MSG_R_SPARC_TLS_LDM_CALL,
63*0Sstevel@tonic-gate 	MSG_R_SPARC_TLS_LDO_HIX22,	MSG_R_SPARC_TLS_LDO_LOX10,
64*0Sstevel@tonic-gate 	MSG_R_SPARC_TLS_LDO_ADD,	MSG_R_SPARC_TLS_IE_HI22,
65*0Sstevel@tonic-gate 	MSG_R_SPARC_TLS_IE_LO10,	MSG_R_SPARC_TLS_IE_LD,
66*0Sstevel@tonic-gate 	MSG_R_SPARC_TLS_IE_LDX,		MSG_R_SPARC_TLS_IE_ADD,
67*0Sstevel@tonic-gate 	MSG_R_SPARC_TLS_LE_HIX22,	MSG_R_SPARC_TLS_LE_LOX10,
68*0Sstevel@tonic-gate 	MSG_R_SPARC_TLS_DTPMOD32,	MSG_R_SPARC_TLS_DTPMOD64,
69*0Sstevel@tonic-gate 	MSG_R_SPARC_TLS_DTPOFF32,	MSG_R_SPARC_TLS_DTPOFF64,
70*0Sstevel@tonic-gate 	MSG_R_SPARC_TLS_TPOFF32,	MSG_R_SPARC_TLS_TPOFF64,
71*0Sstevel@tonic-gate 	MSG_R_SPARC_GOTDATA_HIX22,	MSG_R_SPARC_GOTDATA_LOX10,
72*0Sstevel@tonic-gate 	MSG_R_SPARC_GOTDATA_OP_HIX22,	MSG_R_SPARC_GOTDATA_OP_LOX10,
73*0Sstevel@tonic-gate 	MSG_R_SPARC_GOTDATA_OP,		MSG_R_SPARC_H34
74*0Sstevel@tonic-gate };
75*0Sstevel@tonic-gate 
76*0Sstevel@tonic-gate const char *
77*0Sstevel@tonic-gate conv_reloc_SPARC_type_str(uint_t rel)
78*0Sstevel@tonic-gate {
79*0Sstevel@tonic-gate 	static char	string[STRSIZE] = { '\0' };
80*0Sstevel@tonic-gate 
81*0Sstevel@tonic-gate 	if (rel >= R_SPARC_NUM)
82*0Sstevel@tonic-gate 		return (conv_invalid_str(string, STRSIZE, rel, 0));
83*0Sstevel@tonic-gate 	return (MSG_ORIG(rels[rel]));
84*0Sstevel@tonic-gate }
85