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_386.h>
337c478bd9Sstevel@tonic-gate #include "_conv.h"
347c478bd9Sstevel@tonic-gate #include "relocate_i386_msg.h"
357c478bd9Sstevel@tonic-gate
367c478bd9Sstevel@tonic-gate /*
37552ff457Srie * 386 specific relocations.
387c478bd9Sstevel@tonic-gate */
39552ff457Srie static const Msg rels[R_386_NUM] = {
40552ff457Srie MSG_R_386_NONE, MSG_R_386_32,
41552ff457Srie MSG_R_386_PC32, MSG_R_386_GOT32,
42552ff457Srie MSG_R_386_PLT32, MSG_R_386_COPY,
43552ff457Srie MSG_R_386_GLOB_DAT, MSG_R_386_JMP_SLOT,
44552ff457Srie MSG_R_386_RELATIVE, MSG_R_386_GOTOFF,
45552ff457Srie MSG_R_386_GOTPC, MSG_R_386_32PLT,
46552ff457Srie MSG_R_386_TLS_GD_PLT, MSG_R_386_TLS_LDM_PLT,
47552ff457Srie MSG_R_386_TLS_TPOFF, MSG_R_386_TLS_IE,
48552ff457Srie MSG_R_386_TLS_GOTIE, MSG_R_386_TLS_LE,
49552ff457Srie MSG_R_386_TLS_GD, MSG_R_386_TLS_LDM,
50552ff457Srie MSG_R_386_16, MSG_R_386_PC16,
51552ff457Srie MSG_R_386_8, MSG_R_386_PC8,
52552ff457Srie MSG_R_386_UNKNOWN24, MSG_R_386_UNKNOWN25,
53552ff457Srie MSG_R_386_UNKNOWN26, MSG_R_386_UNKNOWN27,
54552ff457Srie MSG_R_386_UNKNOWN28, MSG_R_386_UNKNOWN29,
55552ff457Srie MSG_R_386_UNKNOWN30, MSG_R_386_UNKNOWN31,
56552ff457Srie MSG_R_386_TLS_LDO_32, MSG_R_386_UNKNOWN33,
57552ff457Srie MSG_R_386_UNKNOWN34, MSG_R_386_TLS_DTPMOD32,
582926dd2eSrie MSG_R_386_TLS_DTPOFF32, MSG_R_386_UNKNOWN37,
592926dd2eSrie MSG_R_386_SIZE32
607c478bd9Sstevel@tonic-gate };
617c478bd9Sstevel@tonic-gate
622926dd2eSrie #if (R_386_NUM != (R_386_SIZE32 + 1))
63552ff457Srie #error "R_386_NUM has grown"
64552ff457Srie #endif
65552ff457Srie
667c478bd9Sstevel@tonic-gate const char *
conv_reloc_386_type(Word type,Conv_fmt_flags_t fmt_flags,Conv_inv_buf_t * inv_buf)67*d29b2c44Sab196087 conv_reloc_386_type(Word type, Conv_fmt_flags_t fmt_flags,
68*d29b2c44Sab196087 Conv_inv_buf_t *inv_buf)
69de777a60Sab196087 { if (type >= R_386_NUM)
70de777a60Sab196087 return (conv_invalid_val(inv_buf, type, fmt_flags));
71552ff457Srie return (MSG_ORIG(rels[type]));
727c478bd9Sstevel@tonic-gate }
73