xref: /titanic_44/usr/src/cmd/sgs/libconv/common/relocate.c (revision 1cb6af97c6f66f456d4f726ef056e1ebc0f73305)
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	"_conv.h"
33 
34 /*
35  * Generic front-end that determines machine specific relocations.
36  */
37 const char *
38 conv_reloc_type_str(ushort_t mach, uint_t rel)
39 {
40 	static char	string[STRSIZE] = { '\0' };
41 
42 	if (mach == EM_386)
43 		return (conv_reloc_386_type_str(rel));
44 
45 	if ((mach == EM_SPARC) || (mach == EM_SPARC32PLUS) ||
46 	    (mach == EM_SPARCV9))
47 		return (conv_reloc_SPARC_type_str(rel));
48 
49 	if (mach == EM_AMD64)
50 		return (conv_reloc_amd64_type_str(rel));
51 
52 	return (conv_invalid_str(string, STRSIZE, rel, 0));
53 }
54