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

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [include/] [coff/] [ti.h] - Blame information for rev 45

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 17 khays
/* COFF information for TI COFF support.  Definitions in this file should be
2
   customized in a target-specific file, and then this file included (see
3
   tic54x.h for an example).
4
 
5
   Copyright 2000, 2001, 2002, 2003, 2005, 2008, 2009, 2010
6
   Free Software Foundation, Inc.
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 3 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., 51 Franklin Street - Fifth Floor, Boston,
21
   MA 02110-1301, USA.  */
22
 
23
#ifndef COFF_TI_H
24
#define COFF_TI_H
25
 
26
/* Note "coff/external.h is not used because TI adds extra fields to the structures.  */
27
 
28
/********************** FILE HEADER **********************/
29
 
30
struct external_filehdr
31
  {
32
    char f_magic[2];    /* magic number                 */
33
    char f_nscns[2];    /* number of sections           */
34
    char f_timdat[4];   /* time & date stamp            */
35
    char f_symptr[4];   /* file pointer to symtab       */
36
    char f_nsyms[4];    /* number of symtab entries     */
37
    char f_opthdr[2];   /* sizeof(optional hdr)         */
38
    char f_flags[2];    /* flags                        */
39
    char f_target_id[2];    /* magic no. (TI COFF-specific) */
40
  };
41
 
42
/* COFF0 has magic number in f_magic, and omits f_target_id from the file
43
   header; for later versions, f_magic is 0xC1 for COFF1 and 0xC2 for COFF2
44
   and the target-specific magic number is found in f_target_id */
45
 
46
#define TICOFF0MAGIC    TI_TARGET_ID
47
#define TICOFF1MAGIC    0x00C1
48
#define TICOFF2MAGIC    0x00C2
49
#define TICOFF_AOUT_MAGIC    0x0108 /* magic number in optional header */
50
#define TICOFF          1 /* customize coffcode.h */
51
 
52
/* The target_id field changes depending on the particular CPU target */
53
/* for COFF0, the target id appeared in f_magic, where COFFX magic is now */
54
#ifndef TI_TARGET_ID
55
#error "TI_TARGET_ID needs to be defined for your CPU"
56
#endif
57
 
58
/* Which bfd_arch to use... */
59
#ifndef TICOFF_TARGET_ARCH
60
#error "TICOFF_TARGET_ARCH needs to be defined for your CPU"
61
#endif
62
 
63
#ifndef TICOFF_TARGET_MACHINE_GET
64
#define TICOFF_TARGET_MACHINE_GET(FLAGS) 0
65
#endif
66
 
67
#ifndef TICOFF_TARGET_MACHINE_SET
68
#define TICOFF_TARGET_MACHINE_SET(FLAGSP, MACHINE)
69
#endif
70
 
71
/* Default to COFF2 for file output */
72
#ifndef TICOFF_DEFAULT_MAGIC
73
#define TICOFF_DEFAULT_MAGIC TICOFF2MAGIC
74
#endif
75
 
76
/* This value is made available in the rare case where a bfd is unavailable */
77
#ifndef OCTETS_PER_BYTE_POWER
78
#error "OCTETS_PER_BYTE_POWER not defined for this CPU"
79
#else
80
#define OCTETS_PER_BYTE (1<<OCTETS_PER_BYTE_POWER)
81
#endif
82
 
83
/* default alignment is on a byte (not octet!) boundary */
84
#ifndef COFF_DEFAULT_SECTION_ALIGNMENT_POWER
85
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 0
86
#endif
87
 
88
/* TI COFF encodes the section alignment in the section header flags */
89
#define COFF_ALIGN_IN_SECTION_HEADER 1
90
#define COFF_ALIGN_IN_S_FLAGS 1
91
/* requires a power-of-two argument */
92
#define COFF_ENCODE_ALIGNMENT(S,X) ((S).s_flags |= (((unsigned)(X)&0xF)<<8))
93
/* result is a power of two */
94
#define COFF_DECODE_ALIGNMENT(X) (((X)>>8)&0xF)
95
 
96
#define COFF0_P(ABFD) (bfd_coff_filhsz(ABFD) == FILHSZ_V0)
97
#define COFF2_P(ABFD) (bfd_coff_scnhsz(ABFD) != SCNHSZ_V01)
98
 
99
#define COFF0_BADMAG(x) ((x).f_magic != TICOFF0MAGIC)
100
#define COFF1_BADMAG(x) ((x).f_magic != TICOFF1MAGIC || (x).f_target_id != TI_TARGET_ID)
101
#define COFF2_BADMAG(x) ((x).f_magic != TICOFF2MAGIC || (x).f_target_id != TI_TARGET_ID)
102
 
103
/* we need to read/write an extra field in the coff file header */
104
#ifndef COFF_ADJUST_FILEHDR_IN_POST
105
#define COFF_ADJUST_FILEHDR_IN_POST(abfd, src, dst) \
106
  do                                                                    \
107
    {                                                                   \
108
      if (!COFF0_P (abfd))                                              \
109
        ((struct internal_filehdr *)(dst))->f_target_id =               \
110
          H_GET_16 (abfd, ((FILHDR *)(src))->f_target_id);              \
111
    }                                                                   \
112
  while (0)
113
#endif
114
 
115
#ifndef COFF_ADJUST_FILEHDR_OUT_POST
116
#define COFF_ADJUST_FILEHDR_OUT_POST(abfd, src, dst) \
117
  do                                                                     \
118
    {                                                                    \
119
      if (!COFF0_P (abfd))                                               \
120
        H_PUT_16 (abfd, ((struct internal_filehdr *)(src))->f_target_id, \
121
                 ((FILHDR *)(dst))->f_target_id);                        \
122
    }                                                                    \
123
  while (0)
124
#endif
125
 
126
#define FILHDR  struct external_filehdr
127
#define FILHSZ  22
128
#define FILHSZ_V0 20                /* COFF0 omits target_id field */
129
 
130
/* File header flags */
131
#define F_RELFLG        (0x0001)
132
#define F_EXEC          (0x0002)
133
#define F_LNNO          (0x0004)
134
#define F_VERS          (0x0010) /* TMS320C4x code */
135
/* F_LSYMS needs to be redefined in your source file */
136
#define F_LSYMS_TICOFF  (0x0010) /* normal COFF is 0x8 */
137
 
138
#define F_10            0x00    /* file built for TMS320C1x devices */
139
#define F_20            0x10    /* file built for TMS320C2x devices */
140
#define F_25            0x20    /* file built for TMS320C2x/C5x devices */
141
#define F_LENDIAN       0x0100  /* 16 bits/word, LSB first */
142
#define F_SYMMERGE      0x1000  /* duplicate symbols were removed */
143
 
144
/********************** OPTIONAL HEADER **********************/
145
 
146
 
147
typedef struct
148
{
149
  char  magic[2];               /* type of file (0x108)                 */
150
  char  vstamp[2];              /* version stamp                        */
151
  char  tsize[4];               /* text size in bytes, padded to FW bdry*/
152
  char  dsize[4];               /* initialized data "  "                */
153
  char  bsize[4];               /* uninitialized data "   "             */
154
  char  entry[4];               /* entry pt.                            */
155
  char  text_start[4];          /* base of text used for this file */
156
  char  data_start[4];          /* base of data used for this file */
157
}
158
AOUTHDR;
159
 
160
 
161
#define AOUTHDRSZ 28
162
#define AOUTSZ 28
163
 
164
 
165
/********************** SECTION HEADER **********************/
166
/* COFF0, COFF1 */
167
struct external_scnhdr_v01 {
168
        char            s_name[8];      /* section name                 */
169
        char            s_paddr[4];     /* physical address, aliased s_nlib */
170
        char            s_vaddr[4];     /* virtual address              */
171
        char            s_size[4];      /* section size (in WORDS)      */
172
        char            s_scnptr[4];    /* file ptr to raw data for section */
173
        char            s_relptr[4];    /* file ptr to relocation       */
174
        char            s_lnnoptr[4];   /* file ptr to line numbers     */
175
        char            s_nreloc[2];    /* number of relocation entries */
176
        char            s_nlnno[2];     /* number of line number entries*/
177
        char            s_flags[2];     /* flags                        */
178
        char            s_reserved[1];  /* reserved                     */
179
        char            s_page[1];      /* section page number (LOAD)   */
180
};
181
 
182
/* COFF2 */
183
struct external_scnhdr {
184
        char            s_name[8];      /* section name                 */
185
        char            s_paddr[4];     /* physical address, aliased s_nlib */
186
        char            s_vaddr[4];     /* virtual address              */
187
        char            s_size[4];      /* section size (in WORDS)      */
188
        char            s_scnptr[4];    /* file ptr to raw data for section */
189
        char            s_relptr[4];    /* file ptr to relocation       */
190
        char            s_lnnoptr[4];   /* file ptr to line numbers     */
191
        char            s_nreloc[4];    /* number of relocation entries */
192
        char            s_nlnno[4];     /* number of line number entries*/
193
        char            s_flags[4];     /* flags                        */
194
        char            s_reserved[2];  /* reserved                     */
195
        char            s_page[2];      /* section page number (LOAD)   */
196
};
197
 
198
/*
199
 * Special section flags
200
 */
201
 
202
/* TI COFF defines these flags;
203
   STYP_CLINK: the section should be excluded from the final
204
   linker output if there are no references found to any symbol in the section
205
   STYP_BLOCK: the section should be blocked, i.e. if the section would cross
206
   a page boundary, it is started at a page boundary instead.
207
   TI COFF puts the section alignment power of two in the section flags
208
   e.g. 2**N is alignment, flags |= (N & 0xF) << 8
209
*/
210
#define STYP_CLINK      (0x4000)
211
#define STYP_BLOCK      (0x1000)
212
#define STYP_ALIGN      (0x0F00) /* TI COFF stores section alignment here */
213
 
214
#define SCNHDR_V01 struct external_scnhdr_v01
215
#define SCNHDR struct external_scnhdr
216
#define SCNHSZ_V01 40                  /* for v0 and v1 */
217
#define SCNHSZ 48
218
 
219
/* COFF2 changes the offsets and sizes of these fields
220
   Assume we're dealing with the COFF2 scnhdr structure, and adjust
221
   accordingly.  Note: The GNU C versions of some of these macros
222
   are necessary in order to avoid compile time warnings triggered
223
   gcc's array bounds checking.  The PUT_SCNHDR_PAGE macro also has
224
   the advantage on not evaluating LOC twice.  */
225
 
226
#define GET_SCNHDR_NRELOC(ABFD, LOC) \
227
  (COFF2_P (ABFD) ? H_GET_32 (ABFD, LOC) : H_GET_16 (ABFD, LOC))
228
#define PUT_SCNHDR_NRELOC(ABFD, VAL, LOC) \
229
  (COFF2_P (ABFD) ? H_PUT_32 (ABFD, VAL, LOC) : H_PUT_16 (ABFD, VAL, LOC))
230
#ifdef __GNUC__
231
#define GET_SCNHDR_NLNNO(ABFD, LOC) \
232
  ({ \
233
    int nlnno;          \
234
    char * ptr = (LOC); \
235
    if (COFF2_P (ABFD)) \
236
      nlnno = H_GET_32 (ABFD, ptr); \
237
    else \
238
      nlnno = H_GET_16 (ABFD, ptr - 2); \
239
    nlnno; \
240
  })
241
#define PUT_SCNHDR_NLNNO(ABFD, VAL, LOC) \
242
  do \
243
    { \
244
      char * ptr = (LOC); \
245
      if (COFF2_P (ABFD)) \
246
        H_PUT_32 (ABFD, VAL, ptr); \
247
      else \
248
        H_PUT_16 (ABFD, VAL, ptr - 2); \
249
    } \
250
  while (0)
251
#define GET_SCNHDR_FLAGS(ABFD, LOC) \
252
  ({ \
253
    int flags; \
254
    char * ptr = (LOC); \
255
    if (COFF2_P (ABFD)) \
256
      flags = H_GET_32 (ABFD, ptr); \
257
    else \
258
      flags = H_GET_16 (ABFD, ptr - 4); \
259
    flags; \
260
  })
261
#define PUT_SCNHDR_FLAGS(ABFD, VAL, LOC) \
262
  do \
263
    { \
264
      char * ptr = (LOC); \
265
      if (COFF2_P (ABFD)) \
266
        H_PUT_32 (ABFD, VAL, ptr); \
267
      else \
268
        H_PUT_16 (ABFD, VAL, ptr - 4); \
269
    } \
270
  while (0)
271
#define GET_SCNHDR_PAGE(ABFD, LOC) \
272
  ({ \
273
    unsigned page; \
274
    char * ptr = (LOC); \
275
    if (COFF2_P (ABFD)) \
276
      page = H_GET_16 (ABFD, ptr); \
277
    else \
278
      page = (unsigned) H_GET_8 (ABFD, ptr - 7); \
279
    page; \
280
  })
281
/* On output, make sure that the "reserved" field is zero.  */
282
#define PUT_SCNHDR_PAGE(ABFD, VAL, LOC) \
283
  do \
284
    { \
285
      char * ptr = (LOC); \
286
      if (COFF2_P (ABFD)) \
287
        H_PUT_16 (ABFD, VAL, ptr); \
288
      else \
289
        { \
290
          H_PUT_8 (ABFD, VAL, ptr - 7); \
291
          H_PUT_8 (ABFD, 0, ptr - 8); \
292
        } \
293
    } \
294
  while (0)
295
#else
296
#define GET_SCNHDR_NLNNO(ABFD, LOC) \
297
  (COFF2_P (ABFD) ? H_GET_32 (ABFD, LOC) : H_GET_16 (ABFD, (LOC) - 2))
298
#define PUT_SCNHDR_NLNNO(ABFD, VAL, LOC) \
299
  (COFF2_P (ABFD) ? H_PUT_32 (ABFD, VAL, LOC) : H_PUT_16 (ABFD, VAL, (LOC) - 2))
300
#define GET_SCNHDR_FLAGS(ABFD, LOC) \
301
  (COFF2_P (ABFD) ? H_GET_32 (ABFD, LOC) : H_GET_16 (ABFD, (LOC) - 4))
302
#define PUT_SCNHDR_FLAGS(ABFD, VAL, LOC) \
303
  (COFF2_P (ABFD) ? H_PUT_32 (ABFD, VAL, LOC) : H_PUT_16 (ABFD, VAL, (LOC) - 4))
304
#define GET_SCNHDR_PAGE(ABFD, LOC) \
305
  (COFF2_P (ABFD) ? H_GET_16 (ABFD, LOC) : (unsigned) H_GET_8 (ABFD, (LOC) - 7))
306
/* On output, make sure that the "reserved" field is zero.  */
307
#define PUT_SCNHDR_PAGE(ABFD, VAL, LOC) \
308
  (COFF2_P (ABFD) \
309
   ? H_PUT_16 (ABFD, VAL, LOC) \
310
   : H_PUT_8 (ABFD, VAL, (LOC) - 7), H_PUT_8 (ABFD, 0, (LOC) - 8))
311
#endif
312
 
313
 
314
/* TI COFF stores section size as number of bytes (address units, not octets),
315
   so adjust to be number of octets, which is what BFD expects */
316
#define GET_SCNHDR_SIZE(ABFD, SZP) \
317
  (H_GET_32 (ABFD, SZP) * bfd_octets_per_byte (ABFD))
318
#define PUT_SCNHDR_SIZE(ABFD, SZ, SZP) \
319
  H_PUT_32 (ABFD, (SZ) / bfd_octets_per_byte (ABFD), SZP)
320
 
321
#define COFF_ADJUST_SCNHDR_IN_POST(ABFD, EXT, INT) \
322
  do                                                                    \
323
    {                                                                   \
324
      ((struct internal_scnhdr *)(INT))->s_page =                       \
325
        GET_SCNHDR_PAGE (ABFD, ((SCNHDR *)(EXT))->s_page);              \
326
    }                                                                   \
327
   while (0)
328
 
329
/* The entire scnhdr may not be assigned.
330
   Ensure that everything is initialized.  */
331
#define COFF_ADJUST_SCNHDR_OUT_PRE(ABFD, INT, EXT)      \
332
  do                                                    \
333
    {                                                   \
334
      memset((EXT), 0, sizeof (SCNHDR));         \
335
    }                                                   \
336
  while (0)
337
 
338
/* The line number and reloc overflow checking in coff_swap_scnhdr_out in
339
   coffswap.h doesn't use PUT_X for s_nlnno and s_nreloc.
340
   Due to different sized v0/v1/v2 section headers, we have to re-write these
341
   fields.
342
 */
343
#define COFF_ADJUST_SCNHDR_OUT_POST(ABFD, INT, EXT) \
344
  do                                                                       \
345
    {                                                                      \
346
      PUT_SCNHDR_NLNNO (ABFD, ((struct internal_scnhdr *)(INT))->s_nlnno,  \
347
                        ((SCNHDR *)(EXT))->s_nlnno);                       \
348
      PUT_SCNHDR_NRELOC (ABFD, ((struct internal_scnhdr *)(INT))->s_nreloc,\
349
                         ((SCNHDR *)(EXT))->s_nreloc);                     \
350
      PUT_SCNHDR_FLAGS (ABFD, ((struct internal_scnhdr *)(INT))->s_flags,  \
351
                        ((SCNHDR *)(EXT))->s_flags);                       \
352
      PUT_SCNHDR_PAGE (ABFD, ((struct internal_scnhdr *)(INT))->s_page,    \
353
                       ((SCNHDR *)(EXT))->s_page);                         \
354
    }                                                                      \
355
   while (0)
356
 
357
/*
358
 * names of "special" sections
359
 */
360
#define _TEXT   ".text"
361
#define _DATA   ".data"
362
#define _BSS    ".bss"
363
#define _CINIT  ".cinit"            /* initialized C data */
364
#define _SCONST  ".const"           /* constants */
365
#define _SWITCH ".switch"           /* switch tables */
366
#define _STACK  ".stack"            /* C stack */
367
#define _SYSMEM ".sysmem"           /* used for malloc et al. syscalls */
368
 
369
/********************** LINE NUMBERS **********************/
370
 
371
/* 1 line number entry for every "breakpointable" source line in a section.
372
 * Line numbers are grouped on a per function basis; first entry in a function
373
 * grouping will have l_lnno = 0 and in place of physical address will be the
374
 * symbol table index of the function name.
375
 */
376
struct external_lineno {
377
  union {
378
    char l_symndx[4];   /* function name symbol index, iff l_lnno == 0*/
379
    char l_paddr[4];    /* (physical) address of line number    */
380
  } l_addr;
381
  char l_lnno[2];       /* line number          */
382
};
383
 
384
#define LINENO  struct external_lineno
385
#define LINESZ  6
386
 
387
 
388
/********************** SYMBOLS **********************/
389
 
390
/* NOTE: this is what a local label looks like in assembly source; what it
391
   looks like in COFF output is undefined */
392
#define TICOFF_LOCAL_LABEL_P(NAME) \
393
((NAME[0] == '$' && NAME[1] >= '0' && NAME[1] <= '9' && NAME[2] == '\0') \
394
 || NAME[strlen(NAME)-1] == '?')
395
 
396
#define E_SYMNMLEN      8       /* # characters in a symbol name        */
397
#define E_FILNMLEN      14      /* # characters in a file name          */
398
#define E_DIMNUM        4       /* # array dimensions in auxiliary entry */
399
 
400
struct external_syment
401
{
402
  union {
403
    char e_name[E_SYMNMLEN];
404
    struct {
405
      char e_zeroes[4];
406
      char e_offset[4];
407
    } e;
408
  } e;
409
  char e_value[4];
410
  char e_scnum[2];
411
  char e_type[2];
412
  char e_sclass[1];
413
  char e_numaux[1];
414
};
415
 
416
 
417
#define N_BTMASK        (017)
418
#define N_TMASK         (060)
419
#define N_BTSHFT        (4)
420
#define N_TSHIFT        (2)
421
 
422
 
423
union external_auxent {
424
  struct {
425
        char x_tagndx[4];       /* str, un, or enum tag indx */
426
        union {
427
          struct {
428
                char  x_lnno[2]; /* declaration line number */
429
                char  x_size[2]; /* str/union/array size */
430
          } x_lnsz;
431
          char x_fsize[4];      /* size of function */
432
        } x_misc;
433
        union {
434
          struct {              /* if ISFCN, tag, or .bb */
435
                char x_lnnoptr[4];      /* ptr to fcn line # */
436
                char x_endndx[4];       /* entry ndx past block end */
437
          } x_fcn;
438
          struct {              /* if ISARY, up to 4 dimen. */
439
                char x_dimen[E_DIMNUM][2];
440
          } x_ary;
441
        } x_fcnary;
442
        char x_tvndx[2];                /* tv index */
443
  } x_sym;
444
 
445
  union {
446
        char x_fname[E_FILNMLEN];
447
        struct {
448
          char x_zeroes[4];
449
          char x_offset[4];
450
        } x_n;
451
  } x_file;
452
 
453
  struct {
454
        char x_scnlen[4];                       /* section length */
455
        char x_nreloc[2];       /* # relocation entries */
456
        char x_nlinno[2];       /* # line numbers */
457
  } x_scn;
458
 
459
  struct {
460
        char x_tvfill[4];       /* tv fill value */
461
        char x_tvlen[2];        /* length of .tv */
462
        char x_tvran[2][2];     /* tv range */
463
  } x_tv;               /* info about .tv section (in auxent of symbol .tv)) */
464
 
465
 
466
};
467
 
468
#define SYMENT  struct external_syment
469
#define SYMESZ  18      
470
#define AUXENT  union external_auxent
471
#define AUXESZ  18
472
 
473
/* section lengths are in target bytes (not host bytes) */
474
#define GET_SCN_SCNLEN(ABFD, EXT) \
475
  (H_GET_32 (ABFD, (EXT)->x_scn.x_scnlen) * bfd_octets_per_byte (ABFD))
476
#define PUT_SCN_SCNLEN(ABFD, INT, EXT) \
477
  H_PUT_32 (ABFD, (INT) / bfd_octets_per_byte (ABFD), (EXT)->x_scn.x_scnlen)
478
 
479
/* lnsz size is in bits in COFF file, in bytes in BFD */
480
#define GET_LNSZ_SIZE(abfd, ext) \
481
 (H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_size) / (in_class != C_FIELD ? 8 : 1))
482
 
483
#define PUT_LNSZ_SIZE(abfd, in, ext) \
484
  H_PUT_16 (abfd, ((in_class != C_FIELD) ? (in) * 8 : (in)), \
485
           ext->x_sym.x_misc.x_lnsz.x_size)
486
 
487
/* TI COFF stores offsets for MOS and MOU in bits; BFD expects bytes
488
   Also put the load page flag of the section into the symbol value if it's an
489
   address.  */
490
#ifndef NEEDS_PAGE
491
#define NEEDS_PAGE(X) 0
492
#define PAGE_MASK 0
493
#endif
494
#define COFF_ADJUST_SYM_IN_POST(ABFD, EXT, INT) \
495
  do                                                                    \
496
    {                                                                   \
497
      struct internal_syment *dst = (struct internal_syment *)(INT);    \
498
      if (dst->n_sclass == C_MOS || dst->n_sclass == C_MOU)             \
499
        dst->n_value /= 8;                                              \
500
      else if (NEEDS_PAGE (dst->n_sclass)) {                            \
501
        asection *scn = coff_section_from_bfd_index (abfd, dst->n_scnum); \
502
        dst->n_value |= (scn->lma & PAGE_MASK);                         \
503
      }                                                                 \
504
    }                                                                   \
505
   while (0)
506
 
507
#define COFF_ADJUST_SYM_OUT_POST(ABFD, INT, EXT) \
508
  do                                                                    \
509
    {                                                                   \
510
       struct internal_syment *src = (struct internal_syment *)(INT);   \
511
       SYMENT *dst = (SYMENT *)(EXT);                                   \
512
       if (src->n_sclass == C_MOU || src->n_sclass == C_MOS)            \
513
         H_PUT_32 (abfd, src->n_value * 8, dst->e_value);               \
514
       else if (NEEDS_PAGE (src->n_sclass)) {                           \
515
         H_PUT_32 (abfd, src->n_value &= ~PAGE_MASK, dst->e_value);     \
516
       }                                                                \
517
    }                                                                   \
518
   while (0)
519
 
520
/* Detect section-relative absolute symbols so they get flagged with a sym
521
   index of -1.
522
*/
523
#define SECTION_RELATIVE_ABSOLUTE_SYMBOL_P(RELOC, SECT) \
524
  ((*(RELOC)->sym_ptr_ptr)->section->output_section == (SECT) \
525
   && (RELOC)->howto->name[0] == 'A')
526
 
527
/********************** RELOCATION DIRECTIVES **********************/
528
 
529
struct external_reloc_v0
530
{
531
  char r_vaddr[4];
532
  char r_symndx[2];
533
  char r_reserved[2];
534
  char r_type[2];
535
};
536
 
537
struct external_reloc
538
{
539
  char r_vaddr[4];
540
  char r_symndx[4];
541
  char r_reserved[2]; /* extended pmad byte for COFF2 */
542
  char r_type[2];
543
};
544
 
545
#define RELOC struct external_reloc
546
#define RELSZ_V0 10                 /* FIXME -- coffcode.h needs fixing */
547
#define RELSZ 12                    /* for COFF1/2 */
548
 
549
/* various relocation types.  */
550
#define R_ABS     0x0000            /* no relocation */
551
#define R_REL13   0x002A            /* 13-bit direct reference (???) */
552
#define R_PARTLS7 0x0028            /* 7 LSBs of an address */
553
#define R_PARTMS9 0x0029            /* 9MSBs of an address */
554
#define R_EXTWORD 0x002B            /* 23-bit direct reference */
555
#define R_EXTWORD16 0x002C          /* 16-bit direct reference to 23-bit addr*/
556
#define R_EXTWORDMS7 0x002D         /* upper 7 bits of 23-bit address */
557
 
558
#endif /* COFF_TI_H */

powered by: WebSVN 2.1.0

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