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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [include/] [coff/] [ti.h] - Blame information for rev 842

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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