xref: /titanic_52/usr/src/cmd/sgs/libconv/common/relocate_i386.c (revision bdfc6d18da790deeec2e0eb09c625902defe2498)
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  * Copyright 2004 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  * Intel386 specific relocations.
38  */
39 static const Msg rels[] = {
40 	MSG_R_386_NONE,		MSG_R_386_32,		MSG_R_386_PC32,
41 	MSG_R_386_GOT32,	MSG_R_386_PLT32,	MSG_R_386_COPY,
42 	MSG_R_386_GLOB_DAT,	MSG_R_386_JMP_SLOT,	MSG_R_386_RELATIVE,
43 	MSG_R_386_GOTOFF,	MSG_R_386_GOTPC,	MSG_R_386_32PLT,
44 	MSG_R_386_TLS_GD_PLT,	MSG_R_386_TLS_LDM_PLT,	MSG_R_386_TLS_TPOFF,
45 	MSG_R_386_TLS_IE,	MSG_R_386_TLS_GOTIE,	MSG_R_386_TLS_LE,
46 	MSG_R_386_TLS_GD,	MSG_R_386_TLS_LDM,	MSG_R_386_16,
47 	MSG_R_386_PC16,		MSG_R_386_8,		MSG_R_386_PC8,
48 	MSG_R_386_UNKNOWN24,	MSG_R_386_UNKNOWN25,	MSG_R_386_UNKNOWN26,
49 	MSG_R_386_UNKNOWN27,	MSG_R_386_UNKNOWN28,	MSG_R_386_UNKNOWN29,
50 	MSG_R_386_UNKNOWN30,	MSG_R_386_UNKNOWN31,	MSG_R_386_TLS_LDO_32,
51 	MSG_R_386_UNKNOWN33,	MSG_R_386_UNKNOWN34,	MSG_R_386_TLS_DTPMOD32,
52 	MSG_R_386_TLS_DTPOFF32, MSG_R_386_UNKNOWN37
53 };
54 
55 const char *
56 conv_reloc_386_type_str(uint_t rel)
57 {
58 	static char	string[STRSIZE] = { '\0' };
59 
60 	if (rel >= R_386_NUM)
61 		return (conv_invalid_str(string, STRSIZE, rel, 0));
62 	return (MSG_ORIG(rels[rel]));
63 }
64