arm: Support pac_key_* register operand for MRS/MSR in Armv8.1-M Mainline
[binutils-gdb.git] / include / coff / external.h
blobfc68b357968dd640aad5782bb5ddfd2d347aafa3
1 /* external.h -- External COFF structures
3 Copyright (C) 2001-2024 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 3 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., 51 Franklin Street - Fifth Floor, Boston,
18 MA 02110-1301, USA. */
20 #ifndef COFF_EXTERNAL_H
21 #define COFF_EXTERNAL_H
23 #ifndef DO_NOT_DEFINE_FILHDR
24 /********************** FILE HEADER **********************/
26 struct external_filehdr
28 char f_magic[2]; /* magic number */
29 char f_nscns[2]; /* number of sections */
30 char f_timdat[4]; /* time & date stamp */
31 char f_symptr[4]; /* file pointer to symtab */
32 char f_nsyms[4]; /* number of symtab entries */
33 char f_opthdr[2]; /* sizeof(optional hdr) */
34 char f_flags[2]; /* flags */
37 #define FILHDR struct external_filehdr
38 #define FILHSZ 20
39 #endif
41 #ifndef DO_NOT_DEFINE_AOUTHDR
42 /********************** AOUT "OPTIONAL HEADER" **********************/
44 typedef struct external_aouthdr
46 char magic[2]; /* type of file */
47 char vstamp[2]; /* version stamp */
48 char tsize[4]; /* text size in bytes, padded to FW bdry*/
49 char dsize[4]; /* initialized data " " */
50 char bsize[4]; /* uninitialized data " " */
51 char entry[4]; /* entry pt. */
52 char text_start[4]; /* base of text used for this file */
53 char data_start[4]; /* base of data used for this file */
54 } ATTRIBUTE_PACKED
55 AOUTHDR;
57 #define AOUTHDRSZ 28
58 #define AOUTSZ 28
60 typedef struct external_aouthdr64
62 char magic[2]; /* Type of file. */
63 char vstamp[2]; /* Version stamp. */
64 char tsize[4]; /* Text size in bytes, padded to FW bdry*/
65 char dsize[4]; /* Initialized data " ". */
66 char bsize[4]; /* Uninitialized data " ". */
67 char entry[4]; /* Entry pt. */
68 char text_start[4]; /* Base of text used for this file. */
70 AOUTHDR64;
71 #define AOUTHDRSZ64 24
73 #endif /* not DO_NOT_DEFINE_AOUTHDR */
75 #ifndef DO_NOT_DEFINE_SCNHDR
76 /********************** SECTION HEADER **********************/
78 struct external_scnhdr
80 char s_name[8]; /* section name */
81 char s_paddr[4]; /* physical address, aliased s_nlib */
82 char s_vaddr[4]; /* virtual address */
83 char s_size[4]; /* section size */
84 char s_scnptr[4]; /* file ptr to raw data for section */
85 char s_relptr[4]; /* file ptr to relocation */
86 char s_lnnoptr[4]; /* file ptr to line numbers */
87 char s_nreloc[2]; /* number of relocation entries */
88 char s_nlnno[2]; /* number of line number entries */
89 char s_flags[4]; /* flags */
92 #define SCNHDR struct external_scnhdr
93 #define SCNHSZ 40
95 /* Names of "special" sections. */
97 #define _TEXT ".text"
98 #define _DATA ".data"
99 #define _BSS ".bss"
100 #define _COMMENT ".comment"
101 #define _LIB ".lib"
102 #endif /* not DO_NOT_DEFINE_SCNHDR */
104 #ifndef DO_NOT_DEFINE_LINENO
106 /********************** LINE NUMBERS **********************/
108 #ifndef L_LNNO_SIZE
109 #error L_LNNO_SIZE needs to be defined
110 #endif
112 /* 1 line number entry for every "breakpointable" source line in a section.
113 Line numbers are grouped on a per function basis; first entry in a function
114 grouping will have l_lnno = 0 and in place of physical address will be the
115 symbol table index of the function name. */
116 struct external_lineno
118 union
120 char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/
121 char l_paddr[4]; /* (physical) address of line number */
122 } l_addr;
124 char l_lnno[L_LNNO_SIZE]; /* line number */
127 #define LINENO struct external_lineno
128 #define LINESZ (4 + L_LNNO_SIZE)
130 #if L_LNNO_SIZE == 4
131 #define GET_LINENO_LNNO(abfd, ext) H_GET_32 (abfd, (ext->l_lnno))
132 #define PUT_LINENO_LNNO(abfd, val, ext) H_PUT_32 (abfd, val, (ext->l_lnno))
133 #endif
134 #if L_LNNO_SIZE == 2
135 #define GET_LINENO_LNNO(abfd, ext) H_GET_16 (abfd, (ext->l_lnno))
136 #define PUT_LINENO_LNNO(abfd, val, ext) H_PUT_16 (abfd, val, (ext->l_lnno))
137 #endif
139 #endif /* not DO_NOT_DEFINE_LINENO */
141 #ifndef DO_NOT_DEFINE_SYMENT
142 /********************** SYMBOLS **********************/
144 #define E_SYMNMLEN 8 /* # characters in a symbol name */
145 #ifndef E_FILNMLEN
146 #define E_FILNMLEN 14
147 #endif
148 #define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
150 struct external_syment
152 union
154 char e_name[E_SYMNMLEN];
156 struct
158 char e_zeroes[4];
159 char e_offset[4];
160 } e;
161 } e;
163 char e_value[4];
164 char e_scnum[2];
165 char e_type[2];
166 char e_sclass[1];
167 char e_numaux[1];
168 } ATTRIBUTE_PACKED ;
170 #define SYMENT struct external_syment
171 #define SYMESZ 18
173 #ifndef N_BTMASK
174 #define N_BTMASK 0xf
175 #endif
177 #ifndef N_TMASK
178 #define N_TMASK 0x30
179 #endif
181 #ifndef N_BTSHFT
182 #define N_BTSHFT 4
183 #endif
185 #ifndef N_TSHIFT
186 #define N_TSHIFT 2
187 #endif
189 #endif /* not DO_NOT_DEFINE_SYMENT */
191 #ifndef DO_NOT_DEFINE_AUXENT
193 union external_auxent
195 struct
197 char x_tagndx[4]; /* str, un, or enum tag indx */
199 union
201 struct
203 char x_lnno[2]; /* declaration line number */
204 char x_size[2]; /* str/union/array size */
205 } x_lnsz;
207 char x_fsize[4]; /* size of function */
209 } x_misc;
211 union
213 struct /* if ISFCN, tag, or .bb */
215 char x_lnnoptr[4]; /* ptr to fcn line # */
216 char x_endndx[4]; /* entry ndx past block end */
217 } x_fcn;
219 struct /* if ISARY, up to 4 dimen. */
221 char x_dimen[E_DIMNUM][2];
222 } x_ary;
224 } x_fcnary;
226 char x_tvndx[2]; /* tv index */
228 } x_sym;
230 union
232 char x_fname[E_FILNMLEN];
234 struct
236 char x_zeroes[4];
237 char x_offset[4];
238 } x_n;
240 } x_file;
242 struct
244 char x_scnlen[4]; /* section length */
245 char x_nreloc[2]; /* # relocation entries */
246 char x_nlinno[2]; /* # line numbers */
247 #ifdef INCLUDE_COMDAT_FIELDS_IN_AUXENT
248 char x_checksum[4]; /* section COMDAT checksum */
249 char x_associated[2]; /* COMDAT associated section index */
250 char x_comdat[1]; /* COMDAT selection number */
251 #endif
252 } x_scn;
254 struct
256 char x_tvfill[4]; /* tv fill value */
257 char x_tvlen[2]; /* length of .tv */
258 char x_tvran[2][2]; /* tv range */
259 } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
260 } ATTRIBUTE_PACKED ;
262 #define AUXENT union external_auxent
263 #define AUXESZ 18
265 #define _ETEXT "etext"
267 #endif /* not DO_NOT_DEFINE_AUXENT */
269 #endif /* COFF_EXTERNAL_H */