xref: /titanic_53/usr/src/uts/common/krtld/reloc.h (revision f3324781c875e2f9865c291e43f86ee710b0c145)
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
55aefb655Srie  * Common Development and Distribution License (the "License").
65aefb655Srie  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
21552ff457Srie 
227c478bd9Sstevel@tonic-gate /*
23de777a60Sab196087  * Copyright 2007 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>
395aefb655Srie #include <rtld.h>
40552ff457Srie #include <conv.h>
417c478bd9Sstevel@tonic-gate #endif /* _KERNEL */
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate #include <relmach.h>
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
467c478bd9Sstevel@tonic-gate extern "C" {
477c478bd9Sstevel@tonic-gate #endif
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate /*
507c478bd9Sstevel@tonic-gate  * Global include file for relocation common code.
517c478bd9Sstevel@tonic-gate  *
527c478bd9Sstevel@tonic-gate  * Flags for reloc_entry->re_flags
537c478bd9Sstevel@tonic-gate  */
547c478bd9Sstevel@tonic-gate #define	FLG_RE_NOTREL		0x00000000
557c478bd9Sstevel@tonic-gate #define	FLG_RE_GOTADD		0x00000001	/* create a GOT entry */
567c478bd9Sstevel@tonic-gate #define	FLG_RE_GOTREL		0x00000002	/* GOT based */
577c478bd9Sstevel@tonic-gate #define	FLG_RE_GOTPC		0x00000004	/* GOT - P */
587c478bd9Sstevel@tonic-gate #define	FLG_RE_GOTOPINS		0x00000008	/* GOTOP instruction */
597c478bd9Sstevel@tonic-gate #define	FLG_RE_PCREL		0x00000010
607c478bd9Sstevel@tonic-gate #define	FLG_RE_PLTREL		0x00000020
617c478bd9Sstevel@tonic-gate #define	FLG_RE_VERIFY		0x00000040	/* verify value fits */
627c478bd9Sstevel@tonic-gate #define	FLG_RE_UNALIGN		0x00000080	/* offset is not aligned */
637c478bd9Sstevel@tonic-gate #define	FLG_RE_WDISP16		0x00000100	/* funky sparc DISP16 rel */
647c478bd9Sstevel@tonic-gate #define	FLG_RE_SIGN		0x00000200	/* value is signed */
657c478bd9Sstevel@tonic-gate #define	FLG_RE_ADDRELATIVE	0x00000400	/* RELATIVE relocation */
66d326b23bSrie 						/*	required for non- */
67d326b23bSrie 						/*	fixed objects */
687c478bd9Sstevel@tonic-gate #define	FLG_RE_EXTOFFSET	0x00000800	/* extra offset required */
697c478bd9Sstevel@tonic-gate #define	FLG_RE_REGISTER		0x00001000	/* relocation initializes */
707c478bd9Sstevel@tonic-gate 						/*    a REGISTER by OLO10 */
712926dd2eSrie #define	FLG_RE_SIZE		0x00002000	/* symbol size required */
722926dd2eSrie 
737c478bd9Sstevel@tonic-gate #define	FLG_RE_NOTSUP		0x00010000	/* relocation not supported */
747c478bd9Sstevel@tonic-gate 
75552ff457Srie #define	FLG_RE_SEGREL		0x00040000	/* segment relative */
76552ff457Srie #define	FLG_RE_SECREL		0x00080000	/* section relative */
77d326b23bSrie 
787c478bd9Sstevel@tonic-gate #define	FLG_RE_TLSGD		0x00200000	/* TLS GD relocation */
797c478bd9Sstevel@tonic-gate #define	FLG_RE_TLSLD		0x00400000	/* TLS LD relocation */
807c478bd9Sstevel@tonic-gate #define	FLG_RE_TLSIE		0x00800000	/* TLS IE relocation */
817c478bd9Sstevel@tonic-gate #define	FLG_RE_TLSLE		0x01000000	/* TLS LE relocation */
827c478bd9Sstevel@tonic-gate #define	FLG_RE_LOCLBND		0x02000000	/* relocation must bind */
837c478bd9Sstevel@tonic-gate 						/*    locally */
847c478bd9Sstevel@tonic-gate 
857c478bd9Sstevel@tonic-gate /*
865aefb655Srie  * In user land, redefine the relocation table and relocation engine to be
875aefb655Srie  * class specific if necessary.  This allows both engines to reside in the
885aefb655Srie  * intel/amd version of libld.
895aefb655Srie  */
905aefb655Srie #if	!defined(_KERNEL)
915aefb655Srie #if	defined(_ELF64)
92*f3324781Sab196087 #define	do_reloc_ld		do64_reloc_ld
93*f3324781Sab196087 #define	do_reloc_rtld		do64_reloc_rtld
945aefb655Srie #define	reloc_table		reloc64_table
955aefb655Srie #else
96*f3324781Sab196087 #define	do_reloc_ld		do32_reloc_ld
97*f3324781Sab196087 #define	do_reloc_rtld		do32_reloc_rtld
985aefb655Srie #define	reloc_table		reloc32_table
995aefb655Srie #endif
1005aefb655Srie #endif
1015aefb655Srie 
1025aefb655Srie /*
1035aefb655Srie  * Relocation table and macros for testing relocation table flags.
1047c478bd9Sstevel@tonic-gate  */
1057c478bd9Sstevel@tonic-gate extern	const Rel_entry		reloc_table[];
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate #define	IS_PLT(X)		((reloc_table[(X)].re_flags & \
1087c478bd9Sstevel@tonic-gate 					FLG_RE_PLTREL) != 0)
1097c478bd9Sstevel@tonic-gate #define	IS_GOT_RELATIVE(X)	((reloc_table[(X)].re_flags & \
1107c478bd9Sstevel@tonic-gate 					FLG_RE_GOTADD) != 0)
1117c478bd9Sstevel@tonic-gate #define	IS_GOT_PC(X)		((reloc_table[(X)].re_flags & \
1127c478bd9Sstevel@tonic-gate 					FLG_RE_GOTPC) != 0)
1137c478bd9Sstevel@tonic-gate #define	IS_GOTPCREL(X)		((reloc_table[(X)].re_flags & \
1147c478bd9Sstevel@tonic-gate 					(FLG_RE_GOTPC | FLG_RE_GOTADD)) == \
1157c478bd9Sstevel@tonic-gate 					(FLG_RE_GOTPC | FLG_RE_GOTADD))
1167c478bd9Sstevel@tonic-gate #define	IS_GOT_BASED(X)		((reloc_table[(X)].re_flags & \
1177c478bd9Sstevel@tonic-gate 					FLG_RE_GOTREL) != 0)
118051d39bbSrie #define	IS_GOT_OPINS(X)		((reloc_table[(X)].re_flags & \
1197c478bd9Sstevel@tonic-gate 					FLG_RE_GOTOPINS) != 0)
120141040e8Srie #define	IS_GOT_REQUIRED(X)	((reloc_table[(X)].re_flags & \
121141040e8Srie 					(FLG_RE_GOTADD | FLG_RE_GOTREL | \
122141040e8Srie 					FLG_RE_GOTPC | FLG_RE_GOTOPINS)) != 0)
1237c478bd9Sstevel@tonic-gate #define	IS_PC_RELATIVE(X)	((reloc_table[(X)].re_flags & \
1247c478bd9Sstevel@tonic-gate 					FLG_RE_PCREL) != 0)
1257c478bd9Sstevel@tonic-gate #define	IS_ADD_RELATIVE(X)	((reloc_table[(X)].re_flags & \
1267c478bd9Sstevel@tonic-gate 					FLG_RE_ADDRELATIVE) != 0)
1277c478bd9Sstevel@tonic-gate #define	IS_REGISTER(X)		((reloc_table[(X)].re_flags & \
1287c478bd9Sstevel@tonic-gate 					FLG_RE_REGISTER) != 0)
1297c478bd9Sstevel@tonic-gate #define	IS_NOTSUP(X)		((reloc_table[(X)].re_flags & \
1307c478bd9Sstevel@tonic-gate 					FLG_RE_NOTSUP) != 0)
1317c478bd9Sstevel@tonic-gate #define	IS_SEG_RELATIVE(X)	((reloc_table[(X)].re_flags & \
1327c478bd9Sstevel@tonic-gate 					FLG_RE_SEGREL) != 0)
1337c478bd9Sstevel@tonic-gate #define	IS_EXTOFFSET(X)		((reloc_table[(X)].re_flags & \
1347c478bd9Sstevel@tonic-gate 					FLG_RE_EXTOFFSET) != 0)
1357c478bd9Sstevel@tonic-gate #define	IS_SEC_RELATIVE(X)	((reloc_table[(X)].re_flags & \
1367c478bd9Sstevel@tonic-gate 					FLG_RE_SECREL) != 0)
1377c478bd9Sstevel@tonic-gate #define	IS_TLS_INS(X)		((reloc_table[(X)].re_flags & \
138d326b23bSrie 					(FLG_RE_TLSGD | FLG_RE_TLSLD | \
139d326b23bSrie 					FLG_RE_TLSIE | FLG_RE_TLSLE)) != 0)
1407c478bd9Sstevel@tonic-gate #define	IS_TLS_GD(X)		((reloc_table[(X)].re_flags & \
1417c478bd9Sstevel@tonic-gate 					FLG_RE_TLSGD) != 0)
1427c478bd9Sstevel@tonic-gate #define	IS_TLS_LD(X)		((reloc_table[(X)].re_flags & \
1437c478bd9Sstevel@tonic-gate 					FLG_RE_TLSLD) != 0)
1447c478bd9Sstevel@tonic-gate #define	IS_TLS_IE(X)		((reloc_table[(X)].re_flags & \
1457c478bd9Sstevel@tonic-gate 					FLG_RE_TLSIE) != 0)
1467c478bd9Sstevel@tonic-gate #define	IS_TLS_LE(X)		((reloc_table[(X)].re_flags & \
1477c478bd9Sstevel@tonic-gate 					FLG_RE_TLSLE) != 0)
1487c478bd9Sstevel@tonic-gate #define	IS_LOCALBND(X)		((reloc_table[(X)].re_flags & \
1497c478bd9Sstevel@tonic-gate 					FLG_RE_LOCLBND) != 0)
1502926dd2eSrie #define	IS_SIZE(X)		((reloc_table[(X)].re_flags &\
1512926dd2eSrie 					FLG_RE_SIZE) != 0)
1527c478bd9Sstevel@tonic-gate 
1537c478bd9Sstevel@tonic-gate /*
1545aefb655Srie  * Relocation engine.
155*f3324781Sab196087  *
156*f3324781Sab196087  * The do_reloc() code is used in three different places: The kernel,
157*f3324781Sab196087  * the linker, and the runtime linker. All three use the same first
158*f3324781Sab196087  * 5 arguments. In addition:
159*f3324781Sab196087  *	- The linker and rtld want a link map pointer argument
160*f3324781Sab196087  *	- The linker wants to pass a byte swap argument that tells
161*f3324781Sab196087  *		the relocation engine that the data it is relocating
162*f3324781Sab196087  *		has the opposite byte order of the system running the
163*f3324781Sab196087  *		linker.
164*f3324781Sab196087  *
165*f3324781Sab196087  * To ensure that there is never any confusion about which version is
166*f3324781Sab196087  * being linked to, we give each variant a different name, even though
167*f3324781Sab196087  * each one is generated from the same source code.
168*f3324781Sab196087  *
169*f3324781Sab196087  *	do_reloc_krtld()
170*f3324781Sab196087  *	The kernel version is provided if the _KERNEL macro is defined.
171*f3324781Sab196087  *
172*f3324781Sab196087  *	do_reloc_ld()
173*f3324781Sab196087  *	The ld version is provided if the DO_RELOC_LIBLD macro is defined.
174*f3324781Sab196087  *
175*f3324781Sab196087  *	do_reloc_rtld()
176*f3324781Sab196087  *	The rtld version is provided if neither _KERNEL or DO_RELOC_LIBLD
177*f3324781Sab196087  *	are defined.
178*f3324781Sab196087  *
179*f3324781Sab196087  * Implementations of do_reloc() should use these same macros to
180*f3324781Sab196087  * conditionalize any code not used by all three versions.
1817c478bd9Sstevel@tonic-gate  */
182*f3324781Sab196087 #if defined(_KERNEL)
183*f3324781Sab196087 extern	int	do_reloc_krtld(uchar_t, uchar_t *, Xword *, const char *,
184*f3324781Sab196087 		    const char *);
185*f3324781Sab196087 #elif defined(DO_RELOC_LIBLD)
186*f3324781Sab196087 extern	int	do_reloc_ld(uchar_t, uchar_t *, Xword *, const char *,
187*f3324781Sab196087 		    const char *, int, void *);
188*f3324781Sab196087 #else
189*f3324781Sab196087 extern	int	do_reloc_rtld(uchar_t, uchar_t *, Xword *, const char *,
1905aefb655Srie 		    const char *, void *);
191*f3324781Sab196087 #endif
192552ff457Srie 
1937c478bd9Sstevel@tonic-gate #if defined(_KERNEL)
1947c478bd9Sstevel@tonic-gate /*
195552ff457Srie  * These are macro's that are only needed for krtld.  Many of these are already
196552ff457Srie  * defined in the sgs/include files referenced by ld and rtld
1977c478bd9Sstevel@tonic-gate  */
1987c478bd9Sstevel@tonic-gate #define	S_MASK(n)	((1l << (n)) - 1l)
1997c478bd9Sstevel@tonic-gate #define	S_INRANGE(v, n)	(((-(1l << (n)) - 1l) < (v)) && ((v) < (1l << (n))))
2007c478bd9Sstevel@tonic-gate 
2017c478bd9Sstevel@tonic-gate /*
202552ff457Srie  * Message strings used by doreloc().
2037c478bd9Sstevel@tonic-gate  */
2047c478bd9Sstevel@tonic-gate #define	MSG_STR_UNKNOWN		"(unknown)"
205552ff457Srie 
206552ff457Srie #define	MSG_REL_PREGEN		"relocation error: %s: "
207552ff457Srie #define	MSG_REL_PREFIL		"relocation error: file %s: "
208552ff457Srie #define	MSG_REL_FILE		"file %s: "
209552ff457Srie #define	MSG_REL_SYM		"symbol %s: "
210552ff457Srie #define	MSG_REL_VALUE		"value 0x%llx "
2117c478bd9Sstevel@tonic-gate #define	MSG_REL_LOSEBITS	"loses %d bits at "
2127c478bd9Sstevel@tonic-gate 
213552ff457Srie #define	MSG_REL_UNIMPL		"unimplemented relocation type: %d"
214552ff457Srie #define	MSG_REL_UNSUPSZ		"offset size (%d bytes) is not supported"
215552ff457Srie #define	MSG_REL_NONALIGN	"offset 0x%llx is non-aligned"
216552ff457Srie #define	MSG_REL_UNNOBITS	"unsupported number of bits: %d"
217552ff457Srie #define	MSG_REL_OFFSET		"offset 0x%llx"
218552ff457Srie #define	MSG_REL_NOFIT		"value 0x%llx does not fit"
219552ff457Srie 
2205aefb655Srie /*
2215aefb655Srie  * Provide a macro to select the appropriate conversion routine for this
2225aefb655Srie  * architecture.
2235aefb655Srie  */
2245aefb655Srie #if defined(__amd64)
2255aefb655Srie 
2265aefb655Srie extern const char	*conv_reloc_amd64_type(Word);
2275aefb655Srie #define	CONV_RELOC_TYPE	conv_reloc_amd64_type
2285aefb655Srie 
2295aefb655Srie #elif defined(__i386)
2305aefb655Srie 
2315aefb655Srie extern const char	*conv_reloc_386_type(Word);
2325aefb655Srie #define	CONV_RELOC_TYPE	conv_reloc_386_type
2335aefb655Srie 
2345aefb655Srie #elif defined(__sparc)
2355aefb655Srie 
2365aefb655Srie extern const char	*conv_reloc_SPARC_type(Word);
2375aefb655Srie #define	CONV_RELOC_TYPE	conv_reloc_SPARC_type
2385aefb655Srie 
2395aefb655Srie #else
2405aefb655Srie #error platform not defined!
2415aefb655Srie #endif
2427c478bd9Sstevel@tonic-gate 
2437c478bd9Sstevel@tonic-gate /*
2445aefb655Srie  * Note:  dlerror() only keeps track of a single error string, and therefore
2455aefb655Srie  * must have errors reported through a single eprintf() call.  The kernel's
2465aefb655Srie  * _kobj_printf is somewhat more limited, and must receive messages with only
2475aefb655Srie  * one argument to the format string.  The following macros account for these
248*f3324781Sab196087  * differences, as krtld and rtld share the same do_reloc() source.
2497c478bd9Sstevel@tonic-gate  */
2505aefb655Srie #define	REL_ERR_UNIMPL(lml, file, sym, rtype) \
251552ff457Srie 	_kobj_printf(ops, MSG_REL_PREFIL, (file)); \
252552ff457Srie 	_kobj_printf(ops, MSG_REL_SYM, ((sym) ? (sym) : MSG_STR_UNKNOWN)); \
253552ff457Srie 	_kobj_printf(ops, MSG_REL_UNIMPL, (int)(rtype))
254552ff457Srie 
2555aefb655Srie #define	REL_ERR_UNSUPSZ(lml, file, sym, rtype, size) \
256552ff457Srie 	_kobj_printf(ops, MSG_REL_PREGEN, CONV_RELOC_TYPE((rtype))); \
257552ff457Srie 	_kobj_printf(ops, MSG_REL_FILE, (file)); \
258552ff457Srie 	_kobj_printf(ops, MSG_REL_SYM, ((sym) ? (sym) : MSG_STR_UNKNOWN)); \
259552ff457Srie 	_kobj_printf(ops, MSG_REL_UNSUPSZ, (int)(size))
2607c478bd9Sstevel@tonic-gate 
2615aefb655Srie #define	REL_ERR_NONALIGN(lml, file, sym, rtype, off) \
262552ff457Srie 	_kobj_printf(ops, MSG_REL_PREGEN, CONV_RELOC_TYPE((rtype))); \
263552ff457Srie 	_kobj_printf(ops, MSG_REL_FILE, (file)); \
264552ff457Srie 	_kobj_printf(ops, MSG_REL_SYM, ((sym) ? (sym) : MSG_STR_UNKNOWN)); \
265552ff457Srie 	_kobj_printf(ops, MSG_REL_NONALIGN, EC_OFF((off)))
2667c478bd9Sstevel@tonic-gate 
2675aefb655Srie #define	REL_ERR_UNNOBITS(lml, file, sym, rtype, nbits) \
268552ff457Srie 	_kobj_printf(ops, MSG_REL_PREGEN, CONV_RELOC_TYPE((rtype))); \
269552ff457Srie 	_kobj_printf(ops, MSG_REL_FILE, (file)); \
270552ff457Srie 	_kobj_printf(ops, MSG_REL_SYM, ((sym) ? (sym) : MSG_STR_UNKNOWN)); \
271552ff457Srie 	_kobj_printf(ops, MSG_REL_UNNOBITS, (nbits))
2727c478bd9Sstevel@tonic-gate 
2735aefb655Srie #define	REL_ERR_LOSEBITS(lml, file, sym, rtype, uvalue, nbits, off) \
274552ff457Srie 	_kobj_printf(ops, MSG_REL_PREGEN, CONV_RELOC_TYPE((rtype))); \
275552ff457Srie 	_kobj_printf(ops, MSG_REL_FILE, (file)); \
276552ff457Srie 	_kobj_printf(ops, MSG_REL_SYM, ((sym) ? (sym) : MSG_STR_UNKNOWN)); \
277552ff457Srie 	_kobj_printf(ops, MSG_REL_VALUE, EC_XWORD((uvalue))); \
278552ff457Srie 	_kobj_printf(ops, MSG_REL_LOSEBITS, (int)(nbits)); \
2795aefb655Srie 	_kobj_printf(ops, MSG_REL_OFFSET, EC_NATPTR((off)))
2807c478bd9Sstevel@tonic-gate 
2815aefb655Srie #define	REL_ERR_NOFIT(lml, file, sym, rtype, uvalue) \
282552ff457Srie 	_kobj_printf(ops, MSG_REL_PREGEN, CONV_RELOC_TYPE((rtype))); \
283552ff457Srie 	_kobj_printf(ops, MSG_REL_FILE, (file)); \
284552ff457Srie 	_kobj_printf(ops, MSG_REL_SYM, ((sym) ? (sym) : MSG_STR_UNKNOWN)); \
285552ff457Srie 	_kobj_printf(ops, MSG_REL_NOFIT, EC_XWORD((uvalue)))
2867c478bd9Sstevel@tonic-gate 
2877c478bd9Sstevel@tonic-gate 
2887c478bd9Sstevel@tonic-gate #else	/* !_KERNEL */
2897c478bd9Sstevel@tonic-gate 
2907c478bd9Sstevel@tonic-gate extern	const char *demangle(const char *);
2917c478bd9Sstevel@tonic-gate 
2925aefb655Srie #define	REL_ERR_UNIMPL(lml, file, sym, rtype) \
2935aefb655Srie 	(eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_UNIMPL), (file), \
294552ff457Srie 	    ((sym) ? demangle(sym) : MSG_INTL(MSG_STR_UNKNOWN)), (int)(rtype)))
295552ff457Srie 
2965aefb655Srie #define	REL_ERR_UNSUPSZ(lml, file, sym, rtype, size) \
2975aefb655Srie 	(eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_UNSUPSZ), \
298de777a60Sab196087 	    conv_reloc_type_static(M_MACH, (rtype), 0), (file), \
299552ff457Srie 	    ((sym) ? demangle(sym) : MSG_INTL(MSG_STR_UNKNOWN)), (int)(size)))
3007c478bd9Sstevel@tonic-gate 
3015aefb655Srie #define	REL_ERR_NONALIGN(lml, file, sym, rtype, off) \
3025aefb655Srie 	(eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_NONALIGN), \
303de777a60Sab196087 	    conv_reloc_type_static(M_MACH, (rtype), 0), (file), \
304552ff457Srie 	    ((sym) ? demangle(sym) : MSG_INTL(MSG_STR_UNKNOWN)), EC_OFF((off))))
3057c478bd9Sstevel@tonic-gate 
3065aefb655Srie #define	REL_ERR_UNNOBITS(lml, file, sym, rtype, nbits) \
3075aefb655Srie 	(eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_UNNOBITS), \
308de777a60Sab196087 	    conv_reloc_type_static(M_MACH, (rtype), 0), (file), \
3097c478bd9Sstevel@tonic-gate 	    ((sym) ? demangle(sym) : MSG_INTL(MSG_STR_UNKNOWN)), (nbits)))
3107c478bd9Sstevel@tonic-gate 
3115aefb655Srie #define	REL_ERR_LOSEBITS(lml, file, sym, rtype, uvalue, nbits, off) \
3125aefb655Srie 	(eprintf(lml, ERR_FATAL,  MSG_INTL(MSG_REL_LOSEBITS), \
313de777a60Sab196087 	    conv_reloc_type_static(M_MACH, (rtype), 0), (file), \
3147c478bd9Sstevel@tonic-gate 	    ((sym) ? demangle(sym) : MSG_INTL(MSG_STR_UNKNOWN)), \
3155aefb655Srie 	    EC_XWORD((uvalue)), (nbits), EC_NATPTR((off))))
3167c478bd9Sstevel@tonic-gate 
3175aefb655Srie #define	REL_ERR_NOFIT(lml, file, sym, rtype, uvalue) \
3185aefb655Srie 	(eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_NOFIT), \
319de777a60Sab196087 	    conv_reloc_type_static(M_MACH, (rtype), 0), (file), \
3207c478bd9Sstevel@tonic-gate 	    ((sym) ? demangle(sym) : MSG_INTL(MSG_STR_UNKNOWN)), \
3217c478bd9Sstevel@tonic-gate 	    EC_XWORD((uvalue))))
3227c478bd9Sstevel@tonic-gate 
323*f3324781Sab196087 #define	REL_ERR_NOSWAP(lml, file, sym, rtype) \
324*f3324781Sab196087 	(eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_NOSWAP), \
325*f3324781Sab196087 	    conv_reloc_type_static(M_MACH, (rtype), 0), (file), \
326*f3324781Sab196087 	    ((sym) ? demangle(sym) : MSG_INTL(MSG_STR_UNKNOWN))))
327*f3324781Sab196087 
3287c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
3297c478bd9Sstevel@tonic-gate 
3307c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
3317c478bd9Sstevel@tonic-gate }
3327c478bd9Sstevel@tonic-gate #endif
3337c478bd9Sstevel@tonic-gate 
3347c478bd9Sstevel@tonic-gate #endif /* _RELOC_DOT_H */
335