xref: /openbsd-src/gnu/usr.bin/binutils-2.17/include/coff/sparc.h (revision 3d8817e467ea46cf4772788d6804dd293abfb01a)
1*3d8817e4Smiod /* coff information for Sparc.
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 /* This file is an amalgamation of several standard include files that
20*3d8817e4Smiod    define coff format, such as filehdr.h, aouthdr.h, and so forth.  In
21*3d8817e4Smiod    addition, all datatypes have been translated into character arrays of
22*3d8817e4Smiod    (presumed) equivalent size.  This is necessary so that this file can
23*3d8817e4Smiod    be used with different systems while still yielding the same results.  */
24*3d8817e4Smiod 
25*3d8817e4Smiod #define L_LNNO_SIZE 2
26*3d8817e4Smiod #define DO_NOT_DEFINE_SYMENT
27*3d8817e4Smiod #define DO_NOT_DEFINE_AUXENT
28*3d8817e4Smiod #include "coff/external.h"
29*3d8817e4Smiod 
30*3d8817e4Smiod #define F_RELFLG	(0x0001)	/* relocation info stripped */
31*3d8817e4Smiod #define F_EXEC		(0x0002)	/* file is executable */
32*3d8817e4Smiod #define F_LNNO		(0x0004)	/* line numbers stripped */
33*3d8817e4Smiod #define F_LSYMS		(0x0008)	/* local symbols stripped */
34*3d8817e4Smiod 
35*3d8817e4Smiod #define SPARCMAGIC	(0540)
36*3d8817e4Smiod 
37*3d8817e4Smiod /* This is Lynx's all-platform magic number for executables. */
38*3d8817e4Smiod 
39*3d8817e4Smiod #define LYNXCOFFMAGIC	(0415)
40*3d8817e4Smiod 
41*3d8817e4Smiod #define OMAGIC          0404    /* object files, eg as output */
42*3d8817e4Smiod #define ZMAGIC          0413    /* demand load format, eg normal ld output */
43*3d8817e4Smiod #define STMAGIC		0401	/* target shlib */
44*3d8817e4Smiod #define SHMAGIC		0443	/* host   shlib */
45*3d8817e4Smiod 
46*3d8817e4Smiod /* More names of "special" sections. */
47*3d8817e4Smiod 
48*3d8817e4Smiod #define _TV	".tv"
49*3d8817e4Smiod #define _INIT	".init"
50*3d8817e4Smiod #define _FINI	".fini"
51*3d8817e4Smiod 
52*3d8817e4Smiod /********************** SYMBOLS **********************/
53*3d8817e4Smiod 
54*3d8817e4Smiod #define E_SYMNMLEN	(8)	/* # characters in a symbol name	*/
55*3d8817e4Smiod #define E_FILNMLEN	(14)	/* # characters in a file name		*/
56*3d8817e4Smiod #define E_DIMNUM	(4)	/* # array dimensions in auxiliary entry */
57*3d8817e4Smiod 
58*3d8817e4Smiod struct external_syment
59*3d8817e4Smiod {
60*3d8817e4Smiod   union {
61*3d8817e4Smiod     char e_name[E_SYMNMLEN];
62*3d8817e4Smiod     struct {
63*3d8817e4Smiod       char e_zeroes[4];
64*3d8817e4Smiod       char e_offset[4];
65*3d8817e4Smiod     } e;
66*3d8817e4Smiod #if 0 /* of doubtful value */
67*3d8817e4Smiod     char e_nptr[2][4];
68*3d8817e4Smiod     struct {
69*3d8817e4Smiod       char e_leading_zero[1];
70*3d8817e4Smiod       char e_dbx_type[1];
71*3d8817e4Smiod       char e_dbx_desc[2];
72*3d8817e4Smiod     } e_dbx;
73*3d8817e4Smiod #endif
74*3d8817e4Smiod   } e;
75*3d8817e4Smiod 
76*3d8817e4Smiod   char e_value[4];
77*3d8817e4Smiod   char e_scnum[2];
78*3d8817e4Smiod   char e_type[2];
79*3d8817e4Smiod   char e_sclass[1];
80*3d8817e4Smiod   char e_numaux[1];
81*3d8817e4Smiod   char padding[2];
82*3d8817e4Smiod };
83*3d8817e4Smiod 
84*3d8817e4Smiod #define N_BTMASK	(0xf)
85*3d8817e4Smiod #define N_TMASK		(0x30)
86*3d8817e4Smiod #define N_BTSHFT	(4)
87*3d8817e4Smiod #define N_TSHIFT	(2)
88*3d8817e4Smiod 
89*3d8817e4Smiod union external_auxent
90*3d8817e4Smiod {
91*3d8817e4Smiod   struct {
92*3d8817e4Smiod     char x_tagndx[4];		/* str, un, or enum tag indx */
93*3d8817e4Smiod     union {
94*3d8817e4Smiod       struct {
95*3d8817e4Smiod 	char  x_lnno[2];	/* declaration line number */
96*3d8817e4Smiod 	char  x_size[2];	/* str/union/array size */
97*3d8817e4Smiod       } x_lnsz;
98*3d8817e4Smiod       char x_fsize[4];		/* size of function */
99*3d8817e4Smiod     } x_misc;
100*3d8817e4Smiod     union {
101*3d8817e4Smiod       struct {			/* if ISFCN, tag, or .bb */
102*3d8817e4Smiod 	char x_lnnoptr[4];	/* ptr to fcn line # */
103*3d8817e4Smiod 	char x_endndx[4];	/* entry ndx past block end */
104*3d8817e4Smiod       } x_fcn;
105*3d8817e4Smiod       struct {		/* if ISARY, up to 4 dimen. */
106*3d8817e4Smiod 	char x_dimen[E_DIMNUM][2];
107*3d8817e4Smiod       } x_ary;
108*3d8817e4Smiod     } x_fcnary;
109*3d8817e4Smiod     char x_tvndx[2];		/* tv index */
110*3d8817e4Smiod   } x_sym;
111*3d8817e4Smiod 
112*3d8817e4Smiod   union {
113*3d8817e4Smiod     char x_fname[E_FILNMLEN];
114*3d8817e4Smiod     struct {
115*3d8817e4Smiod       char x_zeroes[4];
116*3d8817e4Smiod       char x_offset[4];
117*3d8817e4Smiod     } x_n;
118*3d8817e4Smiod   } x_file;
119*3d8817e4Smiod 
120*3d8817e4Smiod   struct {
121*3d8817e4Smiod     char x_scnlen[4];		/* section length */
122*3d8817e4Smiod     char x_nreloc[2];		/* # relocation entries */
123*3d8817e4Smiod     char x_nlinno[2];		/* # line numbers */
124*3d8817e4Smiod   } x_scn;
125*3d8817e4Smiod 
126*3d8817e4Smiod   struct {
127*3d8817e4Smiod     char x_tvfill[4];		/* tv fill value */
128*3d8817e4Smiod     char x_tvlen[2];		/* length of .tv */
129*3d8817e4Smiod     char x_tvran[2][2];		/* tv range */
130*3d8817e4Smiod   } x_tv;			/* .tv section info (in auxent of sym .tv)) */
131*3d8817e4Smiod 
132*3d8817e4Smiod   char x_fill[20];		/* forces to 20-byte size */
133*3d8817e4Smiod };
134*3d8817e4Smiod 
135*3d8817e4Smiod #define	SYMENT	struct external_syment
136*3d8817e4Smiod #define	SYMESZ	20
137*3d8817e4Smiod #define	AUXENT	union external_auxent
138*3d8817e4Smiod #define	AUXESZ	20
139*3d8817e4Smiod 
140*3d8817e4Smiod #define _ETEXT	"etext"
141*3d8817e4Smiod 
142*3d8817e4Smiod /********************** RELOCATION DIRECTIVES **********************/
143*3d8817e4Smiod 
144*3d8817e4Smiod struct external_reloc
145*3d8817e4Smiod {
146*3d8817e4Smiod   char r_vaddr[4];
147*3d8817e4Smiod   char r_symndx[4];
148*3d8817e4Smiod   char r_type[2];
149*3d8817e4Smiod   char r_spare[2];
150*3d8817e4Smiod   char r_offset[4];
151*3d8817e4Smiod };
152*3d8817e4Smiod 
153*3d8817e4Smiod #define RELOC struct external_reloc
154*3d8817e4Smiod #define RELSZ 16
155*3d8817e4Smiod 
156