1 /* COFF spec for AMD 290*0
3 Copyright 2001 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 Contributed by David Wood @ New York University. */
26 #include "coff/external.h"
29 ** Magic numbers for Am29000
30 ** (AT&T will assign the "real" magic number)
33 #define SIPFBOMAGIC 0572 /* Am29000 (Byte 0 is MSB) */
34 #define SIPRBOMAGIC 0573 /* Am29000 (Byte 0 is LSB) */
36 #define A29K_MAGIC_BIG SIPFBOMAGIC
37 #define A29K_MAGIC_LITTLE SIPRBOMAGIC
38 #define A29KBADMAG(x) ( ((x).f_magic != A29K_MAGIC_BIG) && \
39 ((x).f_magic != A29K_MAGIC_LITTLE))
41 #define OMAGIC A29K_MAGIC_BIG
42 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
45 ** File header flags currently known to us.
47 ** Am29000 will use the F_AR32WR and F_AR32W flags to indicate
48 ** the byte ordering in the file.
51 /*--------------------------------------------------------------*/
54 /* aouthdr magic numbers */
55 #define NMAGIC 0410 /* separate i/d executable */
56 #define SHMAGIC 0406 /* NYU/Ultra3 shared data executable
59 #define _ETEXT "_etext"
61 /*--------------------------------------------------------------*/
64 /* More names of "special" sections. */
67 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
70 ** Section types - with additional section type for global
71 ** registers which will be relocatable for the Am29000.
73 ** In instances where it is necessary for a linker to produce an
74 ** output file which contains text or data not based at virtual
75 ** address 0, e.g. for a ROM, then the linker should accept
76 ** address base information as command input and use PAD sections
77 ** to skip over unused addresses.
80 #define STYP_BSSREG 0x1200 /* Global register area (like STYP_INFO) */
81 #define STYP_ENVIR 0x2200 /* Environment (like STYP_INFO) */
82 #define STYP_ABS 0x4000 /* Absolute (allocated, not reloc, loaded) */
84 /*--------------------------------------------------------------*/
87 ** Relocation information declaration and related definitions
92 char r_vaddr
[4]; /* (virtual) address of reference */
93 char r_symndx
[4]; /* index into symbol table */
94 char r_type
[2]; /* relocation type */
97 #define RELOC struct external_reloc
98 #define RELSZ 10 /* sizeof (RELOC) */
100 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
103 ** Relocation types for the Am29000
106 #define R_ABS 0 /* reference is absolute */
108 #define R_IREL 030 /* instruction relative (jmp/call) */
109 #define R_IABS 031 /* instruction absolute (jmp/call) */
110 #define R_ILOHALF 032 /* instruction low half (const) */
111 #define R_IHIHALF 033 /* instruction high half (consth) part 1 */
112 #define R_IHCONST 034 /* instruction high half (consth) part 2 */
113 /* constant offset of R_IHIHALF relocation */
114 #define R_BYTE 035 /* relocatable byte value */
115 #define R_HWORD 036 /* relocatable halfword value */
116 #define R_WORD 037 /* relocatable word value */
118 #define R_IGLBLRC 040 /* instruction global register RC */
119 #define R_IGLBLRA 041 /* instruction global register RA */
120 #define R_IGLBLRB 042 /* instruction global register RB */
124 All the "I" forms refer to 29000 instruction formats. The linker is
125 expected to know how the numeric information is split and/or aligned
126 within the instruction word(s). R_BYTE works for instructions, too.
128 If the parameter to a CONSTH instruction is a relocatable type, two
129 relocation records are written. The first has an r_type of R_IHIHALF
130 (33 octal) and a normal r_vaddr and r_symndx. The second relocation
131 record has an r_type of R_IHCONST (34 octal), a normal r_vaddr (which
132 is redundant), and an r_symndx containing the 32-bit constant offset
133 to the relocation instead of the actual symbol table index. This
134 second record is always written, even if the constant offset is zero.
135 The constant fields of the instruction are set to zero.
138 /*--------------------------------------------------------------*/
140 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
143 ** Storage class definitions - new classes for global registers.
146 #define C_GLBLREG 19 /* global register */
147 #define C_EXTREG 20 /* external global register */
148 #define C_DEFREG 21 /* ext. def. of global register */