Subversion Repositories Kolibri OS

Rev

Rev 5191 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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