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