8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / sgs / libconv / common / sections_machelf.c
blob8dc8c0aba9679a897b60d4f5e820d3ef0c26f2fe
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
28 * String conversion routines for section attributes.
30 #include <string.h>
31 #include <sys/param.h>
32 #include <sys/elf_SPARC.h>
33 #include <sys/elf_amd64.h>
34 #include <_conv.h>
35 #include <sections_msg.h>
39 const char *
40 conv_sec_flags(uchar_t osabi, Half mach, Xword flags,
41 Conv_fmt_flags_t fmt_flags, Conv_sec_flags_buf_t *sec_flags_buf)
43 static CONV_EXPN_FIELD_ARG conv_arg = {
44 NULL, sizeof (sec_flags_buf->buf) };
46 if (flags == 0)
47 return (MSG_ORIG(MSG_GBL_ZERO));
48 CONV_XWORD_64TEST(flags, fmt_flags, &sec_flags_buf->inv_buf);
50 conv_arg.buf = sec_flags_buf->buf;
51 conv_arg.oflags = conv_arg.rflags = flags;
52 (void) conv_expn_field2(&conv_arg, osabi, mach,
53 conv_sec_flags_strings(fmt_flags), fmt_flags);
55 return ((const char *)sec_flags_buf->buf);
58 const char *
59 conv_sec_linkinfo(Word info, Xword flags, Conv_inv_buf_t *inv_buf)
61 if (flags & ALL_SHF_ORDER) {
62 if (info == SHN_BEFORE)
63 return (MSG_ORIG(MSG_SHN_BEFORE));
64 else if (info == SHN_AFTER)
65 return (MSG_ORIG(MSG_SHN_AFTER));
68 CONV_XWORD_64TEST(flags, 0, inv_buf);
69 (void) conv_invalid_val(inv_buf, info, CONV_FMT_DECIMAL);
70 return ((const char *)inv_buf->buf);