reloc.h revision c2e7b48d563d0e56b74d853118918af352e75cbb
/*
* 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.
*/
#ifndef _RELOC_DOT_H
#define _RELOC_DOT_H
#pragma ident "%Z%%M% %I% %E% SMI"
#if defined(_KERNEL)
#include <sys/bootconf.h>
#include <sys/kobj_impl.h>
#else
#include <machdep.h>
#endif /* _KERNEL */
#include <relmach.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Global include file for relocation common code.
*
* Flags for reloc_entry->re_flags
*/
#define FLG_RE_NOTREL 0x00000000
#define FLG_RE_PCREL 0x00000010
#define FLG_RE_PLTREL 0x00000020
/* required for non-fixed */
/* objects */
/* a REGISTER by OLO10 */
/* r_offset to value */
/* value (IA64) */
/* locally */
/*
* Macros for testing relocation table flags
*/
extern const Rel_entry reloc_table[];
FLG_RE_PLTREL) != 0)
FLG_RE_GOTADD) != 0)
FLG_RE_GOTPC) != 0)
(FLG_RE_GOTPC | FLG_RE_GOTADD)) == \
FLG_RE_GOTREL) != 0)
FLG_RE_GOTOPINS) != 0)
FLG_RE_PCREL) != 0)
FLG_RE_ADDRELATIVE) != 0)
FLG_RE_REGISTER) != 0)
FLG_RE_FRMOFF) != 0)
FLG_RE_NOTSUP) != 0)
FLG_RE_SEGREL) != 0)
FLG_RE_EXTOFFSET) != 0)
FLG_RE_SECREL) != 0)
FLG_RE_TLSINS) != 0)
FLG_RE_TLSGD) != 0)
FLG_RE_TLSLD) != 0)
FLG_RE_TLSIE) != 0)
FLG_RE_TLSLE) != 0)
FLG_RE_TLSLE)) != 0)
FLG_RE_LOCLBND) != 0)
/*
* Functions.
*/
const char *, const char *);
const char *, const char *);
#endif
/*
* NOTE - this CONVRELOC macro is only used
* in the REL_ERR_NOFIT() macro below. For Intel
* this macro is only referenced from the amd64 side - it's
* not relevant for i386. So - we just define AMD64 for i386
* and sparc is sparc.
*/
#define CONVRELOC conv_reloc_amd64_type_str
#define CONVRELOC conv_reloc_SPARC_type_str
#else
#endif
#if defined(_KERNEL)
/*
* These are macro's that are only needed for krtld. Many of these
* ld and rtld
*/
/*
* This converts the sgs eprintf() routine into the _printf()
* as used by krtld.
*/
#define eprintf _kobj_printf
/*
* Message strings used by doreloc()
*/
#define MSG_ORIG(x) x
#define MSG_INTL(x) x
#define MSG_STR_UNKNOWN "(unknown)"
#define MSG_REL_UNSUPSZ "relocation error: %s: file %s: symbol %s: " \
"offset size (%d bytes) is not supported"
#define MSG_REL_ERR_STR "relocation error: %s:"
#define MSG_REL_ERR_WITH_FILE "relocation error: file %s: "
#define MSG_REL_ERR_FILE " file %s: "
#define MSG_REL_ERR_SYM " symbol %s: "
#define MSG_REL_ERR_VALUE " value 0x%llx"
#define MSG_REL_ERR_OFF " offset 0x%llx\n"
#define MSG_REL_UNIMPL " unimplemented relocation type: %d"
#define MSG_REL_NONALIGN " offset 0x%llx is non-aligned\n"
#define MSG_REL_UNNOBITS " unsupported number of bits: %d"
#define MSG_REL_NOFIT " value 0x%llx does not fit\n"
#define MSG_REL_LOSEBITS " loses %d bits at"
/*
* Note: Related to bug 4128755, dlerror() only keeps track
* of a single error string, and therefore must have errors
* reported through a single eprintf() call. The kernel's
* printf is somewhat more limited, and must receive messages
* with only one arguement to the format string. The following
* macros are to straighted all this out because krtld and
* rtld share do_reloc().
*/
(int)(rtype))
conv_reloc_SPARC_type_str((rtype))); \
conv_reloc_SPARC_type_str((rtype))); \
conv_reloc_SPARC_type_str((rtype))); \
#else /* !_KERNEL */
extern const char *demangle(const char *);
(int)(rtype)))
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _RELOC_DOT_H */