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 /*
234734Sab196087 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
240Sstevel@tonic-gate * 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 /*
290Sstevel@tonic-gate * String conversion routine for relocation types.
300Sstevel@tonic-gate */
310Sstevel@tonic-gate #include <stdio.h>
320Sstevel@tonic-gate #include <sys/elf_SPARC.h>
330Sstevel@tonic-gate #include "_conv.h"
340Sstevel@tonic-gate #include "relocate_sparc_msg.h"
350Sstevel@tonic-gate
360Sstevel@tonic-gate /*
370Sstevel@tonic-gate * SPARC specific relocations.
380Sstevel@tonic-gate */
390Sstevel@tonic-gate static const Msg rels[R_SPARC_NUM] = {
401169Srie MSG_R_SPARC_NONE, MSG_R_SPARC_8,
411169Srie MSG_R_SPARC_16, MSG_R_SPARC_32,
421169Srie MSG_R_SPARC_DISP8, MSG_R_SPARC_DISP16,
431169Srie MSG_R_SPARC_DISP32, MSG_R_SPARC_WDISP30,
441169Srie MSG_R_SPARC_WDISP22, MSG_R_SPARC_HI22,
451169Srie MSG_R_SPARC_22, MSG_R_SPARC_13,
461169Srie MSG_R_SPARC_LO10, MSG_R_SPARC_GOT10,
471169Srie MSG_R_SPARC_GOT13, MSG_R_SPARC_GOT22,
481169Srie MSG_R_SPARC_PC10, MSG_R_SPARC_PC22,
491169Srie MSG_R_SPARC_WPLT30, MSG_R_SPARC_COPY,
501169Srie MSG_R_SPARC_GLOB_DAT, MSG_R_SPARC_JMP_SLOT,
511169Srie MSG_R_SPARC_RELATIVE, MSG_R_SPARC_UA32,
521169Srie MSG_R_SPARC_PLT32, MSG_R_SPARC_HIPLT22,
531169Srie MSG_R_SPARC_LOPLT10, MSG_R_SPARC_PCPLT32,
541169Srie MSG_R_SPARC_PCPLT22, MSG_R_SPARC_PCPLT10,
551169Srie MSG_R_SPARC_10, MSG_R_SPARC_11,
561169Srie MSG_R_SPARC_64, MSG_R_SPARC_OLO10,
571169Srie MSG_R_SPARC_HH22, MSG_R_SPARC_HM10,
581169Srie MSG_R_SPARC_LM22, MSG_R_SPARC_PC_HH22,
591169Srie MSG_R_SPARC_PC_HM10, MSG_R_SPARC_PC_LM22,
601169Srie MSG_R_SPARC_WDISP16, MSG_R_SPARC_WDISP19,
611169Srie MSG_R_SPARC_GLOB_JMP, MSG_R_SPARC_7,
621169Srie MSG_R_SPARC_5, MSG_R_SPARC_6,
631169Srie MSG_R_SPARC_DISP64, MSG_R_SPARC_PLT64,
641169Srie MSG_R_SPARC_HIX22, MSG_R_SPARC_LOX10,
651169Srie MSG_R_SPARC_H44, MSG_R_SPARC_M44,
661169Srie MSG_R_SPARC_L44, MSG_R_SPARC_REGISTER,
671169Srie MSG_R_SPARC_UA64, MSG_R_SPARC_UA16,
680Sstevel@tonic-gate MSG_R_SPARC_TLS_GD_HI22, MSG_R_SPARC_TLS_GD_LO10,
690Sstevel@tonic-gate MSG_R_SPARC_TLS_GD_ADD, MSG_R_SPARC_TLS_GD_CALL,
700Sstevel@tonic-gate MSG_R_SPARC_TLS_LDM_HI22, MSG_R_SPARC_TLS_LDM_LO10,
710Sstevel@tonic-gate MSG_R_SPARC_TLS_LDM_ADD, MSG_R_SPARC_TLS_LDM_CALL,
720Sstevel@tonic-gate MSG_R_SPARC_TLS_LDO_HIX22, MSG_R_SPARC_TLS_LDO_LOX10,
730Sstevel@tonic-gate MSG_R_SPARC_TLS_LDO_ADD, MSG_R_SPARC_TLS_IE_HI22,
740Sstevel@tonic-gate MSG_R_SPARC_TLS_IE_LO10, MSG_R_SPARC_TLS_IE_LD,
750Sstevel@tonic-gate MSG_R_SPARC_TLS_IE_LDX, MSG_R_SPARC_TLS_IE_ADD,
760Sstevel@tonic-gate MSG_R_SPARC_TLS_LE_HIX22, MSG_R_SPARC_TLS_LE_LOX10,
770Sstevel@tonic-gate MSG_R_SPARC_TLS_DTPMOD32, MSG_R_SPARC_TLS_DTPMOD64,
780Sstevel@tonic-gate MSG_R_SPARC_TLS_DTPOFF32, MSG_R_SPARC_TLS_DTPOFF64,
790Sstevel@tonic-gate MSG_R_SPARC_TLS_TPOFF32, MSG_R_SPARC_TLS_TPOFF64,
800Sstevel@tonic-gate MSG_R_SPARC_GOTDATA_HIX22, MSG_R_SPARC_GOTDATA_LOX10,
810Sstevel@tonic-gate MSG_R_SPARC_GOTDATA_OP_HIX22, MSG_R_SPARC_GOTDATA_OP_LOX10,
822850Srie MSG_R_SPARC_GOTDATA_OP, MSG_R_SPARC_H34,
832850Srie MSG_R_SPARC_SIZE32, MSG_R_SPARC_SIZE64
840Sstevel@tonic-gate };
850Sstevel@tonic-gate
862850Srie #if (R_SPARC_NUM != (R_SPARC_SIZE64 + 1))
871169Srie #error "R_SPARC_NUM has grown"
881169Srie #endif
891169Srie
900Sstevel@tonic-gate const char *
conv_reloc_SPARC_type(Word type,Conv_fmt_flags_t fmt_flags,Conv_inv_buf_t * inv_buf)91*5088Sab196087 conv_reloc_SPARC_type(Word type, Conv_fmt_flags_t fmt_flags,
92*5088Sab196087 Conv_inv_buf_t *inv_buf)
930Sstevel@tonic-gate {
941169Srie if (type >= R_SPARC_NUM)
954734Sab196087 return (conv_invalid_val(inv_buf, type, fmt_flags));
961169Srie return (MSG_ORIG(rels[type]));
970Sstevel@tonic-gate }
98