xref: /titanic_44/usr/src/uts/intel/ia32/krtld/kobj_convrelstr.c (revision 2926dd2e801916128855cec712d18656be9bd1c5)
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 /*
235aefb655Srie  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24552ff457Srie  * 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 #include	<sys/types.h>
297c478bd9Sstevel@tonic-gate #include	"reloc.h"
307c478bd9Sstevel@tonic-gate 
31552ff457Srie static const char	*rels[R_386_NUM] = {
32552ff457Srie 	"R_386_NONE",			"R_386_32",
33552ff457Srie 	"R_386_PC32",			"R_386_GOT32",
34552ff457Srie 	"R_386_PLT32",			"R_386_COPY",
35552ff457Srie 	"R_386_GLOB_DAT",		"R_386_JMP_SLOT",
36552ff457Srie 	"R_386_RELATIVE",		"R_386_GOTOFF",
37552ff457Srie 	"R_386_GOTPC",			"R_386_32PLT",
38552ff457Srie 	"R_386_TLS_GD_PLT",		"R_386_TLS_LDM_PLT",
39552ff457Srie 	"R_386_TLS_TPOFF",		"R_386_TLS_IE",
40552ff457Srie 	"R_386_TLS_GOTIE",		"R_386_TLS_LE",
41552ff457Srie 	"R_386_TLS_GD",			"R_386_TLS_LDM",
42552ff457Srie 	"R_386_16",			"R_386_PC16",
43552ff457Srie 	"R_386_8",			"R_386_PC8",
44552ff457Srie 	"R_386_UNKNOWN24",		"R_386_UNKNOWN25",
45552ff457Srie 	"R_386_UNKNOWN26",		"R_386_UNKNOWN27",
46552ff457Srie 	"R_386_UNKNOWN28",		"R_386_UNKNOWN29",
47552ff457Srie 	"R_386_UNKNOWN30",		"R_386_UNKNOWN31",
48552ff457Srie 	"R_386_TLS_LDO_32",		"R_386_UNKNOWN33",
49552ff457Srie 	"R_386_UNKNOWN34",		"R_386_TLS_DTPMOD32",
50*2926dd2eSrie 	"R_386_TLS_DTPOFF32",		"R_386_UNKNOWN37",
51*2926dd2eSrie 	"R_386_SIZE32"
527c478bd9Sstevel@tonic-gate };
537c478bd9Sstevel@tonic-gate 
54*2926dd2eSrie #if	(R_386_NUM != (R_386_SIZE32 + 1))
55552ff457Srie #error	"R_386_NUM has grown"
56552ff457Srie #endif
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate /*
59552ff457Srie  * This is a 'stub' of the orignal version defined in liblddbg.so.  This stub
60552ff457Srie  * returns the 'int string' of the relocation in question instead of converting
61552ff457Srie  * the relocation to it's full syntax.
627c478bd9Sstevel@tonic-gate  */
637c478bd9Sstevel@tonic-gate const char *
conv_reloc_386_type(Word type)645aefb655Srie conv_reloc_386_type(Word type)
657c478bd9Sstevel@tonic-gate {
667c478bd9Sstevel@tonic-gate 	static char 	strbuf[32];
677c478bd9Sstevel@tonic-gate 	int		ndx = 31;
68552ff457Srie 
69552ff457Srie 	if (type < R_386_NUM)
70552ff457Srie 		return (rels[type]);
71552ff457Srie 
727c478bd9Sstevel@tonic-gate 	strbuf[ndx--] = '\0';
737c478bd9Sstevel@tonic-gate 	do {
74552ff457Srie 		strbuf[ndx--] = '0' + (type % 10);
75552ff457Srie 		type = type / 10;
76552ff457Srie 	} while ((ndx >= (int)0) && (type > (Word)0));
77552ff457Srie 
787c478bd9Sstevel@tonic-gate 	return (&strbuf[ndx + 1]);
797c478bd9Sstevel@tonic-gate }
80