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