1 /* Motorola MCore support for BFD.
2 Copyright (C) 1999 Free Software Foundation, Inc.
4 This file is part of BFD, the Binary File Descriptor library.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20 /* This file holds definitions specific to the MCore COFF/PE ABI. */
26 #define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
28 #define IMAGE_REL_MCORE_ABSOLUTE 0x0000
29 #define IMAGE_REL_MCORE_ADDR32 0x0001
30 #define IMAGE_REL_MCORE_PCREL_IMM8BY4 0x0002
31 #define IMAGE_REL_MCORE_PCREL_IMM11BY2 0x0003
32 #define IMAGE_REL_MCORE_PCREL_IMM4BY2 0x0004
33 #define IMAGE_REL_MCORE_PCREL_32 0x0005
34 #define IMAGE_REL_MCORE_PCREL_JSR_IMM11BY2 0x0006
35 #define IMAGE_REL_MCORE_RVA 0x0007
41 char magic
[2]; /* type of file */
42 char vstamp
[2]; /* version stamp */
43 char tsize
[4]; /* text size in bytes, padded to FW bdry*/
44 char dsize
[4]; /* initialized data " " */
45 char bsize
[4]; /* uninitialized data " " */
46 char entry
[4]; /* entry pt. */
47 char text_start
[4]; /* base of text used for this file */
48 char data_start
[4]; /* base of data used for this file */
55 #define OMAGIC 0404 /* object files, eg as output */
56 #define ZMAGIC 0413 /* demand load format, eg normal ld output */
57 #define STMAGIC 0401 /* target shlib */
58 #define SHMAGIC 0443 /* host shlib */
61 #define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b
64 /* Define some NT default values. */
65 #define NT_SECTION_ALIGNMENT 0x1000
66 #define NT_FILE_ALIGNMENT 0x200
67 #define NT_DEF_RESERVE 0x100000
68 #define NT_DEF_COMMIT 0x1000
79 #define RELOC struct external_reloc
82 #define MCOREMAGIC 0xb00 /* I just made this up */
84 #define MCOREBADMAG(x) (((x).f_magic!= MCOREMAGIC))
86 struct external_filehdr
88 char f_magic
[2]; /* magic number */
89 char f_nscns
[2]; /* number of sections */
90 char f_timdat
[4]; /* time & date stamp */
91 char f_symptr
[4]; /* file pointer to symtab */
92 char f_nsyms
[4]; /* number of symtab entries */
93 char f_opthdr
[2]; /* sizeof(optional hdr) */
94 char f_flags
[2]; /* flags */
97 #define FILHDR struct external_filehdr
101 #define E_SYMNMLEN 8 /* # characters in a symbol name */
102 #define E_FILNMLEN 14 /* # characters in a file name */
103 #define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
105 struct external_syment
109 char e_name
[E_SYMNMLEN
];
129 union external_auxent
133 char x_tagndx
[4]; /* str, un, or enum tag indx */
139 char x_lnno
[2]; /* declaration line number */
140 char x_size
[2]; /* str/union/array size */
143 char x_fsize
[4]; /* size of function */
149 struct /* if ISFCN, tag, or .bb */
151 char x_lnnoptr
[4]; /* ptr to fcn line # */
152 char x_endndx
[4]; /* entry ndx past block end */
155 struct /* if ISARY, up to 4 dimen. */
157 char x_dimen
[E_DIMNUM
][2];
162 char x_tvndx
[2]; /* tv index */
168 char x_fname
[E_FILNMLEN
];
180 char x_scnlen
[4]; /* section length */
181 char x_nreloc
[2]; /* # relocation entries */
182 char x_nlinno
[2]; /* # line numbers */
183 char x_checksum
[4]; /* section COMDAT checksum */
184 char x_associated
[2]; /* COMDAT associated section index */
185 char x_comdat
[1]; /* COMDAT selection number */
190 char x_tvfill
[4]; /* tv fill value */
191 char x_tvlen
[2]; /* length of .tv */
192 char x_tvran
[2][2]; /* tv range */
193 } x_tv
; /* info about .tv section (in auxent of symbol .tv)) */
196 #define SYMENT struct external_syment
198 #define AUXENT union external_auxent
201 /* 1 line number entry for every "breakpointable" source line in a section.
202 Line numbers are grouped on a per function basis; first entry in a function
203 grouping will have l_lnno = 0 and in place of physical address will be the
204 symbol table index of the function name. */
205 struct external_lineno
209 char l_symndx
[4]; /* function name symbol index, iff l_lnno == 0*/
210 char l_paddr
[4]; /* (physical) address of line number */
213 char l_lnno
[2]; /* line number */
216 #define LINENO struct external_lineno
219 #define GET_LINENO_LNNO(abfd, ext) bfd_h_get_32 (abfd, (bfd_byte *) (ext->l_lnno));
220 #define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_32 (abfd, val, (bfd_byte *) (ext->l_lnno));
222 struct external_scnhdr
224 char s_name
[8]; /* section name */
225 char s_paddr
[4]; /* physical address, aliased s_nlib */
226 char s_vaddr
[4]; /* virtual address */
227 char s_size
[4]; /* section size */
228 char s_scnptr
[4]; /* file ptr to raw data for section */
229 char s_relptr
[4]; /* file ptr to relocation */
230 char s_lnnoptr
[4]; /* file ptr to line numbers */
231 char s_nreloc
[2]; /* number of relocation entries */
232 char s_nlnno
[2]; /* number of line number entries*/
233 char s_flags
[4]; /* flags */
236 #define SCNHDR struct external_scnhdr
239 /* Names of "special" sections. */
240 #define _TEXT ".text"
241 #define _DATA ".data"
246 #endif /* __COFF_MCORE_H */