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/*
f441771b0ce9f9d6122d318ff8290cb1a2848f9dRod Evans * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
5aefb6555731130ca4fd295960123d71f2d21fe8rie */
5aefb6555731130ca4fd295960123d71f2d21fe8rie#include <sgs.h>
a194faf8907a6722dcf10ad16c6ca72c9b7bd0barie#include <stdio.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{
08278a5e91755ccdb5850c19d21d42fb2e16b50eRod Evans const char *bndstr = NULL, *str;
5aefb6555731130ca4fd295960123d71f2d21fe8rie char flagstr[FLAGSZ], sndxstr[NDXSZ], dndxstr[NDXSZ];
5aefb6555731130ca4fd295960123d71f2d21fe8rie int flgndx = 0;
5aefb6555731130ca4fd295960123d71f2d21fe8rie Half flags = sip->si_flags;
5aefb6555731130ca4fd295960123d71f2d21fe8rie
08278a5e91755ccdb5850c19d21d42fb2e16b50eRod Evans if (flags & SYMINFO_FLG_CAP) {
08278a5e91755ccdb5850c19d21d42fb2e16b50eRod Evans bndstr = MSG_INTL(MSG_SYMINFO_CAP);
08278a5e91755ccdb5850c19d21d42fb2e16b50eRod Evans flagstr[flgndx++] = 'S';
08278a5e91755ccdb5850c19d21d42fb2e16b50eRod Evans flags &= ~SYMINFO_FLG_CAP;
08278a5e91755ccdb5850c19d21d42fb2e16b50eRod Evans }
5aefb6555731130ca4fd295960123d71f2d21fe8rie
08278a5e91755ccdb5850c19d21d42fb2e16b50eRod Evans if (flags & SYMINFO_FLG_DIRECT) {
08278a5e91755ccdb5850c19d21d42fb2e16b50eRod Evans if (bndstr == NULL) {
08278a5e91755ccdb5850c19d21d42fb2e16b50eRod Evans if (sip->si_boundto == SYMINFO_BT_SELF)
08278a5e91755ccdb5850c19d21d42fb2e16b50eRod Evans bndstr = MSG_INTL(MSG_SYMINFO_SELF);
08278a5e91755ccdb5850c19d21d42fb2e16b50eRod Evans else if (sip->si_boundto == SYMINFO_BT_PARENT)
08278a5e91755ccdb5850c19d21d42fb2e16b50eRod Evans bndstr = MSG_INTL(MSG_SYMINFO_PARENT);
08278a5e91755ccdb5850c19d21d42fb2e16b50eRod Evans else
08278a5e91755ccdb5850c19d21d42fb2e16b50eRod Evans bndstr = needed;
08278a5e91755ccdb5850c19d21d42fb2e16b50eRod Evans }
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);
08278a5e91755ccdb5850c19d21d42fb2e16b50eRod Evans else if (bndstr == NULL)
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 }
9a411307f0d1eedbc81618ec290e0685284d8a2brie if (flags & SYMINFO_FLG_INTERPOSE) {
9a411307f0d1eedbc81618ec290e0685284d8a2brie flagstr[flgndx++] = 'I';
9a411307f0d1eedbc81618ec290e0685284d8a2brie flags &= ~SYMINFO_FLG_INTERPOSE;
9a411307f0d1eedbc81618ec290e0685284d8a2brie }
f441771b0ce9f9d6122d318ff8290cb1a2848f9dRod Evans if (flags & SYMINFO_FLG_DEFERRED) {
f441771b0ce9f9d6122d318ff8290cb1a2848f9dRod Evans flagstr[flgndx++] = 'P';
f441771b0ce9f9d6122d318ff8290cb1a2848f9dRod Evans flags &= ~SYMINFO_FLG_DEFERRED;
f441771b0ce9f9d6122d318ff8290cb1a2848f9dRod Evans }
5aefb6555731130ca4fd295960123d71f2d21fe8rie
5aefb6555731130ca4fd295960123d71f2d21fe8rie /*
5aefb6555731130ca4fd295960123d71f2d21fe8rie * Did we account for all of the flags?
5aefb6555731130ca4fd295960123d71f2d21fe8rie */
5aefb6555731130ca4fd295960123d71f2d21fe8rie if (flags)
9a411307f0d1eedbc81618ec290e0685284d8a2brie (void) snprintf(&flagstr[flgndx], FLAGSZ - flgndx,
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}