apollo.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /* coff information for Apollo M68K
  2. Copyright (C) 2001-2015 Free Software Foundation, Inc.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  14. MA 02110-1301, USA. */
  15. #define DO_NOT_DEFINE_AOUTHDR
  16. #define L_LNNO_SIZE 2
  17. #include "coff/external.h"
  18. /* Motorola 68000/68008/68010/68020 */
  19. #define MC68MAGIC 0520
  20. #define MC68KWRMAGIC 0520 /* writeable text segments */
  21. #define MC68TVMAGIC 0521
  22. #define MC68KROMAGIC 0521 /* readonly shareable text segments */
  23. #define MC68KPGMAGIC 0522 /* demand paged text segments */
  24. #define M68MAGIC 0210
  25. #define M68TVMAGIC 0211
  26. /* Apollo 68000-based machines have a different magic number. This comes
  27. * from /usr/include/apollo/filehdr.h
  28. */
  29. #define APOLLOM68KMAGIC 0627
  30. #define OMAGIC M68MAGIC
  31. #define M68KBADMAG(x) (((x).f_magic!=MC68MAGIC) && ((x).f_magic!=MC68KWRMAGIC) && ((x).f_magic!=MC68TVMAGIC) && \
  32. ((x).f_magic!=MC68KROMAGIC) && ((x).f_magic!=MC68KPGMAGIC) && ((x).f_magic!=M68MAGIC) && ((x).f_magic!=M68TVMAGIC) && \
  33. ((x).f_magic!=APOLLOM68KMAGIC) )
  34. /********************** AOUT "OPTIONAL HEADER" **********************/
  35. typedef struct
  36. {
  37. char magic[2]; /* type of file */
  38. char vstamp[2]; /* version stamp */
  39. char tsize[4]; /* text size in bytes, padded to FW bdry*/
  40. char dsize[4]; /* initialized data " " */
  41. char bsize[4]; /* uninitialized data " " */
  42. char entry[4]; /* entry pt. */
  43. char text_start[4]; /* base of text used for this file */
  44. char data_start[4]; /* base of data used for this file */
  45. char o_sri[4]; /* Apollo specific - .sri data pointer */
  46. char o_inlib[4]; /* Apollo specific - .inlib data pointer */
  47. char vid[8]; /* Apollo specific - 64 bit version ID */
  48. }
  49. AOUTHDR;
  50. #define APOLLO_COFF_VERSION_NUMBER 1 /* the value of the aouthdr magic */
  51. #define AOUTHDRSZ 44
  52. #define AOUTSZ 44
  53. /* Apollo allowa for larger section names by allowing
  54. them to be in the string table. */
  55. /* If s_zeores is all zeroes, s_offset gives the real
  56. location of the name in the string table. */
  57. #define s_zeroes section_name.s_name
  58. #define s_offset (section_name.s_name+4)
  59. /* More names of "special" sections. */
  60. #define _TV ".tv"
  61. #define _INIT ".init"
  62. #define _FINI ".fini"
  63. #define _LINES ".lines"
  64. #define _BLOCKS ".blocks"
  65. #define _SRI ".sri" /* Static Resource Information (systype,
  66. et al.) */
  67. #define _MIR ".mir" /* Module Information Records */
  68. #define _APTV ".aptv" /* Apollo-style transfer vectors. */
  69. #define _INLIB ".inlib" /* Shared Library information */
  70. #define _RWDI ".rwdi" /* Read/write data initialization directives for
  71. compressed sections */
  72. #define _UNWIND ".unwind" /* Stack unwind information */
  73. /********************** RELOCATION DIRECTIVES **********************/
  74. struct external_reloc
  75. {
  76. char r_vaddr[4];
  77. char r_symndx[4];
  78. char r_type[2];
  79. #ifdef M68K_COFF_OFFSET
  80. char r_offset[4];
  81. #endif
  82. };
  83. #define RELOC struct external_reloc
  84. #ifdef M68K_COFF_OFFSET
  85. #define RELSZ 14
  86. #else
  87. #define RELSZ 10
  88. #endif
  89. /* Apollo specific STYP flags */
  90. #define STYP_RELOCATED_NOT_LOADED 0x00010000 /* Section is relocated normally during linking, but need
  91. not be loaded during program execution */
  92. #define STYP_DEBUG 0x00020000 /* debug section */
  93. #define STYP_OVERLAY 0x00040000 /* Section is overlayed */
  94. #define STYP_INSTRUCTION 0x00200000 /* Section contains executable code */
  95. #define STYP_ZERO 0x00800000 /* Section is initialized to zero */
  96. #define STYP_INSTALLED 0x02000000 /* Section should be installable in KGT */
  97. #define STYP_LOOK_INSTALLED 0x04000000 /* Look for section in KGT */
  98. #define STYP_SECALIGN1 0x08000000 /* Specially aligned section */
  99. #define STYP_SECALIGN2 0x10000000 /* " " " */
  100. #define STYP_COMPRESSED 0x20000000 /* No section data per se (s_scnptr = 0), but there are
  101. initialization directives for it in .rwdi section
  102. (used in conjunction with STYP_BSS) */