syminfo.c revision 5aefb6555731130ca4fd295960123d71f2d21fe8
5aefb6555731130ca4fd295960123d71f2d21fe8rie/*
5aefb6555731130ca4fd295960123d71f2d21fe8rie * CDDL HEADER START
5aefb6555731130ca4fd295960123d71f2d21fe8rie *
5aefb6555731130ca4fd295960123d71f2d21fe8rie * The contents of this file are subject to the terms of the
5aefb6555731130ca4fd295960123d71f2d21fe8rie * Common Development and Distribution License (the "License").
5aefb6555731130ca4fd295960123d71f2d21fe8rie * You may not use this file except in compliance with the License.
5aefb6555731130ca4fd295960123d71f2d21fe8rie *
5aefb6555731130ca4fd295960123d71f2d21fe8rie * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
5aefb6555731130ca4fd295960123d71f2d21fe8rie * or http://www.opensolaris.org/os/licensing.
5aefb6555731130ca4fd295960123d71f2d21fe8rie * See the License for the specific language governing permissions
5aefb6555731130ca4fd295960123d71f2d21fe8rie * and limitations under the License.
5aefb6555731130ca4fd295960123d71f2d21fe8rie *
5aefb6555731130ca4fd295960123d71f2d21fe8rie * When distributing Covered Code, include this CDDL HEADER in each
5aefb6555731130ca4fd295960123d71f2d21fe8rie * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
5aefb6555731130ca4fd295960123d71f2d21fe8rie * If applicable, add the following below this CDDL HEADER, with the
5aefb6555731130ca4fd295960123d71f2d21fe8rie * fields enclosed by brackets "[]" replaced with your own identifying
5aefb6555731130ca4fd295960123d71f2d21fe8rie * information: Portions Copyright [yyyy] [name of copyright owner]
5aefb6555731130ca4fd295960123d71f2d21fe8rie *
5aefb6555731130ca4fd295960123d71f2d21fe8rie * CDDL HEADER END
5aefb6555731130ca4fd295960123d71f2d21fe8rie */
5aefb6555731130ca4fd295960123d71f2d21fe8rie
5aefb6555731130ca4fd295960123d71f2d21fe8rie/*
5aefb6555731130ca4fd295960123d71f2d21fe8rie * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5aefb6555731130ca4fd295960123d71f2d21fe8rie * Use is subject to license terms.
5aefb6555731130ca4fd295960123d71f2d21fe8rie */
5aefb6555731130ca4fd295960123d71f2d21fe8rie#pragma ident "%Z%%M% %I% %E% SMI"
5aefb6555731130ca4fd295960123d71f2d21fe8rie
5aefb6555731130ca4fd295960123d71f2d21fe8rie#include <sgs.h>
5aefb6555731130ca4fd295960123d71f2d21fe8rie#include <debug.h>
5aefb6555731130ca4fd295960123d71f2d21fe8rie#include <msg.h>
5aefb6555731130ca4fd295960123d71f2d21fe8rie
5aefb6555731130ca4fd295960123d71f2d21fe8rievoid
5aefb6555731130ca4fd295960123d71f2d21fe8rieElf_syminfo_title(Lm_list *lml)
5aefb6555731130ca4fd295960123d71f2d21fe8rie{
5aefb6555731130ca4fd295960123d71f2d21fe8rie dbg_print(lml, MSG_INTL(MSG_SYMINFO_TITLE));
5aefb6555731130ca4fd295960123d71f2d21fe8rie}
5aefb6555731130ca4fd295960123d71f2d21fe8rie
5aefb6555731130ca4fd295960123d71f2d21fe8rie#define FLAGSZ 16
5aefb6555731130ca4fd295960123d71f2d21fe8rie#define NDXSZ 10
5aefb6555731130ca4fd295960123d71f2d21fe8rie
5aefb6555731130ca4fd295960123d71f2d21fe8rievoid
5aefb6555731130ca4fd295960123d71f2d21fe8rieElf_syminfo_entry(Lm_list *lml, Word ndx, Syminfo *sip, const char *name,
5aefb6555731130ca4fd295960123d71f2d21fe8rie const char *needed)
5aefb6555731130ca4fd295960123d71f2d21fe8rie{
5aefb6555731130ca4fd295960123d71f2d21fe8rie const char *bndstr, *str;
5aefb6555731130ca4fd295960123d71f2d21fe8rie char flagstr[FLAGSZ], sndxstr[NDXSZ], dndxstr[NDXSZ];
5aefb6555731130ca4fd295960123d71f2d21fe8rie int flgndx = 0;
5aefb6555731130ca4fd295960123d71f2d21fe8rie Half flags = sip->si_flags;
5aefb6555731130ca4fd295960123d71f2d21fe8rie
5aefb6555731130ca4fd295960123d71f2d21fe8rie if (flags & SYMINFO_FLG_DIRECT) {
5aefb6555731130ca4fd295960123d71f2d21fe8rie if (sip->si_boundto == SYMINFO_BT_SELF)
5aefb6555731130ca4fd295960123d71f2d21fe8rie bndstr = MSG_INTL(MSG_SYMINFO_SELF);
5aefb6555731130ca4fd295960123d71f2d21fe8rie else if (sip->si_boundto == SYMINFO_BT_PARENT)
5aefb6555731130ca4fd295960123d71f2d21fe8rie bndstr = MSG_INTL(MSG_SYMINFO_PARENT);
5aefb6555731130ca4fd295960123d71f2d21fe8rie else
5aefb6555731130ca4fd295960123d71f2d21fe8rie bndstr = needed;
5aefb6555731130ca4fd295960123d71f2d21fe8rie
5aefb6555731130ca4fd295960123d71f2d21fe8rie flagstr[flgndx++] = 'D';
5aefb6555731130ca4fd295960123d71f2d21fe8rie flags &= ~SYMINFO_FLG_DIRECT;
5aefb6555731130ca4fd295960123d71f2d21fe8rie
5aefb6555731130ca4fd295960123d71f2d21fe8rie } else if (flags & SYMINFO_FLG_FILTER) {
5aefb6555731130ca4fd295960123d71f2d21fe8rie bndstr = needed;
5aefb6555731130ca4fd295960123d71f2d21fe8rie flagstr[flgndx++] = 'F';
5aefb6555731130ca4fd295960123d71f2d21fe8rie flags &= ~SYMINFO_FLG_FILTER;
5aefb6555731130ca4fd295960123d71f2d21fe8rie
5aefb6555731130ca4fd295960123d71f2d21fe8rie } else if (flags & SYMINFO_FLG_AUXILIARY) {
5aefb6555731130ca4fd295960123d71f2d21fe8rie bndstr = needed;
5aefb6555731130ca4fd295960123d71f2d21fe8rie flagstr[flgndx++] = 'A';
5aefb6555731130ca4fd295960123d71f2d21fe8rie flags &= ~SYMINFO_FLG_AUXILIARY;
5aefb6555731130ca4fd295960123d71f2d21fe8rie
5aefb6555731130ca4fd295960123d71f2d21fe8rie } else if (sip->si_boundto == SYMINFO_BT_EXTERN)
5aefb6555731130ca4fd295960123d71f2d21fe8rie bndstr = MSG_INTL(MSG_SYMINFO_EXTERN);
5aefb6555731130ca4fd295960123d71f2d21fe8rie else
5aefb6555731130ca4fd295960123d71f2d21fe8rie bndstr = MSG_ORIG(MSG_STR_EMPTY);
5aefb6555731130ca4fd295960123d71f2d21fe8rie
5aefb6555731130ca4fd295960123d71f2d21fe8rie if (flags & SYMINFO_FLG_DIRECTBIND) {
5aefb6555731130ca4fd295960123d71f2d21fe8rie flagstr[flgndx++] = 'B';
5aefb6555731130ca4fd295960123d71f2d21fe8rie flags &= ~SYMINFO_FLG_DIRECTBIND;
5aefb6555731130ca4fd295960123d71f2d21fe8rie }
5aefb6555731130ca4fd295960123d71f2d21fe8rie if (flags & SYMINFO_FLG_COPY) {
5aefb6555731130ca4fd295960123d71f2d21fe8rie flagstr[flgndx++] = 'C';
5aefb6555731130ca4fd295960123d71f2d21fe8rie flags &= ~SYMINFO_FLG_COPY;
5aefb6555731130ca4fd295960123d71f2d21fe8rie }
5aefb6555731130ca4fd295960123d71f2d21fe8rie if (flags & SYMINFO_FLG_LAZYLOAD) {
5aefb6555731130ca4fd295960123d71f2d21fe8rie flagstr[flgndx++] = 'L';
5aefb6555731130ca4fd295960123d71f2d21fe8rie flags &= ~SYMINFO_FLG_LAZYLOAD;
5aefb6555731130ca4fd295960123d71f2d21fe8rie }
5aefb6555731130ca4fd295960123d71f2d21fe8rie if (flags & SYMINFO_FLG_NOEXTDIRECT) {
5aefb6555731130ca4fd295960123d71f2d21fe8rie flagstr[flgndx++] = 'N';
5aefb6555731130ca4fd295960123d71f2d21fe8rie flags &= ~SYMINFO_FLG_NOEXTDIRECT;
5aefb6555731130ca4fd295960123d71f2d21fe8rie }
5aefb6555731130ca4fd295960123d71f2d21fe8rie
5aefb6555731130ca4fd295960123d71f2d21fe8rie /*
5aefb6555731130ca4fd295960123d71f2d21fe8rie * Did we account for all of the flags?
5aefb6555731130ca4fd295960123d71f2d21fe8rie */
5aefb6555731130ca4fd295960123d71f2d21fe8rie if (flags)
5aefb6555731130ca4fd295960123d71f2d21fe8rie (void) snprintf(&flagstr[flgndx], FLAGSZ - ndx,
5aefb6555731130ca4fd295960123d71f2d21fe8rie MSG_ORIG(MSG_SYMINFO_UNKFLAG), flags);
5aefb6555731130ca4fd295960123d71f2d21fe8rie else
5aefb6555731130ca4fd295960123d71f2d21fe8rie flagstr[flgndx] = '\0';
5aefb6555731130ca4fd295960123d71f2d21fe8rie
5aefb6555731130ca4fd295960123d71f2d21fe8rie /*
5aefb6555731130ca4fd295960123d71f2d21fe8rie * If we've bound to a dependency, determine the dynamic entry index.
5aefb6555731130ca4fd295960123d71f2d21fe8rie */
5aefb6555731130ca4fd295960123d71f2d21fe8rie if (bndstr == needed) {
5aefb6555731130ca4fd295960123d71f2d21fe8rie (void) snprintf(dndxstr, NDXSZ, MSG_ORIG(MSG_FMT_INDEX),
5aefb6555731130ca4fd295960123d71f2d21fe8rie sip->si_boundto);
5aefb6555731130ca4fd295960123d71f2d21fe8rie str = dndxstr;
5aefb6555731130ca4fd295960123d71f2d21fe8rie } else
5aefb6555731130ca4fd295960123d71f2d21fe8rie str = MSG_ORIG(MSG_STR_EMPTY);
5aefb6555731130ca4fd295960123d71f2d21fe8rie
5aefb6555731130ca4fd295960123d71f2d21fe8rie (void) snprintf(sndxstr, NDXSZ, MSG_ORIG(MSG_FMT_INDEX), ndx);
5aefb6555731130ca4fd295960123d71f2d21fe8rie
5aefb6555731130ca4fd295960123d71f2d21fe8rie dbg_print(lml, MSG_INTL(MSG_SYMINFO_ENTRY), sndxstr, flagstr, str,
5aefb6555731130ca4fd295960123d71f2d21fe8rie bndstr, Elf_demangle_name(name));
5aefb6555731130ca4fd295960123d71f2d21fe8rie}