xref: /titanic_41/usr/src/uts/intel/ia32/krtld/kobj_convrelstr.c (revision 70025d765b044c6d8594bb965a2247a61e991a99)
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 (c) 1996-1997,1999 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 #pragma ident	"%Z%%M%	%I%	%E% SMI"
27 
28 #include	<sys/types.h>
29 #include	"reloc.h"
30 
31 
32 #ifdef	KOBJ_DEBUG
33 static const char	*rels[] = {
34 	"R_386_NONE",
35 	"R_386_32",
36 	"R_386_PC32",
37 	"R_386_GOT32",
38 	"R_386_PLT32",
39 	"R_386_COPY",
40 	"R_386_GLOB_DAT",
41 	"R_386_JMP_SLOT",
42 	"R_386_RELATIVE",
43 	"R_386_GOTOFF",
44 	"R_386_GOTPC",
45 	"R_386_32PLT",
46 };
47 #endif
48 
49 
50 /*
51  * This is a 'stub' of the orignal version defined in liblddbg.so
52  * This stub just returns the 'int string' of the relocation in question
53  * instead of converting it to it's full syntax.
54  */
55 const char *
56 conv_reloc_386_type_str(Word rtype)
57 {
58 #ifdef	KOBJ_DEBUG
59 	if (rtype < R_386_NUM)
60 		return (rels[rtype]);
61 	else {
62 #endif
63 		static char 	strbuf[32];
64 		int		ndx = 31;
65 		strbuf[ndx--] = '\0';
66 		do {
67 			strbuf[ndx--] = '0' + (rtype % 10);
68 			rtype = rtype / 10;
69 		} while ((ndx >= (int)0) && (rtype > (Word)0));
70 		return (&strbuf[ndx + 1]);
71 #ifdef	KOBJ_DEBUG
72 	}
73 #endif
74 }
75