xref: /titanic_54/usr/src/uts/common/krtld/reloc.h (revision c2e7b48d563d0e56b74d853118918af352e75cbb)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
23*c2e7b48dSkalai  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef	_RELOC_DOT_H
287c478bd9Sstevel@tonic-gate #define	_RELOC_DOT_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #if defined(_KERNEL)
337c478bd9Sstevel@tonic-gate #include <sys/machelf.h>
347c478bd9Sstevel@tonic-gate #include <sys/bootconf.h>
357c478bd9Sstevel@tonic-gate #include <sys/kobj.h>
367c478bd9Sstevel@tonic-gate #include <sys/kobj_impl.h>
377c478bd9Sstevel@tonic-gate #else
387c478bd9Sstevel@tonic-gate #include <machdep.h>
397c478bd9Sstevel@tonic-gate #endif /* _KERNEL */
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #include <relmach.h>
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
447c478bd9Sstevel@tonic-gate extern "C" {
457c478bd9Sstevel@tonic-gate #endif
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate /*
487c478bd9Sstevel@tonic-gate  * Global include file for relocation common code.
497c478bd9Sstevel@tonic-gate  *
507c478bd9Sstevel@tonic-gate  * Flags for reloc_entry->re_flags
517c478bd9Sstevel@tonic-gate  */
527c478bd9Sstevel@tonic-gate #define	FLG_RE_NOTREL		0x00000000
537c478bd9Sstevel@tonic-gate #define	FLG_RE_GOTADD		0x00000001	/* create a GOT entry */
547c478bd9Sstevel@tonic-gate #define	FLG_RE_GOTREL		0x00000002	/* GOT based */
557c478bd9Sstevel@tonic-gate #define	FLG_RE_GOTPC		0x00000004	/* GOT - P */
567c478bd9Sstevel@tonic-gate #define	FLG_RE_GOTOPINS		0x00000008	/* GOTOP instruction */
577c478bd9Sstevel@tonic-gate #define	FLG_RE_PCREL		0x00000010
587c478bd9Sstevel@tonic-gate #define	FLG_RE_PLTREL		0x00000020
597c478bd9Sstevel@tonic-gate #define	FLG_RE_VERIFY		0x00000040	/* verify value fits */
607c478bd9Sstevel@tonic-gate #define	FLG_RE_UNALIGN		0x00000080	/* offset is not aligned */
617c478bd9Sstevel@tonic-gate #define	FLG_RE_WDISP16		0x00000100	/* funky sparc DISP16 rel */
627c478bd9Sstevel@tonic-gate #define	FLG_RE_SIGN		0x00000200	/* value is signed */
637c478bd9Sstevel@tonic-gate #define	FLG_RE_ADDRELATIVE	0x00000400	/* RELATIVE relocation */
647c478bd9Sstevel@tonic-gate 						/* required for non-fixed */
657c478bd9Sstevel@tonic-gate 						/* objects */
667c478bd9Sstevel@tonic-gate #define	FLG_RE_EXTOFFSET	0x00000800	/* extra offset required */
677c478bd9Sstevel@tonic-gate #define	FLG_RE_REGISTER		0x00001000	/* relocation initializes */
687c478bd9Sstevel@tonic-gate 						/*    a REGISTER by OLO10 */
697c478bd9Sstevel@tonic-gate #define	FLG_RE_MSB		0x00002000	/* merced MSB data field */
707c478bd9Sstevel@tonic-gate #define	FLG_RE_LSB		0x00004000	/* merced LSB data field */
717c478bd9Sstevel@tonic-gate #define	FLG_RE_ADDFIELD		0x00008000	/* add contents of field at */
727c478bd9Sstevel@tonic-gate 						/*    r_offset to value */
737c478bd9Sstevel@tonic-gate #define	FLG_RE_NOTSUP		0x00010000	/* relocation not supported */
747c478bd9Sstevel@tonic-gate #define	FLG_RE_FRMOFF		0x00020000	/* offset contains islot */
757c478bd9Sstevel@tonic-gate 						/*    value (IA64) */
767c478bd9Sstevel@tonic-gate #define	FLG_RE_SEGREL		0x00040000	/* Segment relative */
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate #define	FLG_RE_SECREL		0x00080000	/* Section relative */
797c478bd9Sstevel@tonic-gate #define	FLG_RE_TLSINS		0x00100000	/* TLS instructino rel */
807c478bd9Sstevel@tonic-gate #define	FLG_RE_TLSGD		0x00200000	/* TLS GD relocation */
817c478bd9Sstevel@tonic-gate #define	FLG_RE_TLSLD		0x00400000	/* TLS LD relocation */
827c478bd9Sstevel@tonic-gate #define	FLG_RE_TLSIE		0x00800000	/* TLS IE relocation */
837c478bd9Sstevel@tonic-gate #define	FLG_RE_TLSLE		0x01000000	/* TLS LE relocation */
847c478bd9Sstevel@tonic-gate 
857c478bd9Sstevel@tonic-gate #define	FLG_RE_LOCLBND		0x02000000	/* relocation must bind */
867c478bd9Sstevel@tonic-gate 						/*  locally */
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate /*
897c478bd9Sstevel@tonic-gate  * Macros for testing relocation table flags
907c478bd9Sstevel@tonic-gate  */
917c478bd9Sstevel@tonic-gate extern	const Rel_entry		reloc_table[];
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate #define	IS_PLT(X)		((reloc_table[(X)].re_flags & \
947c478bd9Sstevel@tonic-gate 					FLG_RE_PLTREL) != 0)
957c478bd9Sstevel@tonic-gate #define	IS_GOT_RELATIVE(X)	((reloc_table[(X)].re_flags & \
967c478bd9Sstevel@tonic-gate 					FLG_RE_GOTADD) != 0)
977c478bd9Sstevel@tonic-gate #define	IS_GOT_PC(X)		((reloc_table[(X)].re_flags & \
987c478bd9Sstevel@tonic-gate 					FLG_RE_GOTPC) != 0)
997c478bd9Sstevel@tonic-gate #define	IS_GOTPCREL(X)		((reloc_table[(X)].re_flags & \
1007c478bd9Sstevel@tonic-gate 					(FLG_RE_GOTPC | FLG_RE_GOTADD)) == \
1017c478bd9Sstevel@tonic-gate 					(FLG_RE_GOTPC | FLG_RE_GOTADD))
1027c478bd9Sstevel@tonic-gate #define	IS_GOT_BASED(X)		((reloc_table[(X)].re_flags & \
1037c478bd9Sstevel@tonic-gate 					FLG_RE_GOTREL) != 0)
1047c478bd9Sstevel@tonic-gate #define	IS_GOT_INS(X)		((reloc_table[(X)].re_flags &\
1057c478bd9Sstevel@tonic-gate 					FLG_RE_GOTOPINS) != 0)
1067c478bd9Sstevel@tonic-gate #define	IS_PC_RELATIVE(X)	((reloc_table[(X)].re_flags & \
1077c478bd9Sstevel@tonic-gate 					FLG_RE_PCREL) != 0)
1087c478bd9Sstevel@tonic-gate #define	IS_ADD_RELATIVE(X)	((reloc_table[(X)].re_flags & \
1097c478bd9Sstevel@tonic-gate 					FLG_RE_ADDRELATIVE) != 0)
1107c478bd9Sstevel@tonic-gate #define	IS_REGISTER(X)		((reloc_table[(X)].re_flags & \
1117c478bd9Sstevel@tonic-gate 					FLG_RE_REGISTER) != 0)
1127c478bd9Sstevel@tonic-gate #define	IS_FORMOFF(X)		((reloc_table[(X)].re_flags &\
1137c478bd9Sstevel@tonic-gate 					FLG_RE_FRMOFF) != 0)
1147c478bd9Sstevel@tonic-gate #define	IS_NOTSUP(X)		((reloc_table[(X)].re_flags &\
1157c478bd9Sstevel@tonic-gate 					FLG_RE_NOTSUP) != 0)
1167c478bd9Sstevel@tonic-gate #define	IS_SEG_RELATIVE(X)	((reloc_table[(X)].re_flags &\
1177c478bd9Sstevel@tonic-gate 					FLG_RE_SEGREL) != 0)
1187c478bd9Sstevel@tonic-gate #define	IS_EXTOFFSET(X)		((reloc_table[(X)].re_flags &\
1197c478bd9Sstevel@tonic-gate 					FLG_RE_EXTOFFSET) != 0)
1207c478bd9Sstevel@tonic-gate #define	IS_SEC_RELATIVE(X)	((reloc_table[(X)].re_flags &\
1217c478bd9Sstevel@tonic-gate 					FLG_RE_SECREL) != 0)
1227c478bd9Sstevel@tonic-gate #define	IS_TLS_INS(X)		((reloc_table[(X)].re_flags &\
1237c478bd9Sstevel@tonic-gate 					FLG_RE_TLSINS) != 0)
1247c478bd9Sstevel@tonic-gate #define	IS_TLS_GD(X)		((reloc_table[(X)].re_flags &\
1257c478bd9Sstevel@tonic-gate 					FLG_RE_TLSGD) != 0)
1267c478bd9Sstevel@tonic-gate #define	IS_TLS_LD(X)		((reloc_table[(X)].re_flags &\
1277c478bd9Sstevel@tonic-gate 					FLG_RE_TLSLD) != 0)
1287c478bd9Sstevel@tonic-gate #define	IS_TLS_IE(X)		((reloc_table[(X)].re_flags &\
1297c478bd9Sstevel@tonic-gate 					FLG_RE_TLSIE) != 0)
1307c478bd9Sstevel@tonic-gate #define	IS_TLS_LE(X)		((reloc_table[(X)].re_flags &\
1317c478bd9Sstevel@tonic-gate 					FLG_RE_TLSLE) != 0)
1327c478bd9Sstevel@tonic-gate #define	IS_TLS(X)		((reloc_table[(X)].re_flags &\
1337c478bd9Sstevel@tonic-gate 					(FLG_RE_TLSINS|FLG_RE_TLSGD| \
1347c478bd9Sstevel@tonic-gate 					FLG_RE_TLSLD|FLG_RE_TLSIE| \
1357c478bd9Sstevel@tonic-gate 					FLG_RE_TLSLE)) != 0)
1367c478bd9Sstevel@tonic-gate #define	IS_LOCALBND(X)		((reloc_table[(X)].re_flags &\
1377c478bd9Sstevel@tonic-gate 					FLG_RE_LOCLBND) != 0)
1387c478bd9Sstevel@tonic-gate 
1397c478bd9Sstevel@tonic-gate /*
1407c478bd9Sstevel@tonic-gate  * Functions.
1417c478bd9Sstevel@tonic-gate  */
142*c2e7b48dSkalai #if defined(__i386) || defined(__amd64)
1437c478bd9Sstevel@tonic-gate extern	int	do_reloc(unsigned char, unsigned char *, Xword *,
1447c478bd9Sstevel@tonic-gate 			const char *, const char *);
1457c478bd9Sstevel@tonic-gate #elif defined(__sparc)
1467c478bd9Sstevel@tonic-gate extern	int	do_reloc(unsigned char, unsigned char *, Xword *,
1477c478bd9Sstevel@tonic-gate 			const char *, const char *);
1487c478bd9Sstevel@tonic-gate #endif
1497c478bd9Sstevel@tonic-gate 
1507c478bd9Sstevel@tonic-gate 
1517c478bd9Sstevel@tonic-gate /*
1527c478bd9Sstevel@tonic-gate  * NOTE - this CONVRELOC macro is only used
1537c478bd9Sstevel@tonic-gate  * in the REL_ERR_NOFIT() macro below.  For Intel
1547c478bd9Sstevel@tonic-gate  * this macro is only referenced from the amd64 side - it's
1557c478bd9Sstevel@tonic-gate  * not relevant for i386.  So - we just define AMD64 for i386
1567c478bd9Sstevel@tonic-gate  * and sparc is sparc.
1577c478bd9Sstevel@tonic-gate  */
1587c478bd9Sstevel@tonic-gate #if defined(__amd64) || defined(__i386)
1597c478bd9Sstevel@tonic-gate #define	CONVRELOC conv_reloc_amd64_type_str
1607c478bd9Sstevel@tonic-gate #elif defined(__sparc)
1617c478bd9Sstevel@tonic-gate #define	CONVRELOC   conv_reloc_SPARC_type_str
1627c478bd9Sstevel@tonic-gate #else
1637c478bd9Sstevel@tonic-gate #error platform not defined!
1647c478bd9Sstevel@tonic-gate #endif
1657c478bd9Sstevel@tonic-gate 
1667c478bd9Sstevel@tonic-gate #if defined(_KERNEL)
1677c478bd9Sstevel@tonic-gate /*
1687c478bd9Sstevel@tonic-gate  * These are macro's that are only needed for krtld.  Many of these
1697c478bd9Sstevel@tonic-gate  * are already defined in the sgs/include files referenced by
1707c478bd9Sstevel@tonic-gate  * ld and rtld
1717c478bd9Sstevel@tonic-gate  */
1727c478bd9Sstevel@tonic-gate 
1737c478bd9Sstevel@tonic-gate #define	S_MASK(n)	((1l << (n)) - 1l)
1747c478bd9Sstevel@tonic-gate #define	S_INRANGE(v, n)	(((-(1l << (n)) - 1l) < (v)) && ((v) < (1l << (n))))
1757c478bd9Sstevel@tonic-gate 
1767c478bd9Sstevel@tonic-gate /*
1777c478bd9Sstevel@tonic-gate  * This converts the sgs eprintf() routine into the _printf()
1787c478bd9Sstevel@tonic-gate  * as used by krtld.
1797c478bd9Sstevel@tonic-gate  */
1807c478bd9Sstevel@tonic-gate #define	eprintf		_kobj_printf
1817c478bd9Sstevel@tonic-gate #define	ERR_FATAL	ops
1827c478bd9Sstevel@tonic-gate 
1837c478bd9Sstevel@tonic-gate /*
1847c478bd9Sstevel@tonic-gate  * Message strings used by doreloc()
1857c478bd9Sstevel@tonic-gate  */
1867c478bd9Sstevel@tonic-gate #define	MSG_ORIG(x)		x
1877c478bd9Sstevel@tonic-gate #define	MSG_INTL(x)		x
1887c478bd9Sstevel@tonic-gate 
1897c478bd9Sstevel@tonic-gate #define	MSG_STR_UNKNOWN		"(unknown)"
1907c478bd9Sstevel@tonic-gate #define	MSG_REL_UNSUPSZ		"relocation error: %s: file %s: symbol %s: " \
1917c478bd9Sstevel@tonic-gate 				"offset size (%d bytes) is not supported"
1927c478bd9Sstevel@tonic-gate #define	MSG_REL_ERR_STR		"relocation error: %s:"
1937c478bd9Sstevel@tonic-gate #define	MSG_REL_ERR_WITH_FILE	"relocation error: file %s: "
1947c478bd9Sstevel@tonic-gate #define	MSG_REL_ERR_FILE	" file %s: "
1957c478bd9Sstevel@tonic-gate #define	MSG_REL_ERR_SYM		" symbol %s: "
1967c478bd9Sstevel@tonic-gate #define	MSG_REL_ERR_VALUE	" value 0x%llx"
1977c478bd9Sstevel@tonic-gate #define	MSG_REL_ERR_OFF		" offset 0x%llx\n"
1987c478bd9Sstevel@tonic-gate #define	MSG_REL_UNIMPL		" unimplemented relocation type: %d"
1997c478bd9Sstevel@tonic-gate #define	MSG_REL_NONALIGN	" offset 0x%llx is non-aligned\n"
2007c478bd9Sstevel@tonic-gate #define	MSG_REL_UNNOBITS	" unsupported number of bits: %d"
2017c478bd9Sstevel@tonic-gate #define	MSG_REL_NOFIT		" value 0x%llx does not fit\n"
2027c478bd9Sstevel@tonic-gate #define	MSG_REL_LOSEBITS	" loses %d bits at"
2037c478bd9Sstevel@tonic-gate 
2047c478bd9Sstevel@tonic-gate extern const char *conv_reloc_SPARC_type_str(Word rtype);
2057c478bd9Sstevel@tonic-gate extern const char *conv_reloc_386_type_str(Word rtype);
2067c478bd9Sstevel@tonic-gate extern const char *conv_reloc_amd64_type_str(Word rtype);
2077c478bd9Sstevel@tonic-gate 
2087c478bd9Sstevel@tonic-gate /*
2097c478bd9Sstevel@tonic-gate  * Note:  Related to bug 4128755, dlerror() only keeps track
2107c478bd9Sstevel@tonic-gate  * of a single error string, and therefore must have errors
2117c478bd9Sstevel@tonic-gate  * reported through a single eprintf() call.  The kernel's
2127c478bd9Sstevel@tonic-gate  * printf is somewhat more limited, and must receive messages
2137c478bd9Sstevel@tonic-gate  * with only one arguement to the format string.  The following
2147c478bd9Sstevel@tonic-gate  * macros are to straighted all this out because krtld and
2157c478bd9Sstevel@tonic-gate  * rtld share do_reloc().
2167c478bd9Sstevel@tonic-gate  */
2177c478bd9Sstevel@tonic-gate #define	REL_ERR_UNIMPL(file, sym, rtype) \
2187c478bd9Sstevel@tonic-gate 	eprintf(ERR_FATAL, MSG_REL_ERR_WITH_FILE, (file)); \
2197c478bd9Sstevel@tonic-gate 	eprintf(ERR_FATAL, MSG_REL_ERR_SYM, \
2207c478bd9Sstevel@tonic-gate 	    ((sym) ? (sym) : MSG_STR_UNKNOWN)); \
2217c478bd9Sstevel@tonic-gate 	eprintf(ERR_FATAL,  MSG_REL_UNIMPL, \
2227c478bd9Sstevel@tonic-gate 	    (int)(rtype))
2237c478bd9Sstevel@tonic-gate 
2247c478bd9Sstevel@tonic-gate #define	REL_ERR_NONALIGN(file, sym, rtype, off) \
2257c478bd9Sstevel@tonic-gate 	eprintf(ERR_FATAL, MSG_REL_ERR_STR, \
2267c478bd9Sstevel@tonic-gate 	    conv_reloc_SPARC_type_str((rtype))); \
2277c478bd9Sstevel@tonic-gate 	eprintf(ERR_FATAL, MSG_REL_ERR_FILE, (file)); \
2287c478bd9Sstevel@tonic-gate 	eprintf(ERR_FATAL, MSG_REL_ERR_SYM, \
2297c478bd9Sstevel@tonic-gate 	    ((sym) ? (sym) : MSG_STR_UNKNOWN)); \
2307c478bd9Sstevel@tonic-gate 	eprintf(ERR_FATAL, MSG_REL_NONALIGN, \
2317c478bd9Sstevel@tonic-gate 	    EC_OFF((off)))
2327c478bd9Sstevel@tonic-gate 
2337c478bd9Sstevel@tonic-gate #define	REL_ERR_UNNOBITS(file, sym, rtype, nbits) \
2347c478bd9Sstevel@tonic-gate 	eprintf(ERR_FATAL, MSG_REL_ERR_STR, \
2357c478bd9Sstevel@tonic-gate 	    conv_reloc_SPARC_type_str((rtype))); \
2367c478bd9Sstevel@tonic-gate 	eprintf(ERR_FATAL, MSG_REL_ERR_FILE, (file)); \
2377c478bd9Sstevel@tonic-gate 	eprintf(ERR_FATAL, MSG_REL_ERR_SYM, \
2387c478bd9Sstevel@tonic-gate 	    ((sym) ? (sym) : MSG_STR_UNKNOWN)); \
2397c478bd9Sstevel@tonic-gate 	eprintf(ERR_FATAL, MSG_REL_UNNOBITS, (nbits))
2407c478bd9Sstevel@tonic-gate 
2417c478bd9Sstevel@tonic-gate #define	REL_ERR_LOSEBITS(file, sym, rtype, uvalue, nbits, off) \
2427c478bd9Sstevel@tonic-gate 	eprintf(ERR_FATAL,  MSG_REL_ERR_STR, \
2437c478bd9Sstevel@tonic-gate 	    conv_reloc_SPARC_type_str((rtype))); \
2447c478bd9Sstevel@tonic-gate 	eprintf(ERR_FATAL,  MSG_REL_ERR_FILE, (file)); \
2457c478bd9Sstevel@tonic-gate 	eprintf(ERR_FATAL,  MSG_REL_ERR_SYM, \
2467c478bd9Sstevel@tonic-gate 	    ((sym) ? (sym) : MSG_STR_UNKNOWN)); \
2477c478bd9Sstevel@tonic-gate 	eprintf(ERR_FATAL,  MSG_REL_ERR_VALUE, EC_XWORD((uvalue))); \
2487c478bd9Sstevel@tonic-gate 	eprintf(ERR_FATAL,  MSG_REL_LOSEBITS, (nbits)); \
2497c478bd9Sstevel@tonic-gate 	eprintf(ERR_FATAL,  MSG_REL_ERR_OFF, EC_ADDR((off)))
2507c478bd9Sstevel@tonic-gate 
2517c478bd9Sstevel@tonic-gate #define	REL_ERR_NOFIT(file, sym, rtype, uvalue) \
2527c478bd9Sstevel@tonic-gate 	eprintf(ERR_FATAL, MSG_REL_ERR_STR, \
2537c478bd9Sstevel@tonic-gate 	    CONVRELOC((rtype))); \
2547c478bd9Sstevel@tonic-gate 	eprintf(ERR_FATAL, MSG_REL_ERR_FILE, (file)); \
2557c478bd9Sstevel@tonic-gate 	eprintf(ERR_FATAL, MSG_REL_ERR_SYM, \
2567c478bd9Sstevel@tonic-gate 	    ((sym) ? (sym) : MSG_STR_UNKNOWN)); \
2577c478bd9Sstevel@tonic-gate 	eprintf(ERR_FATAL, MSG_REL_NOFIT, EC_XWORD((uvalue)))
2587c478bd9Sstevel@tonic-gate 
2597c478bd9Sstevel@tonic-gate 
2607c478bd9Sstevel@tonic-gate #else	/* !_KERNEL */
2617c478bd9Sstevel@tonic-gate 
2627c478bd9Sstevel@tonic-gate extern	const char *demangle(const char *);
2637c478bd9Sstevel@tonic-gate 
2647c478bd9Sstevel@tonic-gate #define	REL_ERR_UNIMPL(file, sym, rtype) \
2657c478bd9Sstevel@tonic-gate 	(eprintf(ERR_FATAL, MSG_INTL(MSG_REL_UNIMPL), \
2667c478bd9Sstevel@tonic-gate 	    (file), ((sym) ? demangle(sym) : MSG_INTL(MSG_STR_UNKNOWN)), \
2677c478bd9Sstevel@tonic-gate 	    (int)(rtype)))
2687c478bd9Sstevel@tonic-gate 
2697c478bd9Sstevel@tonic-gate #define	REL_ERR_NONALIGN(file, sym, rtype, off) \
2707c478bd9Sstevel@tonic-gate 	(eprintf(ERR_FATAL, MSG_INTL(MSG_REL_NONALIGN), \
2717c478bd9Sstevel@tonic-gate 	    conv_reloc_SPARC_type_str(rtype), (file), \
2727c478bd9Sstevel@tonic-gate 	    ((sym) ? demangle(sym) : MSG_INTL(MSG_STR_UNKNOWN)), \
2737c478bd9Sstevel@tonic-gate 	    EC_OFF((off))))
2747c478bd9Sstevel@tonic-gate 
2757c478bd9Sstevel@tonic-gate #define	REL_ERR_UNNOBITS(file, sym, rtype, nbits) \
2767c478bd9Sstevel@tonic-gate 	(eprintf(ERR_FATAL, MSG_INTL(MSG_REL_UNNOBITS), \
2777c478bd9Sstevel@tonic-gate 	    conv_reloc_SPARC_type_str(rtype), (file), \
2787c478bd9Sstevel@tonic-gate 	    ((sym) ? demangle(sym) : MSG_INTL(MSG_STR_UNKNOWN)), (nbits)))
2797c478bd9Sstevel@tonic-gate 
2807c478bd9Sstevel@tonic-gate #define	REL_ERR_LOSEBITS(file, sym, rtype, uvalue, nbits, off) \
2817c478bd9Sstevel@tonic-gate 	(eprintf(ERR_FATAL,  MSG_INTL(MSG_REL_LOSEBITS), \
2827c478bd9Sstevel@tonic-gate 	    conv_reloc_SPARC_type_str((rtype)), (file), \
2837c478bd9Sstevel@tonic-gate 	    ((sym) ? demangle(sym) : MSG_INTL(MSG_STR_UNKNOWN)), \
2847c478bd9Sstevel@tonic-gate 	    EC_XWORD((uvalue)), (nbits), EC_ADDR((off))))
2857c478bd9Sstevel@tonic-gate 
2867c478bd9Sstevel@tonic-gate #define	REL_ERR_NOFIT(file, sym, rtype, uvalue) \
2877c478bd9Sstevel@tonic-gate 	(eprintf(ERR_FATAL, MSG_INTL(MSG_REL_NOFIT), \
2887c478bd9Sstevel@tonic-gate 	    CONVRELOC((rtype)), (file), \
2897c478bd9Sstevel@tonic-gate 	    ((sym) ? demangle(sym) : MSG_INTL(MSG_STR_UNKNOWN)), \
2907c478bd9Sstevel@tonic-gate 	    EC_XWORD((uvalue))))
2917c478bd9Sstevel@tonic-gate 
2927c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
2937c478bd9Sstevel@tonic-gate 
2947c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
2957c478bd9Sstevel@tonic-gate }
2967c478bd9Sstevel@tonic-gate #endif
2977c478bd9Sstevel@tonic-gate 
2987c478bd9Sstevel@tonic-gate #endif /* _RELOC_DOT_H */
299