OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [include/] [coff/] [or16.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/* COFF specification for OpenRISC 1000.
2
   Copyright (C) 1993-2000 Free Software Foundation, Inc.
3
   Contributed by David Wood @ New York University.
4
   Modified by Johan Rydberg, <johan.rydberg@netinsight.se>
5
 
6
This file is part of BFD, the Binary File Descriptor library.
7
 
8
This program is free software; you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation; either version 2 of the License, or
11
(at your option) any later version.
12
 
13
This program is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
GNU General Public License for more details.
17
 
18
You should have received a copy of the GNU General Public License
19
along with this program; if not, write to the Free Software
20
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
21
 
22
#ifndef OR16
23
# define OR16
24
#endif
25
 
26
/* File Header and related definitions:  */
27
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                        */
35
};
36
 
37
#define FILHDR  struct external_filehdr
38
#define FILHSZ  20
39
 
40
/* Magic numbers for OpenRISC 16. As it is know we use the
41
   numbers for Am29000.
42
 
43
   (AT&T will assign the "real" magic number) */
44
#define SIPFBOMAGIC     0572    /* Am29000 (Byte 0 is MSB) */
45
#define SIPRBOMAGIC     0573    /* Am29000 (Byte 0 is LSB) */
46
 
47
#define OR16_MAGIC_BIG          SIPFBOMAGIC     
48
#define OR16_MAGIC_LITTLE       SIPRBOMAGIC     
49
#define OR16BADMAG(x)     (((x).f_magic!=OR16_MAGIC_BIG) && \
50
                                              ((x).f_magic!=OR16_MAGIC_LITTLE))
51
 
52
#define OMAGIC OR16_MAGIC_BIG
53
 
54
/* Optional (a.out) header:  */
55
typedef struct external_aouthdr {
56
  char  magic[2];         /* type of file                     */
57
  char  vstamp[2];            /* version stamp                    */
58
  char  tsize[4];               /* text size in bytes, padded to FW bdry*/
59
  char  dsize[4];               /* initialized data "  "            */
60
  char  bsize[4];               /* uninitialized data "   "         */
61
  char  entry[4];               /* entry pt.                        */
62
  char  text_start[4];    /* base of text used for this file  */
63
  char  data_start[4];    /* base of data used for this file  */
64
} AOUTHDR;
65
 
66
#define AOUTSZ      28
67
#define AOUTHDRSZ   28
68
 
69
/* aouthdr magic numbers */
70
#define NMAGIC    0410    /* separate i/d executable */
71
#define SHMAGIC   0406          /* NYU/Ultra3 shared data executable 
72
                             (writable text) */
73
 
74
#define _ETEXT          "_etext"
75
 
76
 
77
/* Section header and related definitions:  */
78
struct external_scnhdr {
79
        char        s_name[8];      /* section name                   */
80
        char        s_paddr[4];     /* physical address, aliased s_nlib */
81
        char        s_vaddr[4];     /* virtual address                */
82
        char        s_size[4];      /* section size                   */
83
        char        s_scnptr[4];    /* file ptr to raw data for section */
84
        char        s_relptr[4];    /* file ptr to relocation         */
85
        char        s_lnnoptr[4];   /* file ptr to line numbers       */
86
        char        s_nreloc[2];    /* number of relocation entries   */
87
        char        s_nlnno[2];     /* number of line number entries  */
88
        char        s_flags[4];     /* flags                          */
89
};
90
 
91
#define SCNHDR  struct external_scnhdr
92
#define SCNHSZ  40
93
 
94
/* Names of "special" sections:  */
95
#define _TEXT   ".text"
96
#define _DATA   ".data"
97
#define _BSS    ".bss"
98
#define _LIT    ".lit"
99
 
100
/* Section types - with additional section type for global
101
   registers which will be relocatable for the OpenRISC 1000.
102
 
103
   In instances where it is necessary for a linker to produce an
104
   output file which contains text or data not based at virtual
105
   address 0, e.g. for a ROM, then the linker should accept
106
   address base information as command input and use PAD sections
107
   to skip over unused addresses.  */
108
#define STYP_BSSREG 0x1200      /* Global register area (like STYP_INFO) */
109
#define STYP_ENVIR  0x2200      /* Environment (like STYP_INFO) */
110
#define STYP_ABS    0x4000      /* Absolute (allocated, not reloc, loaded) */
111
 
112
/* Relocation information declaration and related definitions:  */
113
struct external_reloc {
114
  char r_vaddr[4];    /* (virtual) address of reference */
115
  char r_symndx[4];   /* index into symbol table */
116
  char r_type[2];     /* relocation type */
117
};
118
 
119
#define RELOC           struct external_reloc
120
#define RELSZ           10                    /* sizeof (RELOC) */ 
121
 
122
/* OR16 relocation types.  Not all of these are actually used.  */
123
#define R_OR16_NONE       0
124
#define R_OR16_ABS        1 /* reference is absolute */
125
#define R_OR16_INSN_REL   2 /* insn relative (jmp/call) */
126
#define R_OR16_INSN_ABS   3 /* insn absolute (jmp/call) */
127
#define R_OR16_INSN_LO    4 /* insn low half (16-bit) */
128
#define R_OR16_INSN_HI    5 /* insn hi half (16-bit) */
129
#define R_OR16_INSN_IHI   10 /* insn hi half (part 2) */
130
#define R_OR16_8          6 /* relocatable byte value */
131
#define R_OR16_16         7 /* relocatable halfword value */
132
#define R_OR16_32         8 /* relocatable word value */
133
#define R_OR16_JMP        9 /* XXX special */
134
 
135
#define R_OR16_INSN_REL_12  11  /* 12-bit insn relative */
136
#define R_OR16_INSN_REL_26  12  /* 26-bit insn relative */
137
 
138
/*
139
NOTE:
140
All the "I" forms refer to 29000 instruction formats.  The linker is
141
expected to know how the numeric information is split and/or aligned
142
within the instruction word(s).  R_BYTE works for instructions, too.
143
 
144
If the parameter to a CONSTH instruction is a relocatable type, two
145
relocation records are written.  The first has an r_type of R_IHIHALF
146
(33 octal) and a normal r_vaddr and r_symndx.  The second relocation
147
record has an r_type of R_IHCONST (34 octal), a normal r_vaddr (which
148
is redundant), and an r_symndx containing the 32-bit constant offset
149
to the relocation instead of the actual symbol table index.  This
150
second record is always written, even if the constant offset is zero.
151
The constant fields of the instruction are set to zero.
152
*/
153
 
154
/* Line number entry declaration and related definitions:  */
155
struct external_lineno {
156
   union {
157
     char l_symndx[4];  /* function name symbol index, iff l_lnno == 0*/
158
     char l_paddr[4];   /* (physical) address of line number    */
159
   } l_addr;
160
   char l_lnno[2];      /* line number    */
161
};
162
 
163
#define LINENO          struct external_lineno
164
#define LINESZ          6                 /* sizeof (LINENO) */
165
 
166
/* Symbol entry declaration and related definitions:  */
167
#define E_SYMNMLEN      8         /* Number of characters in a symbol name */
168
 
169
struct external_syment
170
{
171
  union {
172
    char e_name[E_SYMNMLEN];
173
    struct {
174
      char e_zeroes[4];
175
      char e_offset[4];
176
    } e;
177
  } e;
178
  char e_value[4];
179
  char e_scnum[2];
180
  char e_type[2];
181
  char e_sclass[1];
182
  char e_numaux[1];
183
};
184
 
185
#define SYMENT  struct external_syment
186
#define SYMESZ  18
187
 
188
/* Storage class definitions - new classes for global registers:  */
189
#define C_GLBLREG       19              /* global register */
190
#define C_EXTREG        20              /* external global register */
191
#define C_DEFREG        21              /* ext. def. of global register */
192
 
193
/* Derived symbol mask/shifts:  */
194
#define N_BTMASK        (0xf)
195
#define N_BTSHFT        (4)
196
#define N_TMASK         (0x30)
197
#define N_TSHIFT        (2)
198
 
199
/* Auxiliary symbol table entry declaration and related
200
   definitions.  */
201
#define E_FILNMLEN  14  /* # characters in a file name    */
202
#define E_DIMNUM    4   /* # array dimensions in auxiliary entry */
203
 
204
union external_auxent {
205
  struct {
206
    char x_tagndx[4];       /* str, un, or enum tag indx */
207
    union {
208
      struct {
209
                    char  x_lnno[2];    /* declaration line number */
210
        char  x_size[2];    /* str/union/array size */
211
                        } x_lnsz;
212
                        char x_fsize[4];      /* size of function */
213
    } x_misc;
214
    union {
215
      struct {                    /* if ISFCN, tag, or .bb */
216
                    char x_lnnoptr[4];  /* ptr to fcn line # */
217
        char x_endndx[4];   /* entry ndx past block end */
218
      } x_fcn;
219
      struct {                    /* if ISARY, up to 4 dimen. */
220
                    char x_dimen[E_DIMNUM][2];
221
      } x_ary;
222
    } x_fcnary;
223
    char x_tvndx[2];        /* tv index */
224
  } x_sym;
225
 
226
  union {
227
    char x_fname[E_FILNMLEN];
228
    struct {
229
      char x_zeroes[4];
230
      char x_offset[4];
231
    } x_n;
232
  } x_file;
233
 
234
  struct {
235
    char x_scnlen[4];       /* section length */
236
    char x_nreloc[2];       /* # relocation entries */
237
    char x_nlinno[2];       /* # line numbers */
238
  } x_scn;
239
 
240
  struct {
241
    char x_tvfill[4];       /* tv fill value */
242
    char x_tvlen[2];        /* length of .tv */
243
    char x_tvran[2][2];     /* tv range */
244
  } x_tv;                   /* info about .tv section
245
                               (in auxent of symbol .tv)) */
246
};
247
 
248
#define AUXENT          union external_auxent
249
#define AUXESZ          18      

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.