home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / src / amiga / gdb-4.12-src.lha / gdb-4.12 / bfd / libamiga.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-17  |  4.4 KB  |  150 lines

  1. /* BFD back-end data structures for AmigaOS.
  2.    Copyright (C) 1992-1994 Free Software Foundation, Inc.
  3.    Contributed by Leonard Norrgard.
  4.  
  5. This file is part of BFD, the Binary File Descriptor library.
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21. #ifdef __STDC__
  22. #define CAT3(a,b,c) a##b##c
  23. #else
  24. #define CAT3(a,b,c) a/**/b/**/c
  25. #endif
  26.  
  27. #define GET_WORD bfd_h_get_32
  28. #define GET_SWORD (int32_type)GET_WORD
  29. #define PUT_WORD bfd_h_put_32
  30. #define NAME(x,y) CAT3(x,_32_,y)
  31. #define JNAME(x) CAT(x,_32)
  32. #define BYTES_IN_WORD 4
  33.  
  34. /* Hunk ID numbers.  */
  35. #define HUNK_UNIT       999
  36. #define HUNK_NAME    1000
  37. #define HUNK_CODE    1001
  38. #define HUNK_DATA    1002
  39. #define HUNK_BSS    1003
  40. #define HUNK_RELOC32    1004
  41. #define HUNK_RELOC16    1005
  42. #define HUNK_RELOC8    1006
  43. #define HUNK_EXT    1007
  44. #define HUNK_SYMBOL    1008
  45. #define HUNK_DEBUG    1009
  46. #define HUNK_END    1010
  47. #define HUNK_HEADER    1011
  48. #define HUNK_OVERLAY    1013
  49. #define HUNK_BREAK    1014
  50. #define HUNK_DREL32    1015
  51. #define HUNK_DREL16    1016
  52. #define HUNK_DREL8    1017
  53. #define HUNK_LIB    1018
  54. #define HUNK_INDEX    1019
  55.  
  56. /* The hunk ID part.  */
  57. #define HUNK_VALUE(hunk_id) ((hunk_id) & 0x3fffffff)
  58.  
  59. /* Attributes of a hunk.  */
  60. #define HUNK_ATTRIBUTE(hunk_id) ((hunk_id) >> 30)
  61. #define HUNK_ATTR_CHIP 0x01 /* Hunk contents must go into chip (graphics) memory.  */
  62.  
  63.  
  64. /* HUNK_EXT sub-types.  */
  65. #define EXT_SYMB    0    /* Symbol table.  */
  66. #define EXT_DEF        1    /* Relocatable definition.  */
  67. #define EXT_ABS        2    /* Absolute definition. */
  68. #define EXT_RES        3    /* Obsolete.  */
  69. #define EXT_REF32    129    /* 32 bit reference to symbol.  */
  70. #define EXT_COMMON    130    /* 32 bit reference to COMMON block.  */
  71. #define EXT_REF16    131    /* 16 bit reference to symbol.  */
  72. #define EXT_REF8    132    /*  8 bit reference to symbol.  */
  73. #define EXT_DEXT32    133    /* 32 bit data releative reference.  */
  74. #define EXT_DEXT16    134    /* 16 bit data releative reference.  */
  75. #define EXT_DEXT8    135    /*  8 bit data releative reference.  */
  76.  
  77.  
  78. typedef struct amiga_reloc {
  79.   arelent relent;
  80.   struct amiga_reloc *next;
  81.   int symbol_number;
  82.   unsigned int target_hunk;
  83. } amiga_reloc_type;
  84.  
  85. typedef struct amiga_symbol {
  86.   asymbol symbol;
  87.   struct amiga_symbol *next;
  88.   unsigned long hunk_number;
  89.   unsigned long value;
  90.   unsigned char type;
  91. } amiga_symbol_type;
  92.  
  93. typedef struct amiga_per_section
  94. {
  95.   amiga_reloc_type *reloc_tail_ptr;
  96. } amiga_per_section_type;
  97. #define amiga_per_section(x) ((amiga_per_section_type *)((x)->used_by_bfd))
  98.  
  99. /* The `tdata' struct for all a.out-like object file formats.
  100.    Various things depend on this struct being around any time an a.out
  101.    file is being handled.  An example is dbxread.c in GDB.  */
  102.  
  103. struct amiga_data {
  104.   struct internal_exec *hdr;        /* exec file header */
  105.   amiga_symbol_type *symbols;        /* symtab for input bfd */
  106.  
  107.   /* Filler, so we can pretend to be an a.out to GDB.  */
  108.   asection *dummy_1_textsec;
  109.   asection *dummy_2_datasec;
  110.   asection *dummy_3_bsssec;
  111.  
  112.   /* The positions of the string table and symbol table.  */
  113.   file_ptr sym_filepos;
  114.   file_ptr str_filepos;
  115.  
  116.   unsigned int n_symbols;               /* number of symbols */
  117.  
  118.   /* Size of a relocation entry in external form */
  119.   unsigned dummy_reloc_entry_size;
  120.  
  121.   /* Size of a symbol table entry in external form */
  122.   unsigned symbol_entry_size;
  123.  
  124.   unsigned exec_bytes_size;
  125.   unsigned vma_adjusted : 1;  
  126. };
  127.  
  128. typedef struct  amiga_data_struct {
  129.   struct amiga_data a;
  130.  
  131.   unsigned long symtab_size;
  132.   unsigned long stringtab_size;
  133.  
  134.   unsigned long *first_byte;
  135.   unsigned long *file_end;
  136.   unsigned long *file_pointer;
  137.   amiga_symbol_type *external_symbols;
  138.   amiga_symbol_type *external_references;
  139.   amiga_symbol_type **symbol_tail_ptr;
  140. } amiga_data_type;
  141.  
  142. #define    adata(bfd)        ((bfd)->tdata.amiga_data->a)
  143.  
  144. /* We take the address of the first element of an asymbol to ensure that the
  145.    macro is only ever applied to an asymbol */
  146. #define amiga_symbol(asymbol) ((amiga_symbol_type *)(&(asymbol)->the_bfd))
  147.  
  148. #define AMIGA_DATA(abfd) ((abfd)->tdata.amiga_data)
  149.  
  150.