xref: /titanic_44/usr/src/cmd/sgs/libconv/common/relocate_i386.c (revision 24db46411fd54f70c35b94bb952eb7ba040e43b4)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 #pragma ident	"%Z%%M%	%I%	%E% SMI"
27 
28 /*
29  * String conversion routine for relocation types.
30  */
31 #include	<stdio.h>
32 #include	<sys/elf_386.h>
33 #include	"_conv.h"
34 #include	"relocate_i386_msg.h"
35 
36 /*
37  * 386 specific relocations.
38  */
39 static const Msg rels[R_386_NUM] = {
40 	MSG_R_386_NONE,			MSG_R_386_32,
41 	MSG_R_386_PC32,			MSG_R_386_GOT32,
42 	MSG_R_386_PLT32,		MSG_R_386_COPY,
43 	MSG_R_386_GLOB_DAT,		MSG_R_386_JMP_SLOT,
44 	MSG_R_386_RELATIVE,		MSG_R_386_GOTOFF,
45 	MSG_R_386_GOTPC,		MSG_R_386_32PLT,
46 	MSG_R_386_TLS_GD_PLT,		MSG_R_386_TLS_LDM_PLT,
47 	MSG_R_386_TLS_TPOFF,		MSG_R_386_TLS_IE,
48 	MSG_R_386_TLS_GOTIE,		MSG_R_386_TLS_LE,
49 	MSG_R_386_TLS_GD,		MSG_R_386_TLS_LDM,
50 	MSG_R_386_16,			MSG_R_386_PC16,
51 	MSG_R_386_8,			MSG_R_386_PC8,
52 	MSG_R_386_UNKNOWN24,		MSG_R_386_UNKNOWN25,
53 	MSG_R_386_UNKNOWN26,		MSG_R_386_UNKNOWN27,
54 	MSG_R_386_UNKNOWN28,		MSG_R_386_UNKNOWN29,
55 	MSG_R_386_UNKNOWN30,		MSG_R_386_UNKNOWN31,
56 	MSG_R_386_TLS_LDO_32,		MSG_R_386_UNKNOWN33,
57 	MSG_R_386_UNKNOWN34,		MSG_R_386_TLS_DTPMOD32,
58 	MSG_R_386_TLS_DTPOFF32,		MSG_R_386_UNKNOWN37,
59 	MSG_R_386_SIZE32
60 };
61 
62 #if	(R_386_NUM != (R_386_SIZE32 + 1))
63 #error	"R_386_NUM has grown"
64 #endif
65 
66 const char *
67 conv_reloc_386_type(Word type, int fmt_flags)
68 {
69 	static Conv_inv_buf_t	string;
70 
71 	if (type >= R_386_NUM)
72 		return (conv_invalid_val(string, CONV_INV_STRSIZE,
73 			type, fmt_flags));
74 	return (MSG_ORIG(rels[type]));
75 }
76