elf.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* String conversion routines for ELF header attributes.
*/
#include <stdio.h>
#include <string.h>
#include "_conv.h"
#include "elf_msg.h"
#include <sys/elf_SPARC.h>
};
const char *
{
if (class >= ELFCLASSNUM)
else
}
};
const char *
{
if (data >= ELFDATANUM)
else
}
};
const char *
{
/*
* #define trap. Each time the machines[] table is updated, make
* sure the following entry is updated.
*/
#error "EM_NUM has grown"
#endif
else
}
};
const char *
{
if (etype == ET_SUNWPSEUDO)
return (MSG_ORIG(MSG_ET_SUNWPSEUDO));
else
}
};
const char *
{
else
}
};
#define EFLAGSZ MSG_GBL_OSQBRKT_SIZE + \
/*
* Valid vendor extension bits for SPARCV9. This must be updated along with
* elf_SPARC.h.
*/
const char *
{
/*
* Make a string representation of the e_flags field. If any bogus
* bits are set, then just return a string containing the numeric value.
*/
if (mach == EM_SPARCV9) {
EF_SPARCV9_MM]));
_flags &= ~EF_SPARCV9_MM;
}
if (flags & EF_SPARC_32PLUS) {
_flags &= ~EF_SPARC_32PLUS;
}
if (flags & EF_SPARC_SUN_US1) {
_flags &= ~EF_SPARC_SUN_US1;
}
if (flags & EF_SPARC_HAL_R1) {
_flags &= ~EF_SPARC_HAL_R1;
}
if (flags & EF_SPARC_SUN_US3) {
_flags &= ~EF_SPARC_SUN_US3;
}
if (_flags)
} else
return (string);
}
/*
* A generic means of returning additional information for a rejected file in
* terms of a string.
*/
const char *
{
if (type == SGS_REJ_MACH)
/* LINTED */
else if (type == SGS_REJ_CLASS)
/* LINTED */
else if (type == SGS_REJ_DATA)
/* LINTED */
else if (type == SGS_REJ_TYPE)
/* LINTED */
/*
* Only called from ld.so.1, thus M_MACH is hardcoded.
*/
else if (type == SGS_REJ_UNKFILE)
return ((const char *)0);
else
return (MSG_ORIG(MSG_STR_EMPTY));
} else
}