xref: /titanic_51/usr/src/uts/intel/amd64/krtld/doreloc.c (revision 6136c589445a3ea081bd34ab72db1060875b6bcc)
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 /*
23bf994817SAli Bahrami  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #if	defined(_KERNEL)
277c478bd9Sstevel@tonic-gate #include	<sys/types.h>
287c478bd9Sstevel@tonic-gate #include	"reloc.h"
297c478bd9Sstevel@tonic-gate #else
30ba2be530Sab196087 #define	ELF_TARGET_AMD64
31ba2be530Sab196087 #if defined(DO_RELOC_LIBLD)
32ba2be530Sab196087 #undef DO_RELOC_LIBLD
33ba2be530Sab196087 #define	DO_RELOC_LIBLD_X86
34ba2be530Sab196087 #endif
357c478bd9Sstevel@tonic-gate #include	<stdio.h>
367c478bd9Sstevel@tonic-gate #include	"sgs.h"
377c478bd9Sstevel@tonic-gate #include	"machdep.h"
387c478bd9Sstevel@tonic-gate #include	"libld.h"
397c478bd9Sstevel@tonic-gate #include	"reloc.h"
407c478bd9Sstevel@tonic-gate #include	"conv.h"
417c478bd9Sstevel@tonic-gate #include	"msg.h"
427c478bd9Sstevel@tonic-gate #endif
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate /*
45ba2be530Sab196087  * We need to build this code differently when it is used for
46ba2be530Sab196087  * cross linking:
47ba2be530Sab196087  *	- Data alignment requirements can differ from those
48ba2be530Sab196087  *		of the running system, so we can't access data
49ba2be530Sab196087  *		in units larger than a byte
50ba2be530Sab196087  *	- We have to include code to do byte swapping when the
51ba2be530Sab196087  *		target and linker host use different byte ordering,
52ba2be530Sab196087  *		but such code is a waste when running natively.
53ba2be530Sab196087  */
54ba2be530Sab196087 #if !defined(DO_RELOC_LIBLD) || defined(__i386) || defined(__amd64)
55ba2be530Sab196087 #define	DORELOC_NATIVE
56ba2be530Sab196087 #endif
57ba2be530Sab196087 
58ba2be530Sab196087 /*
59552ff457Srie  * This table represents the current relocations that do_reloc() is able to
60552ff457Srie  * process.  The relocations below that are marked SPECIAL are relocations that
61552ff457Srie  * take special processing and shouldn't actually ever be passed to do_reloc().
627c478bd9Sstevel@tonic-gate  */
637c478bd9Sstevel@tonic-gate const Rel_entry	reloc_table[R_AMD64_NUM] = {
64ba2be530Sab196087 /* R_AMD64_NONE */	{0, FLG_RE_NOTREL, 0, 0, 0},
65ba2be530Sab196087 /* R_AMD64_64 */	{0, FLG_RE_NOTREL, 8, 0, 0},
66ba2be530Sab196087 /* R_AMD64_PC32 */	{0, FLG_RE_PCREL, 4, 0, 0},
67ba2be530Sab196087 /* R_AMD64_GOT32 */	{0, FLG_RE_NOTSUP, 0, 0, 0},
68ba2be530Sab196087 /* R_AMD64_PLT32 */	{0, FLG_RE_PCREL | FLG_RE_PLTREL |
69ba2be530Sab196087 			    FLG_RE_VERIFY | FLG_RE_SIGN, 4, 0, 0},
70ba2be530Sab196087 /* R_AMD64_COPY */	{0, FLG_RE_NOTSUP, 0, 0, 0},	/* SPECIAL */
71ba2be530Sab196087 /* R_AMD64_GLOB_DAT */	{0, FLG_RE_NOTREL, 8, 0, 0},
72ba2be530Sab196087 /* R_AMD64_JUMP_SLOT */	{0, FLG_RE_NOTSUP, 0, 0, 0},	/* SPECIAL */
73ba2be530Sab196087 /* R_AMD64_RELATIVE */	{0, FLG_RE_NOTREL, 8, 0, 0},
74ba2be530Sab196087 /* R_AMD64_GOTPCREL */	{0, FLG_RE_GOTPC | FLG_RE_GOTADD, 4, 0, 0},
75ba2be530Sab196087 /* R_AMD64_32 */	{0, FLG_RE_NOTREL, 4, 0, 0},
76ba2be530Sab196087 /* R_AMD64_32S */	{0, FLG_RE_NOTREL, 4, 0, 0},
77ba2be530Sab196087 /* R_AMD64_16 */	{0, FLG_RE_NOTREL, 2, 0, 0},
78ba2be530Sab196087 /* R_AMD64_PC16 */	{0, FLG_RE_PCREL, 2, 0, 0},
79ba2be530Sab196087 /* R_AMD64_8 */		{0, FLG_RE_NOTREL, 1, 0, 0},
80ba2be530Sab196087 /* R_AMD64_PC8 */	{0, FLG_RE_PCREL, 1, 0, 0},
81ba2be530Sab196087 /* R_AMD64_DTPMOD64 */	{0, FLG_RE_NOTREL, 8, 0, 0},
82ba2be530Sab196087 /* R_AMD64_DTPOFF64 */	{0, FLG_RE_NOTREL, 8, 0, 0},
83ba2be530Sab196087 /* R_AMD64_TPOFF64 */	{0, FLG_RE_NOTREL, 8, 0, 0},
84ba2be530Sab196087 /* R_AMD64_TLSGD */	{0, FLG_RE_GOTPC | FLG_RE_GOTADD | FLG_RE_TLSGD,
85ba2be530Sab196087 			    4, 0, 0},
86ba2be530Sab196087 /* R_AMD64_TLSLD */	{0, FLG_RE_GOTPC | FLG_RE_GOTADD | FLG_RE_TLSLD,
87ba2be530Sab196087 			    4, 0, 0},
88ba2be530Sab196087 /* R_AMD64_DTPOFF32 */	{0, FLG_RE_TLSLD, 4},
89ba2be530Sab196087 /* R_AMD64_GOTTPOFF */	{0, FLG_RE_GOTPC | FLG_RE_GOTADD | FLG_RE_TLSIE,
90ba2be530Sab196087 			    4, 0, 0},
91ba2be530Sab196087 /* R_AMD64_TPOFF32 */	{0, FLG_RE_TLSLE, 4, 0, 0},
92ba2be530Sab196087 /* R_AMD64_PC64 */	{0, FLG_RE_PCREL, 8, 0, 0},
93ba2be530Sab196087 /* R_AMD64_GOTOFF64 */	{0, FLG_RE_GOTREL, 8, 0, 0},
94ba2be530Sab196087 /* R_AMD64_GOTPC32 */	{0, FLG_RE_PCREL | FLG_RE_GOTPC | FLG_RE_LOCLBND,
95ba2be530Sab196087 			    4, 0, 0},
96ba2be530Sab196087 /* R_AMD64_GOT64 */	{0, FLG_RE_NOTSUP, 0, 0, 0},
97ba2be530Sab196087 /* R_AMD64_GOTPCREL64 */	{FLG_RE_NOTSUP, 0, 0, 0},
98ba2be530Sab196087 /* R_AMD64_GOTPC6 */	{0, FLG_RE_NOTSUP, 0, 0, 0},
99ba2be530Sab196087 /* R_AMD64_GOTPLT64 */	{0, FLG_RE_NOTSUP, 0, 0, 0},
100ba2be530Sab196087 /* R_AMD64_PLTOFF64 */	{0, FLG_RE_NOTSUP, 0, 0, 0},
101ba2be530Sab196087 /* R_AMD64_SIZE32 */	{0, FLG_RE_SIZE, 4, 0, 0},
102ba2be530Sab196087 /* R_AMD64_SIZE64 */	{0, FLG_RE_SIZE, 8, 0, 0}
1037c478bd9Sstevel@tonic-gate };
1042926dd2eSrie #if	(R_AMD64_NUM != (R_AMD64_SIZE64 + 1))
1057c478bd9Sstevel@tonic-gate #error	"R_AMD64_NUM has grown"
1067c478bd9Sstevel@tonic-gate #endif
1077c478bd9Sstevel@tonic-gate 
1087c478bd9Sstevel@tonic-gate /*
1097c478bd9Sstevel@tonic-gate  * Write a single relocated value to its reference location.
110552ff457Srie  * We assume we wish to add the relocation amount, value, to the
1117c478bd9Sstevel@tonic-gate  * value of the address already present at the offset.
1127c478bd9Sstevel@tonic-gate  *
1137c478bd9Sstevel@tonic-gate  * NAME			VALUE	FIELD		CALCULATION
1147c478bd9Sstevel@tonic-gate  *
1157c478bd9Sstevel@tonic-gate  * R_AMD64_NONE		 0	none		none
1167c478bd9Sstevel@tonic-gate  * R_AMD64_64		 1	word64		S + A
1177c478bd9Sstevel@tonic-gate  * R_AMD64_PC32		 2	word64		S + A
1187c478bd9Sstevel@tonic-gate  * R_AMD64_GOT32	 3	word32		G + A
1197c478bd9Sstevel@tonic-gate  * R_AMD64_PLT32	 4	word32		L + A - P
1207c478bd9Sstevel@tonic-gate  * R_AMD64_COPY		 5	none		none
1217c478bd9Sstevel@tonic-gate  * R_AMD64_GLOB_DAT	 6	word64		S
1227c478bd9Sstevel@tonic-gate  * R_AMD64_JUMP_SLOT	 7	word64		S
1237c478bd9Sstevel@tonic-gate  * R_AMD64_RELATIVE	 8	word64		B + A
1247c478bd9Sstevel@tonic-gate  * R_AMD64_GOTPCREL	 9	word32		G + GOT + A - P
1257c478bd9Sstevel@tonic-gate  * R_AMD64_32		10	word32		S + A
1267c478bd9Sstevel@tonic-gate  * R_AMD64_32S		11	word32		S + A
1277c478bd9Sstevel@tonic-gate  * R_AMD64_16		12	word16		S + A
1287c478bd9Sstevel@tonic-gate  * R_AMD64_PC16		13	word16		S + A - P
1297c478bd9Sstevel@tonic-gate  * R_AMD64_8		14	word8		S + A
1307c478bd9Sstevel@tonic-gate  * R_AMD64_PC8		15	word8		S + A - P
1317c478bd9Sstevel@tonic-gate  * R_AMD64_DTPMOD64	16	word64
1327c478bd9Sstevel@tonic-gate  * R_AMD64_DTPOFF64	17	word64
1337c478bd9Sstevel@tonic-gate  * R_AMD64_TPOFF64	18	word64
1347c478bd9Sstevel@tonic-gate  * R_AMD64_TLSGD	19	word32
1357c478bd9Sstevel@tonic-gate  * R_AMD64_TLSLD	20	word32
1367c478bd9Sstevel@tonic-gate  * R_AMD64_DTPOFF32	21	word32
1377c478bd9Sstevel@tonic-gate  * R_AMD64_GOTTPOFF	22	word32
1387c478bd9Sstevel@tonic-gate  * R_AMD64_TPOFF32	23	word32
1397c478bd9Sstevel@tonic-gate  * R_AMD64_PC64		24	word32		S + A - P
1407c478bd9Sstevel@tonic-gate  * R_AMD64_GOTOFF64	25	word32		S + A - GOT
1417c478bd9Sstevel@tonic-gate  * R_AMD64_GOTPC32	26	word32		GOT + A - P
142552ff457Srie  * R_AMD64_GOT64	27			reserved for future expansion
143552ff457Srie  * R_AMD64_GOTPCREL64	28			reserved for future expansion
144552ff457Srie  * R_AMD64_GOTPC64	29			reserved for future expansion
145552ff457Srie  * R_AMD64_GOTPLT64	30			reserved for future expansion
146552ff457Srie  * R_AMD64_PLTOFF64	31			reserved for future expansion
1472926dd2eSrie  * R_AMD64_SIZE32	32	word32		Z + A
1482926dd2eSrie  * R_AMD64_SIZE64	33	word64		Z + A
1497c478bd9Sstevel@tonic-gate  *
1507c478bd9Sstevel@tonic-gate  * Relocation calculations:
1517c478bd9Sstevel@tonic-gate  *	A	Represents the addend used to compute the value of the
1527c478bd9Sstevel@tonic-gate  *		relocatable field.
1537c478bd9Sstevel@tonic-gate  *
1547c478bd9Sstevel@tonic-gate  *	B	Represents the base address at which a shared objects has
1557c478bd9Sstevel@tonic-gate  *		been loaded into memory during executaion.  Generally, a
1567c478bd9Sstevel@tonic-gate  *		shared objects is built with a 0 base virtual address,
1577c478bd9Sstevel@tonic-gate  *		but the execution address will be different.
1587c478bd9Sstevel@tonic-gate  *
1597c478bd9Sstevel@tonic-gate  *	G	Represents the offset into the global offset table
1607c478bd9Sstevel@tonic-gate  *		at which the relocation entry's symbol will reside
1617c478bd9Sstevel@tonic-gate  *		during execution.
1627c478bd9Sstevel@tonic-gate  *
1637c478bd9Sstevel@tonic-gate  *	GOT	Rrepresents the address of the global offset table.
1647c478bd9Sstevel@tonic-gate  *
1657c478bd9Sstevel@tonic-gate  *	L	Represents the place (section offset or address) of
1667c478bd9Sstevel@tonic-gate  *		the Procedure Linkage Table entry for a symbol.
1677c478bd9Sstevel@tonic-gate  *
1687c478bd9Sstevel@tonic-gate  *	P	Represents the place (section offset or address) of the
1697c478bd9Sstevel@tonic-gate  *		storage unit being relocated (computed using r_offset).
1707c478bd9Sstevel@tonic-gate  *
1717c478bd9Sstevel@tonic-gate  *	S	Represents the value of the symbol whose index resides
1727c478bd9Sstevel@tonic-gate  *		in the relocation entry.
1732926dd2eSrie  *
1742926dd2eSrie  *	Z	the size of the symbol whose index resides in the relocation
1752926dd2eSrie  *		entry
1767c478bd9Sstevel@tonic-gate  */
1777c478bd9Sstevel@tonic-gate 
178*6136c589SRichard Lowe 
179*6136c589SRichard Lowe /*
180*6136c589SRichard Lowe  * Bits that must be cleared or identical for a value to act as if extended in
181*6136c589SRichard Lowe  * the given way.
182*6136c589SRichard Lowe  */
183*6136c589SRichard Lowe #define	ZEROEXBITS	0xffffffff00000000ULL
184*6136c589SRichard Lowe #define	SIGNEXBITS	0xffffffff80000000ULL
1857c478bd9Sstevel@tonic-gate 
186f3324781Sab196087 #if defined(_KERNEL)
187f3324781Sab196087 #define	lml	0		/* Needed by arglist of REL_ERR_* macros */
1887c478bd9Sstevel@tonic-gate int
189f3324781Sab196087 do_reloc_krtld(uchar_t rtype, uchar_t *off, Xword *value, const char *sym,
190f3324781Sab196087     const char *file)
191f3324781Sab196087 #elif defined(DO_RELOC_LIBLD)
192ba2be530Sab196087 /*ARGSUSED5*/
193f3324781Sab196087 int
194bf994817SAli Bahrami do_reloc_ld(Rel_desc *rdesc, uchar_t *off, Xword *value,
195bf994817SAli Bahrami     rel_desc_sname_func_t rel_desc_sname_func,
196f3324781Sab196087     const char *file, int bswap, void *lml)
197f3324781Sab196087 #else
198f3324781Sab196087 int
199f3324781Sab196087 do_reloc_rtld(uchar_t rtype, uchar_t *off, Xword *value, const char *sym,
2005aefb655Srie     const char *file, void *lml)
201f3324781Sab196087 #endif
2027c478bd9Sstevel@tonic-gate {
203bf994817SAli Bahrami #ifdef DO_RELOC_LIBLD
204bf994817SAli Bahrami #define	sym (* rel_desc_sname_func)(rdesc)
205bf994817SAli Bahrami 	uchar_t	rtype = rdesc->rel_rtype;
206bf994817SAli Bahrami #endif
2077c478bd9Sstevel@tonic-gate 	const Rel_entry	*rep;
2087c478bd9Sstevel@tonic-gate 
2097c478bd9Sstevel@tonic-gate 	rep = &reloc_table[rtype];
2107c478bd9Sstevel@tonic-gate 
211552ff457Srie 	switch (rep->re_fsize) {
212552ff457Srie 	case 1:
213552ff457Srie 		/* LINTED */
214552ff457Srie 		*((uchar_t *)off) = (uchar_t)(*value);
215552ff457Srie 		break;
216ba2be530Sab196087 
217552ff457Srie 	case 2:
218ba2be530Sab196087 #if defined(DORELOC_NATIVE)
219552ff457Srie 		/* LINTED */
220552ff457Srie 		*((Half *)off) = (Half)(*value);
221ba2be530Sab196087 #else
222ba2be530Sab196087 		{
223ba2be530Sab196087 			Half	v = (Half)(*value);
224ba2be530Sab196087 			uchar_t	*v_bytes = (uchar_t *)&v;
225ba2be530Sab196087 
226ba2be530Sab196087 			if (bswap) {
227ba2be530Sab196087 				UL_ASSIGN_BSWAP_HALF(off, v_bytes);
228ba2be530Sab196087 			} else {
229ba2be530Sab196087 				UL_ASSIGN_HALF(off, v_bytes);
230ba2be530Sab196087 			}
231ba2be530Sab196087 		}
232ba2be530Sab196087 #endif
233552ff457Srie 		break;
234ba2be530Sab196087 
235552ff457Srie 	case 4:
2367c478bd9Sstevel@tonic-gate 		/*
237552ff457Srie 		 * The amd64 psABI requires that we perform the following
238552ff457Srie 		 * verifications:
2397c478bd9Sstevel@tonic-gate 		 *
240552ff457Srie 		 *    The R_AMD64_32 and R_AMD64_32S relocations truncate the
241552ff457Srie 		 *    computed value to 32bits.  Verify that the generated value
242552ff457Srie 		 *    for the R_AMD64_32/32S relocation zero-extends (sign
243552ff457Srie 		 *    extends) to the original 64-bit value.
2447c478bd9Sstevel@tonic-gate 		 *
245552ff457Srie 		 * Also, the following relocations are all 32 bit PC relative
246552ff457Srie 		 * references.  Validate that the value being written will fit
247552ff457Srie 		 * in the field provided.
2487c478bd9Sstevel@tonic-gate 		 *
2497c478bd9Sstevel@tonic-gate 		 *    R_AMD64_PC32, R_AMD64_GOTPC32, R_AMD64_GOTPCREL
2507c478bd9Sstevel@tonic-gate 		 */
2517c478bd9Sstevel@tonic-gate 		if (rtype == R_AMD64_32) {
2527c478bd9Sstevel@tonic-gate 			/*
253*6136c589SRichard Lowe 			 * Verify that this value will act as a zero-extended
254*6136c589SRichard Lowe 			 * unsigned 32 bit value.  That is, that the upper
255*6136c589SRichard Lowe 			 * 32 bits are zero.
2567c478bd9Sstevel@tonic-gate 			 */
257*6136c589SRichard Lowe 			if ((*value & ZEROEXBITS) != 0) {
2587c478bd9Sstevel@tonic-gate 				/*
259552ff457Srie 				 * To keep chkmsg() happy:
2607c478bd9Sstevel@tonic-gate 				 *  MSG_INTL(MSG_REL_NOFIT)
2617c478bd9Sstevel@tonic-gate 				 */
2625aefb655Srie 				REL_ERR_NOFIT(lml, file, sym, rtype, *value);
2637c478bd9Sstevel@tonic-gate 				return (0);
2647c478bd9Sstevel@tonic-gate 			}
265552ff457Srie 		} else if ((rtype == R_AMD64_32S) || (rtype == R_AMD64_PC32) ||
266552ff457Srie 		    (rtype == R_AMD64_GOTPCREL) || (rtype == R_AMD64_GOTPC32)) {
2677c478bd9Sstevel@tonic-gate 			/*
268*6136c589SRichard Lowe 			 * Verify that this value will act as a sign-extended
269*6136c589SRichard Lowe 			 * signed 32 bit value, that is that the upper 33 bits
270*6136c589SRichard Lowe 			 * are either all zero or all one.
2717c478bd9Sstevel@tonic-gate 			 */
272*6136c589SRichard Lowe 			if (((*value & SIGNEXBITS) != SIGNEXBITS) &&
273*6136c589SRichard Lowe 			    ((*value & SIGNEXBITS) != 0)) {
2747c478bd9Sstevel@tonic-gate 				/*
275552ff457Srie 				 * To keep chkmsg() happy:
2767c478bd9Sstevel@tonic-gate 				 *  MSG_INTL(MSG_REL_NOFIT)
2777c478bd9Sstevel@tonic-gate 				 */
2785aefb655Srie 				REL_ERR_NOFIT(lml, file, sym, rtype, *value);
2797c478bd9Sstevel@tonic-gate 				return (0);
2807c478bd9Sstevel@tonic-gate 			}
2817c478bd9Sstevel@tonic-gate 		}
282ba2be530Sab196087 
283ba2be530Sab196087 #if defined(DORELOC_NATIVE)
2847c478bd9Sstevel@tonic-gate 		/* LINTED */
2857c478bd9Sstevel@tonic-gate 		*((Word *)off) += *value;
286ba2be530Sab196087 #else
287ba2be530Sab196087 		{
288ba2be530Sab196087 			Word	v;
289ba2be530Sab196087 			uchar_t	*v_bytes = (uchar_t *)&v;
290ba2be530Sab196087 
291ba2be530Sab196087 			if (bswap) {
292ba2be530Sab196087 				UL_ASSIGN_BSWAP_WORD(v_bytes, off);
293ba2be530Sab196087 				v += *value;
294ba2be530Sab196087 				UL_ASSIGN_BSWAP_WORD(off, v_bytes);
295ba2be530Sab196087 			} else {
296ba2be530Sab196087 				UL_ASSIGN_WORD(v_bytes, off);
297ba2be530Sab196087 				v += *value;
298ba2be530Sab196087 				UL_ASSIGN_WORD(off, v_bytes);
299ba2be530Sab196087 			}
300ba2be530Sab196087 		}
301ba2be530Sab196087 #endif
302552ff457Srie 		break;
303ba2be530Sab196087 
304552ff457Srie 	case 8:
305ba2be530Sab196087 #if defined(DORELOC_NATIVE)
306552ff457Srie 		/* LINTED */
3077c478bd9Sstevel@tonic-gate 		*((Xword *)off) += *value;
308ba2be530Sab196087 #else
309ba2be530Sab196087 		{
310ba2be530Sab196087 			Xword	v;
311ba2be530Sab196087 			uchar_t	*v_bytes = (uchar_t *)&v;
312ba2be530Sab196087 
313ba2be530Sab196087 			if (bswap) {
314ba2be530Sab196087 				UL_ASSIGN_BSWAP_XWORD(v_bytes, off);
315ba2be530Sab196087 				v += *value;
316ba2be530Sab196087 				UL_ASSIGN_BSWAP_XWORD(off, v_bytes);
317ba2be530Sab196087 			} else {
318ba2be530Sab196087 				UL_ASSIGN_XWORD(v_bytes, off);
319ba2be530Sab196087 				v += *value;
320ba2be530Sab196087 				UL_ASSIGN_XWORD(off, v_bytes);
321ba2be530Sab196087 			}
322ba2be530Sab196087 		}
323ba2be530Sab196087 #endif
324552ff457Srie 		break;
325552ff457Srie 	default:
326552ff457Srie 		/*
327552ff457Srie 		 * To keep chkmsg() happy: MSG_INTL(MSG_REL_UNSUPSZ)
328552ff457Srie 		 */
3295aefb655Srie 		REL_ERR_UNSUPSZ(lml, file, sym, rtype, rep->re_fsize);
3307c478bd9Sstevel@tonic-gate 		return (0);
3317c478bd9Sstevel@tonic-gate 	}
3327c478bd9Sstevel@tonic-gate 	return (1);
333bf994817SAli Bahrami 
334bf994817SAli Bahrami #ifdef DO_RELOC_LIBLD
335bf994817SAli Bahrami #undef sym
336bf994817SAli Bahrami #endif
3377c478bd9Sstevel@tonic-gate }
338