dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / sgs / liblddbg / common / syminfo.c
blobe550fa6b66acb0ea317a874989bd5de3e2fde542
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 (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
25 #include <sgs.h>
26 #include <stdio.h>
27 #include <debug.h>
28 #include <msg.h>
30 void
31 Elf_syminfo_title(Lm_list *lml)
33 dbg_print(lml, MSG_INTL(MSG_SYMINFO_TITLE));
36 #define FLAGSZ 16
37 #define NDXSZ 10
39 void
40 Elf_syminfo_entry(Lm_list *lml, Word ndx, Syminfo *sip, const char *name,
41 const char *needed)
43 const char *bndstr = NULL, *str;
44 char flagstr[FLAGSZ], sndxstr[NDXSZ], dndxstr[NDXSZ];
45 int flgndx = 0;
46 Half flags = sip->si_flags;
48 if (flags & SYMINFO_FLG_CAP) {
49 bndstr = MSG_INTL(MSG_SYMINFO_CAP);
50 flagstr[flgndx++] = 'S';
51 flags &= ~SYMINFO_FLG_CAP;
54 if (flags & SYMINFO_FLG_DIRECT) {
55 if (bndstr == NULL) {
56 if (sip->si_boundto == SYMINFO_BT_SELF)
57 bndstr = MSG_INTL(MSG_SYMINFO_SELF);
58 else if (sip->si_boundto == SYMINFO_BT_PARENT)
59 bndstr = MSG_INTL(MSG_SYMINFO_PARENT);
60 else
61 bndstr = needed;
63 flagstr[flgndx++] = 'D';
64 flags &= ~SYMINFO_FLG_DIRECT;
66 } else if (flags & SYMINFO_FLG_FILTER) {
67 bndstr = needed;
68 flagstr[flgndx++] = 'F';
69 flags &= ~SYMINFO_FLG_FILTER;
71 } else if (flags & SYMINFO_FLG_AUXILIARY) {
72 bndstr = needed;
73 flagstr[flgndx++] = 'A';
74 flags &= ~SYMINFO_FLG_AUXILIARY;
76 } else if (sip->si_boundto == SYMINFO_BT_EXTERN)
77 bndstr = MSG_INTL(MSG_SYMINFO_EXTERN);
78 else if (bndstr == NULL)
79 bndstr = MSG_ORIG(MSG_STR_EMPTY);
81 if (flags & SYMINFO_FLG_DIRECTBIND) {
82 flagstr[flgndx++] = 'B';
83 flags &= ~SYMINFO_FLG_DIRECTBIND;
85 if (flags & SYMINFO_FLG_COPY) {
86 flagstr[flgndx++] = 'C';
87 flags &= ~SYMINFO_FLG_COPY;
89 if (flags & SYMINFO_FLG_LAZYLOAD) {
90 flagstr[flgndx++] = 'L';
91 flags &= ~SYMINFO_FLG_LAZYLOAD;
93 if (flags & SYMINFO_FLG_NOEXTDIRECT) {
94 flagstr[flgndx++] = 'N';
95 flags &= ~SYMINFO_FLG_NOEXTDIRECT;
97 if (flags & SYMINFO_FLG_INTERPOSE) {
98 flagstr[flgndx++] = 'I';
99 flags &= ~SYMINFO_FLG_INTERPOSE;
101 if (flags & SYMINFO_FLG_DEFERRED) {
102 flagstr[flgndx++] = 'P';
103 flags &= ~SYMINFO_FLG_DEFERRED;
107 * Did we account for all of the flags?
109 if (flags)
110 (void) snprintf(&flagstr[flgndx], FLAGSZ - flgndx,
111 MSG_ORIG(MSG_SYMINFO_UNKFLAG), flags);
112 else
113 flagstr[flgndx] = '\0';
116 * If we've bound to a dependency, determine the dynamic entry index.
118 if (bndstr == needed) {
119 (void) snprintf(dndxstr, NDXSZ, MSG_ORIG(MSG_FMT_INDEX),
120 sip->si_boundto);
121 str = dndxstr;
122 } else
123 str = MSG_ORIG(MSG_STR_EMPTY);
125 (void) snprintf(sndxstr, NDXSZ, MSG_ORIG(MSG_FMT_INDEX), ndx);
127 dbg_print(lml, MSG_INTL(MSG_SYMINFO_ENTRY), sndxstr, flagstr, str,
128 bndstr, Elf_demangle_name(name));