reloc.h revision 2926dd2e801916128855cec712d18656be9bd1c5
/*
* 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 2006 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>
#include <rtld.h>
#include <conv.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 */
/* locally */
/*
* In user land, redefine the relocation table and relocation engine to be
* class specific if necessary. This allows both engines to reside in the
*/
#if !defined(_KERNEL)
#if defined(_ELF64)
#define do_reloc do64_reloc
#define reloc_table reloc64_table
#else
#define do_reloc do32_reloc
#define reloc_table reloc32_table
#endif
#endif
/*
* Relocation table and 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_GOTADD | FLG_RE_GOTREL | \
FLG_RE_GOTPC | FLG_RE_GOTOPINS)) != 0)
FLG_RE_PCREL) != 0)
FLG_RE_ADDRELATIVE) != 0)
FLG_RE_REGISTER) != 0)
FLG_RE_NOTSUP) != 0)
FLG_RE_SEGREL) != 0)
FLG_RE_EXTOFFSET) != 0)
FLG_RE_SECREL) != 0)
(FLG_RE_TLSGD | FLG_RE_TLSLD | \
FLG_RE_TLSIE | FLG_RE_TLSLE)) != 0)
FLG_RE_TLSGD) != 0)
FLG_RE_TLSLD) != 0)
FLG_RE_TLSIE) != 0)
FLG_RE_TLSLE) != 0)
FLG_RE_LOCLBND) != 0)
FLG_RE_SIZE) != 0)
/*
* Relocation engine.
*/
const char *, void *);
#if defined(_KERNEL)
/*
* These are macro's that are only needed for krtld. Many of these are already
*/
/*
* Message strings used by doreloc().
*/
#define MSG_STR_UNKNOWN "(unknown)"
#define MSG_REL_PREGEN "relocation error: %s: "
#define MSG_REL_PREFIL "relocation error: file %s: "
#define MSG_REL_FILE "file %s: "
#define MSG_REL_SYM "symbol %s: "
#define MSG_REL_VALUE "value 0x%llx "
#define MSG_REL_LOSEBITS "loses %d bits at "
#define MSG_REL_UNIMPL "unimplemented relocation type: %d"
#define MSG_REL_UNSUPSZ "offset size (%d bytes) is not supported"
#define MSG_REL_NONALIGN "offset 0x%llx is non-aligned"
#define MSG_REL_UNNOBITS "unsupported number of bits: %d"
#define MSG_REL_OFFSET "offset 0x%llx"
#define MSG_REL_NOFIT "value 0x%llx does not fit"
/*
* Provide a macro to select the appropriate conversion routine for this
* architecture.
*/
#if defined(__amd64)
extern const char *conv_reloc_amd64_type(Word);
#define CONV_RELOC_TYPE conv_reloc_amd64_type
extern const char *conv_reloc_386_type(Word);
#define CONV_RELOC_TYPE conv_reloc_386_type
extern const char *conv_reloc_SPARC_type(Word);
#define CONV_RELOC_TYPE conv_reloc_SPARC_type
#else
#endif
/*
* Note: dlerror() only keeps track of a single error string, and therefore
* must have errors reported through a single eprintf() call. The kernel's
* _kobj_printf is somewhat more limited, and must receive messages with only
* one argument to the format string. The following macros account for these
* differences, as krtld and rtld share do_reloc().
*/
#else /* !_KERNEL */
extern const char *demangle(const char *);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _RELOC_DOT_H */