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_386.h>
330Sstevel@tonic-gate #include "_conv.h"
340Sstevel@tonic-gate #include "relocate_i386_msg.h"
350Sstevel@tonic-gate
360Sstevel@tonic-gate /*
371169Srie * 386 specific relocations.
380Sstevel@tonic-gate */
391169Srie static const Msg rels[R_386_NUM] = {
401169Srie MSG_R_386_NONE, MSG_R_386_32,
411169Srie MSG_R_386_PC32, MSG_R_386_GOT32,
421169Srie MSG_R_386_PLT32, MSG_R_386_COPY,
431169Srie MSG_R_386_GLOB_DAT, MSG_R_386_JMP_SLOT,
441169Srie MSG_R_386_RELATIVE, MSG_R_386_GOTOFF,
451169Srie MSG_R_386_GOTPC, MSG_R_386_32PLT,
461169Srie MSG_R_386_TLS_GD_PLT, MSG_R_386_TLS_LDM_PLT,
471169Srie MSG_R_386_TLS_TPOFF, MSG_R_386_TLS_IE,
481169Srie MSG_R_386_TLS_GOTIE, MSG_R_386_TLS_LE,
491169Srie MSG_R_386_TLS_GD, MSG_R_386_TLS_LDM,
501169Srie MSG_R_386_16, MSG_R_386_PC16,
511169Srie MSG_R_386_8, MSG_R_386_PC8,
521169Srie MSG_R_386_UNKNOWN24, MSG_R_386_UNKNOWN25,
531169Srie MSG_R_386_UNKNOWN26, MSG_R_386_UNKNOWN27,
541169Srie MSG_R_386_UNKNOWN28, MSG_R_386_UNKNOWN29,
551169Srie MSG_R_386_UNKNOWN30, MSG_R_386_UNKNOWN31,
561169Srie MSG_R_386_TLS_LDO_32, MSG_R_386_UNKNOWN33,
571169Srie MSG_R_386_UNKNOWN34, MSG_R_386_TLS_DTPMOD32,
582850Srie MSG_R_386_TLS_DTPOFF32, MSG_R_386_UNKNOWN37,
592850Srie MSG_R_386_SIZE32
600Sstevel@tonic-gate };
610Sstevel@tonic-gate
622850Srie #if (R_386_NUM != (R_386_SIZE32 + 1))
631169Srie #error "R_386_NUM has grown"
641169Srie #endif
651169Srie
660Sstevel@tonic-gate const char *
conv_reloc_386_type(Word type,Conv_fmt_flags_t fmt_flags,Conv_inv_buf_t * inv_buf)67*5088Sab196087 conv_reloc_386_type(Word type, Conv_fmt_flags_t fmt_flags,
68*5088Sab196087 Conv_inv_buf_t *inv_buf)
694734Sab196087 { if (type >= R_386_NUM)
704734Sab196087 return (conv_invalid_val(inv_buf, type, fmt_flags));
711169Srie return (MSG_ORIG(rels[type]));
720Sstevel@tonic-gate }
73