sparc.h revision 59024
116Salm/* SPARC ELF support for BFD.
216Salm   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
316Salm   By Doug Evans, Cygnus Support, <dje@cygnus.com>.
416Salm
516SalmThis file is part of BFD, the Binary File Descriptor library.
6
7This program is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2 of the License, or
10(at your option) any later version.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with this program; if not, write to the Free Software
19Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
20
21#ifndef _ELF_SPARC_H
22#define _ELF_SPARC_H
23
24/* Processor specific flags for the ELF header e_flags field.  */
25
26/* These are defined by Sun.  */
27
28#define EF_SPARC_32PLUS_MASK	0xffff00	/* bits indicating V8+ type */
29#define EF_SPARC_32PLUS		0x000100	/* generic V8+ features */
30#define EF_SPARC_SUN_US1	0x000200	/* Sun UltraSPARC1 extensions */
31#define EF_SPARC_HAL_R1		0x000400	/* HAL R1 extensions */
32
33/* This name is used in the V9 ABI.  */
34#define EF_SPARC_EXT_MASK	0xffff00	/* reserved for vendor extensions */
35
36/* V9 memory models */
37#define EF_SPARCV9_MM		0x3		/* memory model mask */
38#define EF_SPARCV9_TSO		0x0		/* total store ordering */
39#define EF_SPARCV9_PSO		0x1		/* partial store ordering */
40#define EF_SPARCV9_RMO		0x2		/* relaxed store ordering */
41
42/* Section indices.  */
43
44#define SHN_BEFORE		0xff00		/* used with SHF_ORDERED */
45#define SHN_AFTER		0xff01		/* used with SHF_ORDERED */
46
47/* Section flags.  */
48
49#define SHF_EXCLUDE		0x80000000	/* exclude from linking */
50#define SHF_ORDERED		0x40000000	/* treat sh_link,sh_info specially */
51
52/* Symbol types.  */
53
54#define STT_REGISTER		13		/* global reg reserved to app. */
55
56/* Relocation types.  */
57
58enum elf_sparc_reloc_type {
59    R_SPARC_NONE = 0,
60    R_SPARC_8, R_SPARC_16, R_SPARC_32,
61    R_SPARC_DISP8, R_SPARC_DISP16, R_SPARC_DISP32,
62    R_SPARC_WDISP30, R_SPARC_WDISP22,
63    R_SPARC_HI22, R_SPARC_22,
64    R_SPARC_13, R_SPARC_LO10,
65    R_SPARC_GOT10, R_SPARC_GOT13, R_SPARC_GOT22,
66    R_SPARC_PC10, R_SPARC_PC22,
67    R_SPARC_WPLT30,
68    R_SPARC_COPY,
69    R_SPARC_GLOB_DAT, R_SPARC_JMP_SLOT,
70    R_SPARC_RELATIVE,
71    R_SPARC_UA32,
72
73    /* ??? These 6 relocs are new but not currently used.  For binary
74       compatility in the sparc64-elf toolchain, we leave them out.
75       A non-binary upward compatible change is expected for sparc64-elf.  */
76#ifndef SPARC64_OLD_RELOCS
77    /* ??? New relocs on the UltraSPARC.  Not sure what they're for yet.  */
78    R_SPARC_PLT32, R_SPARC_HIPLT22, R_SPARC_LOPLT10,
79    R_SPARC_PCPLT32, R_SPARC_PCPLT22, R_SPARC_PCPLT10,
80#endif
81
82    /* v9 relocs */
83    R_SPARC_10, R_SPARC_11, R_SPARC_64,
84    R_SPARC_OLO10, R_SPARC_HH22, R_SPARC_HM10, R_SPARC_LM22,
85    R_SPARC_PC_HH22, R_SPARC_PC_HM10, R_SPARC_PC_LM22,
86    R_SPARC_WDISP16, R_SPARC_WDISP19,
87    R_SPARC_UNUSED_42,
88    R_SPARC_7, R_SPARC_5, R_SPARC_6,
89    R_SPARC_DISP64, R_SPARC_PLT64,
90    R_SPARC_HIX22, R_SPARC_LOX10,
91    R_SPARC_H44, R_SPARC_M44, R_SPARC_L44,
92    R_SPARC_REGISTER,
93    R_SPARC_UA64, R_SPARC_UA16,
94
95    R_SPARC_max
96};
97
98/* Relocation macros.  */
99
100#define ELF64_R_TYPE_DATA(info)		(((bfd_vma) (info) << 32) >> 40)
101#define ELF64_R_TYPE_ID(info)		(((bfd_vma) (info) << 56) >> 56)
102#define ELF64_R_TYPE_INFO(data, type)	(((bfd_vma) (data) << 8) \
103					 + (bfd_vma) (type))
104
105#define DT_SPARC_REGISTER	0x70000001
106
107/*
108 * FIXME: NOT ABI -- GET RID OF THIS
109 * Defines the format used by the .plt.  Currently defined values are
110 *   0 -- reserved to SI
111 *   1 -- absolute address in .got.plt
112 *   2 -- got-relative address in .got.plt
113 */
114
115#define DT_SPARC_PLTFMT		0x70000001
116
117#endif /* _ELF_SPARC_H */
118