1172302Spjd/* coff information for Apollo M68K
2172302Spjd
3172302Spjd   Copyright 2001 Free Software Foundation, Inc.
4172302Spjd
5172302Spjd   This program is free software; you can redistribute it and/or modify
6172302Spjd   it under the terms of the GNU General Public License as published by
7172302Spjd   the Free Software Foundation; either version 2 of the License, or
8172302Spjd   (at your option) any later version.
9172302Spjd
10172302Spjd   This program is distributed in the hope that it will be useful,
11172302Spjd   but WITHOUT ANY WARRANTY; without even the implied warranty of
12172302Spjd   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13172302Spjd   GNU General Public License for more details.
14172302Spjd
15172302Spjd   You should have received a copy of the GNU General Public License
16172302Spjd   along with this program; if not, write to the Free Software
17172302Spjd   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
18172302Spjd
19172302Spjd#define DO_NOT_DEFINE_AOUTHDR
20172302Spjd#define L_LNNO_SIZE 2
21172302Spjd#include "coff/external.h"
22172302Spjd
23172302Spjd/* Motorola 68000/68008/68010/68020 */
24172302Spjd#define	MC68MAGIC	0520
25172302Spjd#define MC68KWRMAGIC	0520	/* writeable text segments */
26172302Spjd#define	MC68TVMAGIC	0521
27172302Spjd#define MC68KROMAGIC	0521	/* readonly shareable text segments */
28172302Spjd#define MC68KPGMAGIC	0522	/* demand paged text segments */
29172302Spjd#define	M68MAGIC	0210
30172302Spjd#define	M68TVMAGIC	0211
31172302Spjd
32172302Spjd/* Apollo 68000-based machines have a different magic number. This comes
33172302Spjd * from /usr/include/apollo/filehdr.h
34172302Spjd */
35172302Spjd#define APOLLOM68KMAGIC 0627
36172302Spjd
37172302Spjd#define OMAGIC M68MAGIC
38172302Spjd#define M68KBADMAG(x) (((x).f_magic!=MC68MAGIC) && ((x).f_magic!=MC68KWRMAGIC) && ((x).f_magic!=MC68TVMAGIC) && \
39172302Spjd  ((x).f_magic!=MC68KROMAGIC) && ((x).f_magic!=MC68KPGMAGIC) && ((x).f_magic!=M68MAGIC) && ((x).f_magic!=M68TVMAGIC)  && \
40172302Spjd  ((x).f_magic!=APOLLOM68KMAGIC) )
41172302Spjd
42172302Spjd/********************** AOUT "OPTIONAL HEADER" **********************/
43172302Spjd
44172302Spjdtypedef struct
45172302Spjd{
46172302Spjd  char 	magic[2];		/* type of file				*/
47172302Spjd  char	vstamp[2];		/* version stamp			*/
48172302Spjd  char	tsize[4];		/* text size in bytes, padded to FW bdry*/
49172302Spjd  char	dsize[4];		/* initialized data "  "		*/
50172302Spjd  char	bsize[4];		/* uninitialized data "   "		*/
51172302Spjd  char	entry[4];		/* entry pt.				*/
52172302Spjd  char 	text_start[4];		/* base of text used for this file */
53172302Spjd  char 	data_start[4];		/* base of data used for this file */
54172302Spjd  char	o_sri[4];		/* Apollo specific - .sri data pointer */
55172302Spjd  char  o_inlib[4];		/* Apollo specific - .inlib data pointer */
56172302Spjd  char	vid[8];			/* Apollo specific - 64 bit version ID */
57172302Spjd}
58172302SpjdAOUTHDR;
59172302Spjd
60172302Spjd#define	APOLLO_COFF_VERSION_NUMBER 1 /* the value of the aouthdr magic */
61172302Spjd#define	AOUTHDRSZ 44
62172302Spjd#define AOUTSZ 44
63172302Spjd
64172302Spjd/* Apollo allowa for larger section names by allowing
65172302Spjd   them to be in the string table.  */
66172302Spjd
67172302Spjd/* If s_zeores is all zeroes, s_offset gives the real
68172302Spjd   location of the name in the string table.  */
69172302Spjd
70172302Spjd#define	s_zeroes section_name.s_name
71172302Spjd#define	s_offset (section_name.s_name+4)
72172302Spjd
73172302Spjd/* More names of "special" sections.  */
74172302Spjd#define _TV	".tv"
75172302Spjd#define _INIT	".init"
76172302Spjd#define _FINI	".fini"
77172302Spjd#define	_LINES	".lines"
78172302Spjd#define	_BLOCKS	".blocks"
79172302Spjd#define _SRI    ".sri"                  /* Static Resource Information (systype,
80172302Spjd et al.) */
81172302Spjd#define _MIR    ".mir"                  /* Module Information Records  */
82172302Spjd#define _APTV   ".aptv"                 /* Apollo-style transfer vectors. */
83172302Spjd#define _INLIB  ".inlib"                /* Shared Library information */
84172302Spjd#define _RWDI   ".rwdi"         /* Read/write data initialization directives for
85172302Spjd compressed sections */
86172302Spjd#define _UNWIND ".unwind"               /* Stack unwind information */
87172302Spjd
88172302Spjd/********************** RELOCATION DIRECTIVES **********************/
89172302Spjd
90172302Spjdstruct external_reloc
91172302Spjd{
92172302Spjd  char r_vaddr[4];
93172302Spjd  char r_symndx[4];
94172302Spjd  char r_type[2];
95172302Spjd#ifdef M68K_COFF_OFFSET
96172302Spjd  char r_offset[4];
97172302Spjd#endif
98172302Spjd
99172302Spjd};
100172302Spjd
101172302Spjd#define RELOC struct external_reloc
102172302Spjd
103172302Spjd#ifdef M68K_COFF_OFFSET
104172302Spjd#define RELSZ 14
105172302Spjd#else
106172302Spjd#define RELSZ 10
107172302Spjd#endif
108172302Spjd
109172302Spjd/* Apollo specific STYP flags */
110172302Spjd
111172302Spjd#define STYP_RELOCATED_NOT_LOADED 0x00010000	/* Section is relocated normally during linking, but need
112172302Spjd                                            	   not be loaded during program execution */
113172302Spjd#define STYP_DEBUG              0x00020000	/* debug section */
114172302Spjd#define STYP_OVERLAY		0x00040000	/* Section is overlayed */
115172302Spjd#define STYP_INSTRUCTION    	0x00200000	/* Section contains executable code */
116172302Spjd
117172302Spjd#define STYP_ZERO		0x00800000	/* Section is initialized to zero */
118172302Spjd#define STYP_INSTALLED		0x02000000	/* Section should be installable in KGT */
119172302Spjd#define STYP_LOOK_INSTALLED	0x04000000	/* Look for section in KGT */
120172302Spjd#define STYP_SECALIGN1		0x08000000	/* Specially aligned section */
121172302Spjd#define STYP_SECALIGN2		0x10000000	/*      "       "       "    */
122172302Spjd#define STYP_COMPRESSED		0x20000000	/* No section data per se (s_scnptr = 0), but there are
123172302Spjd						   initialization directives for it in .rwdi section
124172302Spjd						   (used in conjunction with STYP_BSS) */
125172302Spjd