xref: /onnv-gate/usr/src/cmd/sgs/libconv/common/data.c (revision 4734:a4708faa3e85)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
51618Srie  * Common Development and Distribution License (the "License").
61618Srie  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
211618Srie 
220Sstevel@tonic-gate /*
23*4734Sab196087  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate  * Use is subject to license terms.
250Sstevel@tonic-gate  */
261618Srie 
270Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
280Sstevel@tonic-gate 
290Sstevel@tonic-gate /*
300Sstevel@tonic-gate  * String conversion routine for Elf data buffer types.
310Sstevel@tonic-gate  */
320Sstevel@tonic-gate #include	"_conv.h"
330Sstevel@tonic-gate #include	"data_msg.h"
340Sstevel@tonic-gate 
350Sstevel@tonic-gate const char *
conv_elfdata_type(Elf_Type type,Conv_inv_buf_t * inv_buf)36*4734Sab196087 conv_elfdata_type(Elf_Type type, Conv_inv_buf_t *inv_buf)
370Sstevel@tonic-gate {
381618Srie 	static const Msg	types[] = {
391618Srie 		MSG_DATA_BYTE,		MSG_DATA_ADDR,
401618Srie 		MSG_DATA_DYN,		MSG_DATA_EHDR,
411618Srie 		MSG_DATA_HALF,		MSG_DATA_OFF,
421618Srie 		MSG_DATA_PHDR,		MSG_DATA_RELA,
431618Srie 		MSG_DATA_REL,		MSG_DATA_SHDR,
441618Srie 		MSG_DATA_SWORD,		MSG_DATA_SYM,
451618Srie 		MSG_DATA_WORD,		MSG_DATA_VDEF,
461618Srie 		MSG_DATA_VNEED,		MSG_DATA_SXWORD,
471618Srie 		MSG_DATA_XWORD,		MSG_DATA_SYMINFO,
481618Srie 		MSG_DATA_NOTE,		MSG_DATA_MOVE,
491618Srie 		MSG_DATA_MOVEP,		MSG_DATA_CAP
501618Srie 	};
510Sstevel@tonic-gate 
520Sstevel@tonic-gate 	if (type >= ELF_T_NUM)
53*4734Sab196087 		return (conv_invalid_val(inv_buf, type, 0));
540Sstevel@tonic-gate 	else
550Sstevel@tonic-gate 		return (MSG_ORIG(types[type]));
560Sstevel@tonic-gate }
57