dynamic.c revision f441771b0ce9f9d6122d318ff8290cb1a2848f9d
/*
* 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
*/
/*
*/
/*
* 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"
const Val_desc *
{
#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.
*/
#define REPORT_BUFSIZE POSSZ
#include "report_bufsize.h"
#error "CONV_DYN_POSFLAG1_BUFSIZE does not match POSSZ"
#endif
{ 0, 0 }
};
{ 0, 0 }
};
{ 0, 0 }
};
{ 0, 0 }
};
switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
case CONV_FMT_ALT_DUMP:
case CONV_FMT_ALT_CFNP:
return (vda_cfnp);
case CONV_FMT_ALT_CF:
return (vda_cf);
case CONV_FMT_ALT_NF:
return (vda_nf);
}
return (vda_def);
}
void *uvalue)
{
}
const Val_desc *
{
#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.
*/
#define REPORT_BUFSIZE FLAGSZ
#include "report_bufsize.h"
#error "CONV_DYN_FLAG_BUFSIZE does not match FLAGSZ"
#endif
{ DF_ORIGIN, MSG_DF_ORIGIN_CF },
{ DF_TEXTREL, MSG_DF_TEXTREL_CF },
{ 0 }
};
{ DF_ORIGIN, MSG_DF_ORIGIN_CFNP },
{ 0 }
};
{ DF_ORIGIN, MSG_DF_ORIGIN_NF },
{ DF_TEXTREL, MSG_DF_TEXTREL_NF },
{ 0 }
};
switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
case CONV_FMT_ALT_CF:
return (vda_cf);
case CONV_FMT_ALT_NF:
return (vda_nf);
}
return (vda_cfnp);
}
void *uvalue)
{
}
const Val_desc *
{
#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.
*/
#define REPORT_BUFSIZE FLAG1SZ
#include "report_bufsize.h"
#error "CONV_DYN_FLAG1_BUFSIZE does not match FLAG1SZ"
#endif
{ DF_1_NOW, MSG_DF_1_NOW_CFNP },
{ 0, 0 }
};
{ DF_1_NOW, MSG_DF_1_NOW_CF },
{ DF_1_GROUP, MSG_DF_1_GROUP_CF },
{ DF_1_TRANS, MSG_DF_1_TRANS_CF },
{ DF_1_NOHDR, MSG_DF_1_NOHDR_CF },
{ 0, 0 }
};
{ DF_1_NOW, MSG_DF_1_NOW_CFNP },
{ 0, 0 }
};
{ DF_1_NOW, MSG_DF_1_NOW_NF },
{ DF_1_GROUP, MSG_DF_1_GROUP_NF },
{ DF_1_TRANS, MSG_DF_1_TRANS_NF },
{ DF_1_NOHDR, MSG_DF_1_NOHDR_NF },
{ 0, 0 }
};
switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
case CONV_FMT_ALT_CF:
return (vda_cf);
case CONV_FMT_ALT_CFNP:
return (vda_cfnp);
case CONV_FMT_ALT_NF:
return (vda_nf);
}
return (vda_def);
}
void *uvalue)
{
}
const Val_desc *
{
#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.
*/
#define REPORT_BUFSIZE FEATSZ
#include "report_bufsize.h"
#error "CONV_DYN_FEATURE1_BUFSIZE does not match FEATSZ"
#endif
{ 0, 0 }
};
{ 0, 0 }
};
{ 0, 0 }
};
switch (CONV_TYPE_FMT_ALT(fmt_flags)) {
case CONV_FMT_ALT_CF:
return (vda_cf);
case CONV_FMT_ALT_NF:
return (vda_nf);
}
return (vda_cfnp);
}
void *uvalue)
{
}
const conv_ds_t **
{
/*
* Maximum # of items that can be in the returned array. Size this
* by counting the maximum depth in the switch statement that fills
* retarr at the end of this function.
*/
#define MAX_RET 12
/*
* Generic dynamic tags:
* - Note hole between DT_FLAGS and DT_PREINIT_ARRAY (tag 32).
* We use a 0, which is the signal for "not defined".
* - This range has alternative names for dump, requiring an
* additional array.
*/
static const Msg tags_null_cf[] = {
MSG_DT_FLAGS_CF, 0,
};
static const Msg tags_null_cfnp[] = {
};
static const Msg tags_null_nf[] = {
MSG_DT_FLAGS_NF, 0,
};
static const Msg tags_null_dmp[] = {
};
static const conv_ds_msg_t ds_null_cf = {
static const conv_ds_msg_t ds_null_cfnp = {
static const conv_ds_msg_t ds_null_nf = {
static const conv_ds_msg_t ds_null_dmp = {
/*
* DT_SPARC_REGISTER was originally assigned 0x7000001. It is processor
* specific, and should have been in the range DT_LOPROC-DT_HIPROC
* instead of here. When the error was fixed,
* DT_DEPRECATED_SPARC_REGISTER was created to maintain backward
* compatability.
*/
static const Msg tags_sdreg_cf[] = {
static const Msg tags_sdreg_cfnp[] = {
static const Msg tags_sdreg_nf[] = {
static const conv_ds_msg_t ds_sdreg_cf = {
static const conv_ds_msg_t ds_sdreg_cfnp = {
static const conv_ds_msg_t ds_sdreg_nf = {
/*
* SUNW: DT_LOOS -> DT_HIOS range. Note holes between DT_SUNW_TLSSORTSZ,
* DT_SUNW_STRPAD, and DT_SUNW_LDMACH. We handle the outliers
* separately below as single values.
*/
static const Msg tags_sunw_auxiliary_cf[] = {
};
static const Msg tags_sunw_auxiliary_cfnp[] = {
};
static const Msg tags_sunw_auxiliary_nf[] = {
};
static const conv_ds_msg_t ds_sunw_auxiliary_cf = {
static const conv_ds_msg_t ds_sunw_auxiliary_cfnp = {
static const conv_ds_msg_t ds_sunw_auxiliary_nf = {
/*
* GNU: (In DT_VALRNGLO section) DT_GNU_PRELINKED - DT_GNU_LIBLISTSZ
*/
static const Msg tags_gnu_prelinked_cf[] = {
};
static const Msg tags_gnu_prelinked_cfnp[] = {
};
static const Msg tags_gnu_prelinked_nf[] = {
};
static const conv_ds_msg_t ds_gnu_prelinked_cf = {
static const conv_ds_msg_t ds_gnu_prelinked_cfnp = {
static const conv_ds_msg_t ds_gnu_prelinked_nf = {
/*
* SUNW: DT_VALRNGLO - DT_VALRNGHI range.
*/
static const Msg tags_checksum_cf[] = {
};
static const Msg tags_checksum_cfnp[] = {
};
static const Msg tags_checksum_nf[] = {
};
static const conv_ds_msg_t ds_checksum_cf = {
static const conv_ds_msg_t ds_checksum_cfnp = {
static const conv_ds_msg_t ds_checksum_nf = {
/*
* GNU: (In DT_ADDRRNGLO section) DT_GNU_HASH - DT_GNU_LIBLIST
*/
static const Msg tags_gnu_hash_cf[] = {
};
static const Msg tags_gnu_hash_cfnp[] = {
};
static const Msg tags_gnu_hash_nf[] = {
};
static const conv_ds_msg_t ds_gnu_hash_cf = {
static const conv_ds_msg_t ds_gnu_hash_cfnp = {
static const conv_ds_msg_t ds_gnu_hash_nf = {
/*
* SUNW: DT_ADDRRNGLO - DT_ADDRRNGHI range.
*/
static const Msg tags_config_cf[] = {
};
static const Msg tags_config_cfnp[] = {
};
static const Msg tags_config_nf[] = {
};
static const conv_ds_msg_t ds_config_cf = {
static const conv_ds_msg_t ds_config_cfnp = {
static const conv_ds_msg_t ds_config_nf = {
/*
* SUNW: generic range. Note hole between DT_VERSYM and DT_RELACOUNT.
*/
static const conv_ds_msg_t ds_versym_cf = {
static const conv_ds_msg_t ds_versym_cfnp = {
static const conv_ds_msg_t ds_versym_nf = {
static const Msg tags_relacount_cf[] = {
};
static const Msg tags_relacount_cfnp[] = {
};
static const Msg tags_relacount_nf[] = {
};
static const conv_ds_msg_t ds_relacount_cf = {
static const conv_ds_msg_t ds_relacount_cfnp = {
static const conv_ds_msg_t ds_relacount_nf = {
/*
* DT_LOPROC - DT_HIPROC range: solaris/sparc-only
*/
static const conv_ds_msg_t ds_sparc_reg_cf = {
static const conv_ds_msg_t ds_sparc_reg_cfnp = {
static const conv_ds_msg_t ds_sparc_reg_nf = {
static const conv_ds_msg_t ds_sparc_reg_dmp = {
/*
* DT_LOPROC - DT_HIPROC range: Solaris osabi, all hardware
*/
static const Msg tags_auxiliary_cf[] = {
};
static const Msg tags_auxiliary_cfnp[] = {
};
static const Msg tags_auxiliary_nf[] = {
};
static const conv_ds_msg_t ds_auxiliary_cf = {
static const conv_ds_msg_t ds_auxiliary_cfnp = {
static const conv_ds_msg_t ds_auxiliary_nf = {
int ndx = 0;
/*
* Fill in retarr with the descriptors for the messages that
* apply to the current osabi. Note that we order these items such
* that the more common are placed at the beginning, and the less
* likely at the end. This should speed the common case.
*
* Note that the CFNP and DMP styles are very similar, so they
* are combined in 'default', and fmt_osabi is consulted when there
* are differences.
*/
switch (fmt_osabi) {
case CONV_FMT_ALT_CF:
if (osabi_solaris)
if (osabi_solaris) {
if (mach_sparc) {
}
}
if (osabi_linux) {
}
break;
case CONV_FMT_ALT_NF:
if (osabi_solaris)
if (osabi_solaris) {
if (mach_sparc) {
}
}
if (osabi_linux) {
}
break;
default:
/*
* The default style for the generic range is CFNP,
* while dump has a couple of different strings.
*/
if (osabi_solaris)
if (osabi_solaris) {
if (mach_sparc) {
/*
* The default style for DT_SPARC_REGISTER
* is the dump style, which omits the 'SPARC_'.
* CFNP keeps the prefix.
*/
(fmt_osabi == CONV_FMT_ALT_CFNP) ?
}
}
if (osabi_linux) {
}
break;
}
return (retarr);
}
{
}
#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.
*/
#define REPORT_BUFSIZE BINDTSZ
#include "report_bufsize.h"
#error "CONV_BND_TYPE_BUFSIZE does not match BINDTSZ"
#endif
const char *
{
{ BND_NEEDED, MSG_BND_NEEDED },
{ BND_REFER, MSG_BND_REFER },
{ BND_FILTER, MSG_BND_FILTER },
{ 0, 0 }
};
static CONV_EXPN_FIELD_ARG conv_arg = {
if (flags == 0)
return (MSG_ORIG(MSG_STR_EMPTY));
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.
*/
#define REPORT_BUFSIZE BINDOSZ
#include "report_bufsize.h"
#error "CONV_BND_OBJ_BUFSIZE does not match BINDOSZ"
#endif
const char *
{
{ LML_FLG_ATEXIT, MSG_BND_ATEXIT },
{ 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.
*/
return ((const char *)bnd_obj_buf->buf);
}