xref: /csrg-svn/sys/sparc/include/reloc.h (revision 63320)
155125Storek /*
2*63320Sbostic  * Copyright (c) 1992, 1993
3*63320Sbostic  *	The Regents of the University of California.  All rights reserved.
455125Storek  *
555125Storek  * This software was developed by the Computer Systems Engineering group
655125Storek  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
755125Storek  * contributed to Berkeley.
855125Storek  *
955501Sbostic  * All advertising materials mentioning features or use of this software
1055501Sbostic  * must display the following acknowledgement:
1155501Sbostic  *	This product includes software developed by the University of
1259210Storek  *	California, Lawrence Berkeley Laboratory.
1355501Sbostic  *
1455125Storek  * %sccs.include.redist.c%
1555125Storek  *
16*63320Sbostic  *	@(#)reloc.h	8.1 (Berkeley) 06/11/93
1755125Storek  *
1859210Storek  * from: $Header: reloc.h,v 1.7 92/11/26 02:04:45 torek Exp $
1955125Storek  */
2055125Storek 
2155125Storek /*
2255125Storek  * SPARC relocations.  The linker has, unfortunately, a large number
2355125Storek  * of link types.  We do not do dynamic linking (yet?) but we define
2455125Storek  * the dynamic link types.
2555125Storek  */
2655125Storek enum reloc_type {
2755125Storek 		/* architecturally-required types */
2855125Storek 	RELOC_8,		/*  8-bit absolute */
2955125Storek 	RELOC_16,		/* 16-bit absolute */
3055125Storek 	RELOC_32,		/* 32-bit absolute */
3155125Storek 	RELOC_DISP8,		/*  8-bit pc-relative */
3255125Storek 	RELOC_DISP16,		/* 16-bit pc-relative */
3355125Storek 	RELOC_DISP32,		/* 32-bit pc-relative */
3455125Storek 	RELOC_WDISP30,		/* 30-bit pc-relative signed word */
3555125Storek 	RELOC_WDISP22,		/* 22-bit pc-relative signed word */
3655125Storek 	RELOC_HI22,		/* 22-bit `%hi' (ie, sethi %hi(X),%l0) */
3755125Storek 	RELOC_22,		/* 22-bit non-%hi (i.e., sethi X,%l0) */
3855125Storek 	RELOC_13,		/* 13-bit absolute */
3955125Storek 	RELOC_LO10,		/* 10-bit `%lo' */
4055125Storek 
4155125Storek 		/* gnu ld understands some of these, but I do not */
4255125Storek 	RELOC_SFA_BASE,		/* ? */
4355125Storek 	RELOC_SFA_OFF13,	/* ? */
4455125Storek 	RELOC_BASE10,		/* ? */
4555125Storek 	RELOC_BASE13,		/* ? */
4655125Storek 	RELOC_BASE22,		/* ? */
4755125Storek 
4855125Storek 		/* gnu ld does not use these but Sun linker does */
4955125Storek 		/* we define them anyway (note that they are included
5055125Storek 		   in the freely-available gas sources!) */
5155125Storek 	RELOC_PC10,		/* ? */
5255125Storek 	RELOC_PC22,		/* ? */
5355125Storek 	RELOC_JMP_TBL,		/* ? */
5455125Storek 	RELOC_SEGOFF16,		/* ? */
5555125Storek 	RELOC_GLOB_DAT,		/* ? */
5655125Storek 	RELOC_JMP_SLOT,		/* ? */
5755125Storek 	RELOC_RELATIVE,		/* ? */
5855125Storek };
5955125Storek 
6055125Storek /*
6155125Storek  * SPARC relocation info.
6255125Storek  *
6355125Storek  * Symbol-relative relocation is done by:
6455125Storek  *	1. locating the appropriate symbol
6555125Storek  *	2. if defined, adding (value + r_addend), subtracting pc if pc-rel,
6655125Storek  *	   and then shifting down 2 or 10 or 13 if necessary.
6755125Storek  * The resulting value is then to be stuffed into the appropriate bits
6855125Storek  * in the object (the low 22, or the high 30, or ..., etc).
6955125Storek  */
7055125Storek struct reloc_info_sparc {
7155125Storek 	u_long	r_address;	/* relocation addr (offset in segment) */
7255125Storek 	u_int	r_index:24,	/* segment (r_extern==0) or symbol index */
7355125Storek 		r_extern:1,	/* if set, r_index is symbol index */
7455125Storek 		:2;		/* unused */
7555125Storek 	enum reloc_type r_type:5; /* relocation type, from above */
7655125Storek 	long	r_addend;	/* value to add to symbol value */
7755125Storek };
78