home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 9 / FreshFishVol9-CD2.bin / bbs / gnu / gdb-4.14-src.lha / gdb-4.14 / bfd / libamiga.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-09  |  5.4 KB  |  174 lines

  1. /* BFD back-end data structures for AmigaOS.
  2.    Copyright (C) 1992-1994 Free Software Foundation, Inc.
  3.    Contributed by Leonard Norrgard.
  4.    Extended by Stephan Thesing Nov 94
  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., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  21.  
  22. #ifdef __STDC__
  23. #define CAT3(a,b,c) a##b##c
  24. #else
  25. #define CAT3(a,b,c) a/**/b/**/c
  26. #endif
  27.  
  28. #define GET_WORD bfd_h_get_32
  29. #define GET_SWORD (int32_type)GET_WORD
  30. #define PUT_WORD bfd_h_put_32
  31. #define NAME(x,y) CAT3(x,_32_,y)
  32. #define JNAME(x) CAT(x,_32)
  33. #define BYTES_IN_WORD 4
  34.  
  35.  
  36. #include <exec/memory.h>
  37. #include <dos/doshunks.h>
  38. #if 0
  39. /* Hunk ID numbers.*/  
  40. #define HUNK_UNIT       999
  41. #define HUNK_NAME    1000
  42. #define HUNK_CODE    1001
  43. #define HUNK_DATA    1002
  44. #define HUNK_BSS    1003
  45. #define HUNK_RELOC32    1004
  46. #define HUNK_RELOC16    1005
  47. #define HUNK_RELOC8    1006
  48. #define HUNK_EXT    1007
  49. #define HUNK_SYMBOL    1008
  50. #define HUNK_DEBUG    1009
  51. #define HUNK_END    1010
  52. #define HUNK_HEADER    1011
  53. #define HUNK_OVERLAY    1013
  54. #define HUNK_BREAK    1014
  55. #define HUNK_DREL32    1015
  56. #define HUNK_DREL16    1016
  57. #define HUNK_DREL8    1017
  58. #define HUNK_LIB    1018
  59. #define HUNK_INDEX    1019
  60. #endif
  61.  
  62. /* The hunk ID part.  */
  63. #define HUNK_VALUE(hunk_id) ((hunk_id) & 0x3fffffff)
  64.  
  65. /* Attributes of a hunk.  */
  66. #define HUNK_ATTRIBUTE(hunk_id) ((hunk_id) >> 30)
  67. #define HUNK_ATTR_CHIP 0x01 /* Hunk contents must go into chip (graphics) memory.  */
  68. #define HUNK_ATTR_FAST 0x02 /* fast */
  69. #define HUNK_ATTR_FOLLOWS 0x03 /* Mem id follows */
  70.  
  71. #if 0
  72. /* HUNK_EXT sub-types.*/  
  73. #define EXT_SYMB    0    /* Symbol table.  */
  74. #define EXT_DEF        1    /* Relocatable definition.  */
  75. #define EXT_ABS        2    /* Absolute definition. */
  76. #define EXT_RES        3    /* Obsolete.  */
  77. #define EXT_REF32    129    /* 32 bit reference to symbol.  */
  78. #define EXT_COMMON    130    /* 32 bit reference to COMMON block.  */
  79. #define EXT_REF16    131    /* 16 bit reference to symbol.  */
  80. #define EXT_REF8    132    /*  8 bit reference to symbol.  */
  81. #define EXT_DEXT32    133    /* 32 bit data releative reference.  */
  82. #define EXT_DEXT16    134    /* 16 bit data releative reference.  */
  83. #define EXT_DEXT8    135    /*  8 bit data releative reference.  */
  84. #endif
  85.  
  86.  
  87. typedef struct amiga_reloc {
  88.   arelent relent;
  89.   struct amiga_reloc *next;
  90.   struct amiga_symbol *symbol;
  91.   long target_hunk;
  92. } amiga_reloc_type;
  93.  
  94. typedef struct amiga_symbol {
  95.   asymbol symbol;
  96.   struct amiga_symbol *next;
  97.   long hunk_number;
  98.   unsigned char type;
  99. } amiga_symbol_type;
  100.  
  101. struct amiga_raw_symbol {
  102.   struct amiga_raw_symbol *next;
  103.   unsigned long data[1];
  104. };
  105.  
  106. typedef struct amiga_per_section
  107. {
  108.   amiga_reloc_type *reloc_tail; /* last reloc */ /* first is in section->relocation */
  109.   int attribute; /* Memory type required by this section */
  110.   int real_length; /* This is the length, occuring in the hunk */
  111.                    /* _raw_size may be larger than this */
  112.   int max_raw_relocs; /* Size of array */
  113.   int num_raw_relocs; /* # of relocs, this points to : */
  114.   unsigned long  **raw_relocs; /* Points to array of raw_relocs */
  115.                              /* every array element points to the raw data */
  116.   struct amiga_raw_symbol *first;
  117.   struct amiga_raw_symbol *last; /* tail */
  118.   
  119. } amiga_per_section_type;
  120. #define amiga_per_section(x) ((amiga_per_section_type *)((x)->used_by_bfd))
  121.  
  122. /* The `tdata' struct for all a.out-like object file formats.
  123.    Various things depend on this struct being around any time an a.out
  124.    file is being handled.  An example is dbxread.c in GDB.  */
  125.  
  126. struct amiga_data {
  127.   struct internal_exec *hdr;        /* exec file header */
  128.   amiga_symbol_type *symbols;        /* symtab for input bfd */
  129.  
  130.   /* Filler, so we can pretend to be an a.out to GDB.  */
  131.   asection *textsec;
  132.   asection *datasec;
  133.   asection *bsssec;
  134.  
  135.   /* The positions of the string table and symbol table.  */
  136.   file_ptr sym_filepos;
  137.   file_ptr str_filepos;
  138.  
  139.   unsigned int n_symbols;               /* number of symbols */
  140.  
  141.   /* Size of a relocation entry in external form */
  142.   unsigned dummy_reloc_entry_size;
  143.  
  144.   /* Size of a symbol table entry in external form */
  145.   unsigned symbol_entry_size;
  146.  
  147.   unsigned exec_bytes_size;
  148.   unsigned vma_adjusted : 1;
  149. };
  150.  
  151. typedef struct  amiga_data_struct {
  152.   struct amiga_data a;
  153.  
  154.   unsigned long symtab_size;
  155.   unsigned long stringtab_size;
  156.  
  157.   unsigned long *first_byte;
  158.   unsigned long *file_end;
  159.   unsigned long *file_pointer;
  160.   amiga_symbol_type *symbols;
  161.   amiga_symbol_type *symbol_tail;
  162.   boolean IsLoadFile; /* If true, this is a load file (for output bfd only) */
  163.   int maxsymbols;     /* Used by final_link routine to add symbols to output bfd.
  164.                          This is the # of entries, allocated in abdfd->osymbols */
  165. } amiga_data_type;
  166.  
  167. #define    adata(bfd)        ((bfd)->tdata.amiga_data->a)
  168.  
  169. /* We take the address of the first element of an asymbol to ensure that the
  170.    macro is only ever applied to an asymbol */
  171. #define amiga_symbol(asymbol) ((amiga_symbol_type *)(&(asymbol)->the_bfd))
  172.  
  173. #define AMIGA_DATA(abfd) ((abfd)->tdata.amiga_data)
  174.