xref: /titanic_52/usr/src/cmd/sgs/libconv/common/relocate_sparc.c (revision d29b2c4438482eb00488be49a1f5d6835f455546)
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 /*
23de777a60Sab196087  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * 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 /*
297c478bd9Sstevel@tonic-gate  * String conversion routine for relocation types.
307c478bd9Sstevel@tonic-gate  */
317c478bd9Sstevel@tonic-gate #include	<stdio.h>
327c478bd9Sstevel@tonic-gate #include	<sys/elf_SPARC.h>
337c478bd9Sstevel@tonic-gate #include	"_conv.h"
347c478bd9Sstevel@tonic-gate #include	"relocate_sparc_msg.h"
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate /*
377c478bd9Sstevel@tonic-gate  * SPARC specific relocations.
387c478bd9Sstevel@tonic-gate  */
397c478bd9Sstevel@tonic-gate static const Msg rels[R_SPARC_NUM] = {
40552ff457Srie 	MSG_R_SPARC_NONE,		MSG_R_SPARC_8,
41552ff457Srie 	MSG_R_SPARC_16,			MSG_R_SPARC_32,
42552ff457Srie 	MSG_R_SPARC_DISP8,		MSG_R_SPARC_DISP16,
43552ff457Srie 	MSG_R_SPARC_DISP32,		MSG_R_SPARC_WDISP30,
44552ff457Srie 	MSG_R_SPARC_WDISP22,		MSG_R_SPARC_HI22,
45552ff457Srie 	MSG_R_SPARC_22,			MSG_R_SPARC_13,
46552ff457Srie 	MSG_R_SPARC_LO10,		MSG_R_SPARC_GOT10,
47552ff457Srie 	MSG_R_SPARC_GOT13,		MSG_R_SPARC_GOT22,
48552ff457Srie 	MSG_R_SPARC_PC10,		MSG_R_SPARC_PC22,
49552ff457Srie 	MSG_R_SPARC_WPLT30,		MSG_R_SPARC_COPY,
50552ff457Srie 	MSG_R_SPARC_GLOB_DAT,		MSG_R_SPARC_JMP_SLOT,
51552ff457Srie 	MSG_R_SPARC_RELATIVE,		MSG_R_SPARC_UA32,
52552ff457Srie 	MSG_R_SPARC_PLT32,		MSG_R_SPARC_HIPLT22,
53552ff457Srie 	MSG_R_SPARC_LOPLT10,		MSG_R_SPARC_PCPLT32,
54552ff457Srie 	MSG_R_SPARC_PCPLT22,		MSG_R_SPARC_PCPLT10,
55552ff457Srie 	MSG_R_SPARC_10,			MSG_R_SPARC_11,
56552ff457Srie 	MSG_R_SPARC_64,			MSG_R_SPARC_OLO10,
57552ff457Srie 	MSG_R_SPARC_HH22,		MSG_R_SPARC_HM10,
58552ff457Srie 	MSG_R_SPARC_LM22,		MSG_R_SPARC_PC_HH22,
59552ff457Srie 	MSG_R_SPARC_PC_HM10,		MSG_R_SPARC_PC_LM22,
60552ff457Srie 	MSG_R_SPARC_WDISP16,		MSG_R_SPARC_WDISP19,
61552ff457Srie 	MSG_R_SPARC_GLOB_JMP,		MSG_R_SPARC_7,
62552ff457Srie 	MSG_R_SPARC_5,			MSG_R_SPARC_6,
63552ff457Srie 	MSG_R_SPARC_DISP64,		MSG_R_SPARC_PLT64,
64552ff457Srie 	MSG_R_SPARC_HIX22,		MSG_R_SPARC_LOX10,
65552ff457Srie 	MSG_R_SPARC_H44,		MSG_R_SPARC_M44,
66552ff457Srie 	MSG_R_SPARC_L44,		MSG_R_SPARC_REGISTER,
677c478bd9Sstevel@tonic-gate 	MSG_R_SPARC_UA64,		MSG_R_SPARC_UA16,
687c478bd9Sstevel@tonic-gate 	MSG_R_SPARC_TLS_GD_HI22,	MSG_R_SPARC_TLS_GD_LO10,
697c478bd9Sstevel@tonic-gate 	MSG_R_SPARC_TLS_GD_ADD,		MSG_R_SPARC_TLS_GD_CALL,
707c478bd9Sstevel@tonic-gate 	MSG_R_SPARC_TLS_LDM_HI22,	MSG_R_SPARC_TLS_LDM_LO10,
717c478bd9Sstevel@tonic-gate 	MSG_R_SPARC_TLS_LDM_ADD,	MSG_R_SPARC_TLS_LDM_CALL,
727c478bd9Sstevel@tonic-gate 	MSG_R_SPARC_TLS_LDO_HIX22,	MSG_R_SPARC_TLS_LDO_LOX10,
737c478bd9Sstevel@tonic-gate 	MSG_R_SPARC_TLS_LDO_ADD,	MSG_R_SPARC_TLS_IE_HI22,
747c478bd9Sstevel@tonic-gate 	MSG_R_SPARC_TLS_IE_LO10,	MSG_R_SPARC_TLS_IE_LD,
757c478bd9Sstevel@tonic-gate 	MSG_R_SPARC_TLS_IE_LDX,		MSG_R_SPARC_TLS_IE_ADD,
767c478bd9Sstevel@tonic-gate 	MSG_R_SPARC_TLS_LE_HIX22,	MSG_R_SPARC_TLS_LE_LOX10,
777c478bd9Sstevel@tonic-gate 	MSG_R_SPARC_TLS_DTPMOD32,	MSG_R_SPARC_TLS_DTPMOD64,
787c478bd9Sstevel@tonic-gate 	MSG_R_SPARC_TLS_DTPOFF32,	MSG_R_SPARC_TLS_DTPOFF64,
797c478bd9Sstevel@tonic-gate 	MSG_R_SPARC_TLS_TPOFF32,	MSG_R_SPARC_TLS_TPOFF64,
807c478bd9Sstevel@tonic-gate 	MSG_R_SPARC_GOTDATA_HIX22,	MSG_R_SPARC_GOTDATA_LOX10,
817c478bd9Sstevel@tonic-gate 	MSG_R_SPARC_GOTDATA_OP_HIX22,	MSG_R_SPARC_GOTDATA_OP_LOX10,
822926dd2eSrie 	MSG_R_SPARC_GOTDATA_OP,		MSG_R_SPARC_H34,
832926dd2eSrie 	MSG_R_SPARC_SIZE32,		MSG_R_SPARC_SIZE64
847c478bd9Sstevel@tonic-gate };
857c478bd9Sstevel@tonic-gate 
862926dd2eSrie #if	(R_SPARC_NUM != (R_SPARC_SIZE64 + 1))
87552ff457Srie #error	"R_SPARC_NUM has grown"
88552ff457Srie #endif
89552ff457Srie 
907c478bd9Sstevel@tonic-gate const char *
91*d29b2c44Sab196087 conv_reloc_SPARC_type(Word type, Conv_fmt_flags_t fmt_flags,
92*d29b2c44Sab196087     Conv_inv_buf_t *inv_buf)
937c478bd9Sstevel@tonic-gate {
94552ff457Srie 	if (type >= R_SPARC_NUM)
95de777a60Sab196087 		return (conv_invalid_val(inv_buf, type, fmt_flags));
96552ff457Srie 	return (MSG_ORIG(rels[type]));
977c478bd9Sstevel@tonic-gate }
98