dynamic.c revision d29b2c4438482eb00488be49a1f5d6835f455546
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* String conversion routine for .dynamic tag entries.
*/
#include <stdio.h>
#include <string.h>
#include <sys/elf_SPARC.h>
#include "rtld.h"
#include "_conv.h"
#include "dynamic_msg.h"
/* Instantiate a local copy of conv_map2str() from _conv.h */
#define POSSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
/*
* Ensure that Conv_dyn_posflag1_buf_t is large enough:
*
* POSSZ is the real minimum size of the buffer required by conv_dyn_posflag1().
* However, Conv_dyn_posflag1_buf_t uses CONV_DYN_POSFLAG1_BUFSIZE to set the
* buffer size. We do things this way because the definition of POSSZ uses
* information that is not available in the environment of other programs
* that include the conv.h header file.
*/
#error "CONV_DYN_POSFLAG1_BUFSIZE is not large enough"
#endif
const char *
{
{ 0, 0 }
};
static CONV_EXPN_FIELD_ARG conv_arg = {
{ 0, 0 }
};
static CONV_EXPN_FIELD_ARG conv_arg_alt = {
if (flags == 0)
return (MSG_ORIG(MSG_GBL_ZERO));
&conv_arg_alt : &conv_arg;
return ((const char *)dyn_posflag1_buf);
}
#define FLAGSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
/*
* Ensure that Conv_dyn_flag_buf_t is large enough:
*
* FLAGSZ is the real minimum size of the buffer required by conv_dyn_flag().
* However, Conv_dyn_flag_buf_t uses CONV_DYN_FLAG_BUFSIZE to set the
* buffer size. We do things this way because the definition of FLAGSZ uses
* information that is not available in the environment of other programs
* that include the conv.h header file.
*/
#if CONV_DYN_FLAG_BUFSIZE < FLAGSZ
#error "CONV_DYN_FLAG_BUFSIZE is not large enough"
#endif
const char *
{
{ 0, 0 }
};
static CONV_EXPN_FIELD_ARG conv_arg = {
if (flags == 0)
return (MSG_ORIG(MSG_GBL_ZERO));
} else {
}
return ((const char *)dyn_flag_buf->buf);
}
#define FLAG1SZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
/*
* Ensure that Conv_dyn_flag1_buf_t is large enough:
*
* FLAG1SZ is the real minimum size of the buffer required by conv_dyn_flag1().
* However, Conv_dyn_flag1_buf_t uses CONV_DYN_FLAG1_BUFSIZE to set the
* buffer size. We do things this way because the definition of FLAG1SZ uses
* information that is not available in the environment of other programs
* that include the conv.h header file.
*/
#error "CONV_DYN_FLAG1_BUFSIZE is not large enough"
#endif
const char *
{
{ 0, 0 }
};
static CONV_EXPN_FIELD_ARG conv_arg = {
if (flags == 0)
return (MSG_ORIG(MSG_GBL_ZERO));
return ((const char *)dyn_flag1_buf->buf);
}
#define FEATSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
/*
* Ensure that Conv_dyn_feature1_buf_t is large enough:
*
* FEATSZ is the real min size of the buffer required by conv_dyn_feature1().
* However, Conv_dyn_feature1_buf_t uses CONV_DYN_FEATURE1_BUFSIZE to set the
* buffer size. We do things this way because the definition of FEATSZ uses
* information that is not available in the environment of other programs
* that include the conv.h header file.
*/
#error "CONV_DYN_FEATURE1_BUFSIZE is not large enough"
#endif
const char *
{
{ 0, 0 }
};
static CONV_EXPN_FIELD_ARG conv_arg = {
if (flags == 0)
return (MSG_ORIG(MSG_GBL_ZERO));
} else {
}
return ((const char *)dyn_feature1_buf->buf);
}
const char *
{
/*
* Dynamic tag values are sparse, cover a wide range, and have
* holes. To handle this efficiently, we fall through a series
* of tests below, in increasing tag order, returning at the first
* match.
*
* If we fall all the way to the end, the tag is unknown,
* and its numeric value is printed.
*/
/*
* Most of the tag values are clustered in contiguous ranges.
* Each contiguous range of defined values is handled with
* an array that contains the message index corresponding to
* each value in that range. The DYN_RANGE macro checks the
* tag value against range of values starting at _start_tag.
* If there is a match, the index of the appropriate name is
* pulled from _array and returned to the caller.
*/
/*
* Generic dynamic tags:
* - Note hole between DT_FLAGS and DT_PREINIT_ARRAY
* - The first range has alternative names for dump,
* requiring a second array.
*/
};
static const Msg tags_null_alt[] = {
};
static const Msg tags_preinit_array[] = {
};
/*
* SUNW: DT_LOOS -> DT_HIOS range. Note hole between DT_SUNW_TLSSORTSZ
* and DT_SUNW_STRPAD. We handle DT_SUNW_STRPAD as a single value below.
*/
static const Msg tags_sunw_auxiliary[] = {
};
/*
* SUNW: DT_VALRNGLO - DT_VALRNGHI range.
*/
static const Msg tags_checksum[] = {
};
/*
* SUNW: DT_ADDRRNGLO - DT_ADDRRNGHI range.
*/
static const Msg tags_config[] = {
};
/*
* SUNW: generic range. Note hole between DT_VERSYM and DT_RELACOUNT.
* We handle DT_VERSYM as a single value below.
*/
static const Msg tags_relacount[] = {
};
/*
* DT_LOPROC - DT_HIPROC range.
*/
static const Msg tags_auxiliary[] = {
};
/* use 'dump' style? */
/* Standard style */
}
if (tag == DT_SUNW_STRPAD)
return (MSG_ORIG(MSG_DYN_SUNW_STRPAD));
return (MSG_ORIG(MSG_DYN_VERSYM));
/*
* SUNW: machine specific range.
*/
/* this is so x86 can display a sparc binary */
return (MSG_ORIG(MSG_DYN_REGISTER));
if (tag == DT_DEPRECATED_SPARC_REGISTER)
return (MSG_ORIG(MSG_DYN_REGISTER));
/* Unknown item */
}
#define BINDTSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
/*
* Ensure that Conv_bnd_type_buf_t is large enough:
*
* BINDTSZ is the real minimum size of the buffer required by conv_bnd_type().
* However, Conv_bnd_type_buf_t uses CONV_BND_TYPE_BUFSIZE to set the
* buffer size. We do things this way because the definition of BINDTSZ uses
* information that is not available in the environment of other programs
* that include the conv.h header file.
*/
#if CONV_BND_TYPE_BUFSIZE < BINDTSZ
#error "CONV_BND_TYPE_BUFSIZE is not large enough"
#endif
const char *
{
{ 0, 0 }
};
static CONV_EXPN_FIELD_ARG conv_arg = {
if (flags == 0)
return (MSG_ORIG(MSG_STR_EMPTY));
(void) conv_expn_field(&conv_arg, 0);
return ((const char *)bnd_type_buf->buf);
}
/*
* Note, conv_bnd_obj() is called with either:
* LML_FLG_OBJADDED (possibly with LML_FLG_OBJREEVAL added), or
* LML_FLG_OBJDELETED, or
* LML_FLG_ATEXIT.
*/
#define BINDOSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
/*
* Ensure that Conv_bnd_obj_buf_t is large enough:
*
* BINDOSZ is the real minimum size of the buffer required by conv_bnd_obj().
* However, Conv_bnd_obj_buf_t uses CONV_BND_OBJ_BUFSIZE to set the
* buffer size. We do things this way because the definition of BINDOSZ uses
* information that is not available in the environment of other programs
* that include the conv.h header file.
*/
#if CONV_BND_OBJ_BUFSIZE < BINDOSZ
#error "CONV_BND_OBJ_BUFSIZE is not large enough"
#endif
const char *
{
{ 0, 0 }
};
static CONV_EXPN_FIELD_ARG conv_arg = {
LML_FLG_OBJDELETED | LML_FLG_ATEXIT)) == 0)
return (MSG_ORIG(MSG_BND_REVISIT));
/*
* Note, we're not worried about unknown flags for this family, only
* the selected flags are of interest, so we leave conv_arg.rflags
* set to 0.
*/
(void) conv_expn_field(&conv_arg, 0);
return ((const char *)bnd_obj_buf->buf);
}