1 |
205 |
julius |
/* coff information for TI TMS320C80 (MVP)
|
2 |
|
|
|
3 |
|
|
Copyright 2001 Free Software Foundation, Inc.
|
4 |
|
|
|
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.
|
9 |
|
|
|
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.
|
14 |
|
|
|
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, MA 02110-1301, USA. */
|
18 |
|
|
|
19 |
|
|
#define DO_NOT_DEFINE_FILHDR
|
20 |
|
|
#define DO_NOT_DEFINE_SCNHDR
|
21 |
|
|
#define L_LNNO_SIZE 2
|
22 |
|
|
#include "coff/external.h"
|
23 |
|
|
|
24 |
|
|
/********************** FILE HEADER **********************/
|
25 |
|
|
|
26 |
|
|
struct external_filehdr
|
27 |
|
|
{
|
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 */
|
35 |
|
|
char f_target_id[2];/* target id (TIc80 specific) */
|
36 |
|
|
};
|
37 |
|
|
|
38 |
|
|
#define TIC80_ARCH_MAGIC 0x0C1 /* Goes in the file header magic number field */
|
39 |
|
|
#define TIC80_TARGET_ID 0x95 /* Goes in the target id field */
|
40 |
|
|
|
41 |
|
|
#define TIC80BADMAG(x) ((x).f_magic != TIC80_ARCH_MAGIC)
|
42 |
|
|
|
43 |
|
|
#define FILHDR struct external_filehdr
|
44 |
|
|
#define FILHSZ 22
|
45 |
|
|
|
46 |
|
|
#define TIC80_AOUTHDR_MAGIC 0x108 /* Goes in the optional file header magic number field */
|
47 |
|
|
|
48 |
|
|
/********************** SECTION HEADER **********************/
|
49 |
|
|
|
50 |
|
|
struct external_scnhdr
|
51 |
|
|
{
|
52 |
|
|
char s_name[8]; /* section name */
|
53 |
|
|
char s_paddr[4]; /* physical address, aliased s_nlib */
|
54 |
|
|
char s_vaddr[4]; /* virtual address */
|
55 |
|
|
char s_size[4]; /* section size */
|
56 |
|
|
char s_scnptr[4]; /* file ptr to raw data for section */
|
57 |
|
|
char s_relptr[4]; /* file ptr to relocation */
|
58 |
|
|
char s_lnnoptr[4]; /* file ptr to line numbers */
|
59 |
|
|
char s_nreloc[2]; /* number of relocation entries */
|
60 |
|
|
char s_nlnno[2]; /* number of line number entries*/
|
61 |
|
|
char s_flags[2]; /* flags */
|
62 |
|
|
char s_reserved[1]; /* reserved (TIc80 specific) */
|
63 |
|
|
char s_mempage[1]; /* memory page number (TIc80) */
|
64 |
|
|
};
|
65 |
|
|
|
66 |
|
|
/* Names of "special" sections. */
|
67 |
|
|
#define _TEXT ".text"
|
68 |
|
|
#define _DATA ".data"
|
69 |
|
|
#define _BSS ".bss"
|
70 |
|
|
#define _CINIT ".cinit"
|
71 |
|
|
#define _CONST ".const"
|
72 |
|
|
#define _SWITCH ".switch"
|
73 |
|
|
#define _STACK ".stack"
|
74 |
|
|
#define _SYSMEM ".sysmem"
|
75 |
|
|
|
76 |
|
|
#define SCNHDR struct external_scnhdr
|
77 |
|
|
#define SCNHSZ 40
|
78 |
|
|
|
79 |
|
|
/* FIXME - need to correlate external_auxent with
|
80 |
|
|
TIc80 Code Generation Tools User's Guide, CG:A-25 */
|
81 |
|
|
|
82 |
|
|
/********************** RELOCATION DIRECTIVES **********************/
|
83 |
|
|
|
84 |
|
|
/* The external reloc has an offset field, because some of the reloc
|
85 |
|
|
types on the h8 don't have room in the instruction for the entire
|
86 |
|
|
offset - eg the strange jump and high page addressing modes. */
|
87 |
|
|
|
88 |
|
|
struct external_reloc
|
89 |
|
|
{
|
90 |
|
|
char r_vaddr[4];
|
91 |
|
|
char r_symndx[4];
|
92 |
|
|
char r_reserved[2];
|
93 |
|
|
char r_type[2];
|
94 |
|
|
};
|
95 |
|
|
|
96 |
|
|
#define RELOC struct external_reloc
|
97 |
|
|
#define RELSZ 12
|
98 |
|
|
|
99 |
|
|
/* TIc80 relocation types. */
|
100 |
|
|
|
101 |
|
|
#define R_ABS 0x00 /* Absolute address - no relocation */
|
102 |
|
|
#define R_RELLONGX 0x11 /* PP: 32 bits, direct */
|
103 |
|
|
#define R_PPBASE 0x34 /* PP: Global base address type */
|
104 |
|
|
#define R_PPLBASE 0x35 /* PP: Local base address type */
|
105 |
|
|
#define R_PP15 0x38 /* PP: Global 15 bit offset */
|
106 |
|
|
#define R_PP15W 0x39 /* PP: Global 15 bit offset divided by 4 */
|
107 |
|
|
#define R_PP15H 0x3A /* PP: Global 15 bit offset divided by 2 */
|
108 |
|
|
#define R_PP16B 0x3B /* PP: Global 16 bit offset for bytes */
|
109 |
|
|
#define R_PPL15 0x3C /* PP: Local 15 bit offset */
|
110 |
|
|
#define R_PPL15W 0x3D /* PP: Local 15 bit offset divided by 4 */
|
111 |
|
|
#define R_PPL15H 0x3E /* PP: Local 15 bit offset divided by 2 */
|
112 |
|
|
#define R_PPL16B 0x3F /* PP: Local 16 bit offset for bytes */
|
113 |
|
|
#define R_PPN15 0x40 /* PP: Global 15 bit negative offset */
|
114 |
|
|
#define R_PPN15W 0x41 /* PP: Global 15 bit negative offset divided by 4 */
|
115 |
|
|
#define R_PPN15H 0x42 /* PP: Global 15 bit negative offset divided by 2 */
|
116 |
|
|
#define R_PPN16B 0x43 /* PP: Global 16 bit negative byte offset */
|
117 |
|
|
#define R_PPLN15 0x44 /* PP: Local 15 bit negative offset */
|
118 |
|
|
#define R_PPLN15W 0x45 /* PP: Local 15 bit negative offset divided by 4 */
|
119 |
|
|
#define R_PPLN15H 0x46 /* PP: Local 15 bit negative offset divided by 2 */
|
120 |
|
|
#define R_PPLN16B 0x47 /* PP: Local 16 bit negative byte offset */
|
121 |
|
|
#define R_MPPCR15W 0x4E /* MP: 15 bit PC-relative divided by 4 */
|
122 |
|
|
#define R_MPPCR 0x4F /* MP: 32 bit PC-relative divided by 4 */
|