8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / sgs / libconv / common / dynamic_machelf.c
blobbeee0d797ccc4c59ebf3e6716bca3a6332e58407
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 routine for .dynamic tag entries.
30 #include <stdio.h>
31 #include <string.h>
32 #include <sys/elf_SPARC.h>
33 #include "rtld.h"
34 #include "_conv.h"
35 #include "dynamic_msg.h"
39 const char *
40 conv_dyn_posflag1(Xword flags, Conv_fmt_flags_t fmt_flags,
41 Conv_dyn_posflag1_buf_t *dyn_posflag1_buf)
43 static CONV_EXPN_FIELD_ARG conv_arg = {
44 NULL, sizeof (dyn_posflag1_buf->buf) };
45 static CONV_EXPN_FIELD_ARG conv_arg_alt = {
46 NULL, sizeof (dyn_posflag1_buf->buf), NULL, 0, 0,
47 MSG_ORIG(MSG_STR_EMPTY), NULL, MSG_ORIG(MSG_STR_EMPTY) };
49 CONV_EXPN_FIELD_ARG *arg;
51 if (flags == 0)
52 return (MSG_ORIG(MSG_GBL_ZERO));
53 CONV_XWORD_64TEST(flags, fmt_flags, &dyn_posflag1_buf->inv_buf);
55 arg = (CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_DUMP) ?
56 &conv_arg_alt : &conv_arg;
57 arg->buf = dyn_posflag1_buf->buf;
58 arg->oflags = arg->rflags = flags;
59 (void) conv_expn_field(arg, conv_dyn_posflag1_strings(fmt_flags),
60 fmt_flags);
62 return ((const char *)dyn_posflag1_buf);
65 const char *
66 conv_dyn_flag(Xword flags, Conv_fmt_flags_t fmt_flags,
67 Conv_dyn_flag_buf_t *dyn_flag_buf)
69 static CONV_EXPN_FIELD_ARG conv_arg = {
70 NULL, sizeof (dyn_flag_buf->buf) };
72 if (flags == 0)
73 return (MSG_ORIG(MSG_GBL_ZERO));
74 CONV_XWORD_64TEST(flags, fmt_flags, &dyn_flag_buf->inv_buf);
76 conv_arg.buf = dyn_flag_buf->buf;
77 conv_arg.oflags = conv_arg.rflags = flags;
78 if (CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_DUMP) {
79 conv_arg.prefix = conv_arg.suffix = MSG_ORIG(MSG_STR_EMPTY);
80 } else {
81 conv_arg.prefix = conv_arg.suffix = NULL;
83 (void) conv_expn_field(&conv_arg, conv_dyn_flag_strings(fmt_flags),
84 fmt_flags);
86 return ((const char *)dyn_flag_buf->buf);
89 const char *
90 conv_dyn_flag1(Xword flags, Conv_fmt_flags_t fmt_flags,
91 Conv_dyn_flag1_buf_t *dyn_flag1_buf)
93 static CONV_EXPN_FIELD_ARG conv_arg = {
94 NULL, sizeof (dyn_flag1_buf->buf) };
96 if (flags == 0)
97 return (MSG_ORIG(MSG_GBL_ZERO));
98 CONV_XWORD_64TEST(flags, fmt_flags, &dyn_flag1_buf->inv_buf);
100 conv_arg.oflags = conv_arg.rflags = flags;
101 conv_arg.buf = dyn_flag1_buf->buf;
102 (void) conv_expn_field(&conv_arg, conv_dyn_flag1_strings(fmt_flags),
103 fmt_flags);
105 return ((const char *)dyn_flag1_buf->buf);
108 const char *
109 conv_dyn_feature1(Xword flags, Conv_fmt_flags_t fmt_flags,
110 Conv_dyn_feature1_buf_t *dyn_feature1_buf)
112 static CONV_EXPN_FIELD_ARG conv_arg = {
113 NULL, sizeof (dyn_feature1_buf->buf) };
115 if (flags == 0)
116 return (MSG_ORIG(MSG_GBL_ZERO));
117 CONV_XWORD_64TEST(flags, fmt_flags, &dyn_feature1_buf->inv_buf);
119 conv_arg.buf = dyn_feature1_buf->buf;
120 conv_arg.oflags = conv_arg.rflags = flags;
121 if (CONV_TYPE_FMT_ALT(fmt_flags) == CONV_FMT_ALT_DUMP) {
122 conv_arg.prefix = conv_arg.suffix = MSG_ORIG(MSG_STR_EMPTY);
123 } else {
124 conv_arg.prefix = conv_arg.suffix = NULL;
126 (void) conv_expn_field(&conv_arg,
127 conv_dyn_feature1_strings(fmt_flags), fmt_flags);
129 return ((const char *)dyn_feature1_buf->buf);
132 const char *
133 conv_dyn_tag(Xword tag, uchar_t osabi, Half mach, Conv_fmt_flags_t fmt_flags,
134 Conv_inv_buf_t *inv_buf)
136 CONV_XWORD_64TEST(tag, fmt_flags, inv_buf);
137 return (conv_map_ds(osabi, mach, tag,
138 conv_dyn_tag_strings(osabi, mach, fmt_flags), fmt_flags, inv_buf));