1*a9fa9459Szrj /* ALPHA ELF support for BFD.
2*a9fa9459Szrj    Copyright (C) 1996-2016 Free Software Foundation, Inc.
3*a9fa9459Szrj 
4*a9fa9459Szrj    By Eric Youngdale, <eric@aib.com>.  No processor supplement available
5*a9fa9459Szrj    for this platform.
6*a9fa9459Szrj 
7*a9fa9459Szrj    This file is part of BFD, the Binary File Descriptor library.
8*a9fa9459Szrj 
9*a9fa9459Szrj    This program is free software; you can redistribute it and/or modify
10*a9fa9459Szrj    it under the terms of the GNU General Public License as published by
11*a9fa9459Szrj    the Free Software Foundation; either version 3 of the License, or
12*a9fa9459Szrj    (at your option) any later version.
13*a9fa9459Szrj 
14*a9fa9459Szrj    This program is distributed in the hope that it will be useful,
15*a9fa9459Szrj    but WITHOUT ANY WARRANTY; without even the implied warranty of
16*a9fa9459Szrj    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17*a9fa9459Szrj    GNU General Public License for more details.
18*a9fa9459Szrj 
19*a9fa9459Szrj    You should have received a copy of the GNU General Public License
20*a9fa9459Szrj    along with this program; if not, write to the Free Software
21*a9fa9459Szrj    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
22*a9fa9459Szrj    MA 02110-1301, USA.  */
23*a9fa9459Szrj 
24*a9fa9459Szrj /* This file holds definitions specific to the ALPHA ELF ABI.  Note
25*a9fa9459Szrj    that most of this is not actually implemented by BFD.  */
26*a9fa9459Szrj 
27*a9fa9459Szrj #ifndef _ELF_ALPHA_H
28*a9fa9459Szrj #define _ELF_ALPHA_H
29*a9fa9459Szrj 
30*a9fa9459Szrj /* Processor specific flags for the ELF header e_flags field.  */
31*a9fa9459Szrj 
32*a9fa9459Szrj /* All addresses must be below 2GB.  */
33*a9fa9459Szrj #define EF_ALPHA_32BIT		0x00000001
34*a9fa9459Szrj 
35*a9fa9459Szrj /* All relocations needed for relaxation with code movement are present.  */
36*a9fa9459Szrj #define EF_ALPHA_CANRELAX	0x00000002
37*a9fa9459Szrj 
38*a9fa9459Szrj /* Processor specific section flags.  */
39*a9fa9459Szrj 
40*a9fa9459Szrj /* This section must be in the global data area.  */
41*a9fa9459Szrj #define SHF_ALPHA_GPREL		0x10000000
42*a9fa9459Szrj 
43*a9fa9459Szrj /* Section contains some sort of debugging information.  The exact
44*a9fa9459Szrj    format is unspecified.  It's probably ECOFF symbols.  */
45*a9fa9459Szrj #define SHT_ALPHA_DEBUG		0x70000001
46*a9fa9459Szrj 
47*a9fa9459Szrj /* Section contains register usage information.  */
48*a9fa9459Szrj #define SHT_ALPHA_REGINFO	0x70000002
49*a9fa9459Szrj 
50*a9fa9459Szrj /* A section of type SHT_MIPS_REGINFO contains the following
51*a9fa9459Szrj    structure.  */
52*a9fa9459Szrj typedef struct
53*a9fa9459Szrj {
54*a9fa9459Szrj   /* Mask of general purpose registers used.  */
55*a9fa9459Szrj   unsigned long ri_gprmask;
56*a9fa9459Szrj   /* Mask of co-processor registers used.  */
57*a9fa9459Szrj   unsigned long ri_cprmask[4];
58*a9fa9459Szrj   /* GP register value for this object file.  */
59*a9fa9459Szrj   long ri_gp_value;
60*a9fa9459Szrj } Elf64_RegInfo;
61*a9fa9459Szrj 
62*a9fa9459Szrj /* Special values for the st_other field in the symbol table.  */
63*a9fa9459Szrj 
64*a9fa9459Szrj #define STO_ALPHA_NOPV		0x80
65*a9fa9459Szrj #define STO_ALPHA_STD_GPLOAD	0x88
66*a9fa9459Szrj 
67*a9fa9459Szrj /* Special values for Elf64_Dyn tag.  */
68*a9fa9459Szrj #define DT_ALPHA_PLTRO		DT_LOPROC
69*a9fa9459Szrj 
70*a9fa9459Szrj #include "elf/reloc-macros.h"
71*a9fa9459Szrj 
72*a9fa9459Szrj /* Alpha relocs.  */
73*a9fa9459Szrj START_RELOC_NUMBERS (elf_alpha_reloc_type)
74*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_NONE, 0)	/* No reloc */
75*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_REFLONG, 1)	/* Direct 32 bit */
76*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_REFQUAD, 2)	/* Direct 64 bit */
77*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_GPREL32, 3)	/* GP relative 32 bit */
78*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_LITERAL, 4)	/* GP relative 16 bit w/optimization */
79*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_LITUSE, 5)	/* Optimization hint for LITERAL */
80*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_GPDISP, 6)	/* Add displacement to GP */
81*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_BRADDR, 7)	/* PC+4 relative 23 bit shifted */
82*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_HINT, 8)	/* PC+4 relative 16 bit shifted */
83*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_SREL16, 9)	/* PC relative 16 bit */
84*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_SREL32, 10)	/* PC relative 32 bit */
85*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_SREL64, 11)	/* PC relative 64 bit */
86*a9fa9459Szrj 
87*a9fa9459Szrj   /* Skip 12 - 16; deprecated ECOFF relocs.  */
88*a9fa9459Szrj 
89*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_GPRELHIGH, 17)	/* GP relative 32 bit, high 16 bits */
90*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_GPRELLOW, 18)	/* GP relative 32 bit, low 16 bits */
91*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_GPREL16, 19)	/* GP relative 16 bit */
92*a9fa9459Szrj 
93*a9fa9459Szrj   /* Skip 20 - 23; deprecated ECOFF relocs.  */
94*a9fa9459Szrj 
95*a9fa9459Szrj   /* These relocations are specific to shared libraries.  */
96*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_COPY, 24)	/* Copy symbol at runtime */
97*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_GLOB_DAT, 25)	/* Create GOT entry */
98*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_JMP_SLOT, 26)	/* Create PLT entry */
99*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_RELATIVE, 27)	/* Adjust by program base */
100*a9fa9459Szrj 
101*a9fa9459Szrj   /* Like BRADDR, but assert that the source and target object file
102*a9fa9459Szrj      share the same GP value, and adjust the target address for
103*a9fa9459Szrj      STO_ALPHA_STD_GPLOAD.  */
104*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_BRSGP, 28)
105*a9fa9459Szrj 
106*a9fa9459Szrj   /* Thread-Local Storage.  */
107*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_TLSGD, 29)
108*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_TLSLDM, 30)
109*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_DTPMOD64, 31)
110*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_GOTDTPREL, 32)
111*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_DTPREL64, 33)
112*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_DTPRELHI, 34)
113*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_DTPRELLO, 35)
114*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_DTPREL16, 36)
115*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_GOTTPREL, 37)
116*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_TPREL64, 38)
117*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_TPRELHI, 39)
118*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_TPRELLO, 40)
119*a9fa9459Szrj   RELOC_NUMBER (R_ALPHA_TPREL16, 41)
120*a9fa9459Szrj 
121*a9fa9459Szrj END_RELOC_NUMBERS (R_ALPHA_max)
122*a9fa9459Szrj 
123*a9fa9459Szrj #define LITUSE_ALPHA_ADDR	0
124*a9fa9459Szrj #define LITUSE_ALPHA_BASE	1
125*a9fa9459Szrj #define LITUSE_ALPHA_BYTOFF	2
126*a9fa9459Szrj #define LITUSE_ALPHA_JSR	3
127*a9fa9459Szrj #define LITUSE_ALPHA_TLSGD	4
128*a9fa9459Szrj #define LITUSE_ALPHA_TLSLDM	5
129*a9fa9459Szrj #define LITUSE_ALPHA_JSRDIRECT	6
130*a9fa9459Szrj 
131*a9fa9459Szrj #endif /* _ELF_ALPHA_H */
132