sparc.h revision 89858
1139749Simp/* coff information for Sparc.
272016Scg
372016Scg   Copyright 2001 Free Software Foundation, Inc.
472016Scg
572016Scg   This program is free software; you can redistribute it and/or modify
672016Scg   it under the terms of the GNU General Public License as published by
772016Scg   the Free Software Foundation; either version 2 of the License, or
872016Scg   (at your option) any later version.
972016Scg
1072016Scg   This program is distributed in the hope that it will be useful,
1172016Scg   but WITHOUT ANY WARRANTY; without even the implied warranty of
1272016Scg   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1372016Scg   GNU General Public License for more details.
1472016Scg
1572016Scg   You should have received a copy of the GNU General Public License
1672016Scg   along with this program; if not, write to the Free Software
1772016Scg   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
1872016Scg
1972016Scg/* This file is an amalgamation of several standard include files that
2072016Scg   define coff format, such as filehdr.h, aouthdr.h, and so forth.  In
2172016Scg   addition, all datatypes have been translated into character arrays of
2272016Scg   (presumed) equivalent size.  This is necessary so that this file can
2372016Scg   be used with different systems while still yielding the same results.  */
2472016Scg
2572016Scg#define L_LNNO_SIZE 2
2672016Scg#define DO_NOT_DEFINE_SYMENT
2772016Scg#define DO_NOT_DEFINE_AUXENT
2872016Scg#include "coff/external.h"
2972016Scg
30108533Sschweikh#define F_RELFLG	(0x0001)	/* relocation info stripped */
3172016Scg#define F_EXEC		(0x0002)	/* file is executable */
3273772Scg#define F_LNNO		(0x0004)	/* line numbers stripped */
3378362Scg#define F_LSYMS		(0x0008)	/* local symbols stripped */
3472016Scg
3572016Scg#define SPARCMAGIC	(0540)
3672016Scg
3774994Sorion/* This is Lynx's all-platform magic number for executables. */
3874994Sorion
3974994Sorion#define LYNXCOFFMAGIC	(0415)
4074994Sorion
4172016Scg#define OMAGIC          0404    /* object files, eg as output */
4272016Scg#define ZMAGIC          0413    /* demand load format, eg normal ld output */
4372016Scg#define STMAGIC		0401	/* target shlib */
4472016Scg#define SHMAGIC		0443	/* host   shlib */
4572016Scg
4672016Scg/* More names of "special" sections. */
47119287Simp
48119287Simp#define _TV	".tv"
4972016Scg#define _INIT	".init"
5074994Sorion#define _FINI	".fini"
5174994Sorion
5272016Scg/********************** SYMBOLS **********************/
5372016Scg
5482180Scg#define E_SYMNMLEN	(8)	/* # characters in a symbol name	*/
5582180Scg#define E_FILNMLEN	(14)	/* # characters in a file name		*/
5672016Scg#define E_DIMNUM	(4)	/* # array dimensions in auxiliary entry */
5772016Scg
5872016Scgstruct external_syment
5972016Scg{
6072016Scg  union {
6172016Scg    char e_name[E_SYMNMLEN];
6272016Scg    struct {
6384771Sorion      char e_zeroes[4];
6472016Scg      char e_offset[4];
6572016Scg    } e;
6672016Scg#if 0 /* of doubtful value */
6772016Scg    char e_nptr[2][4];
6872016Scg    struct {
6972016Scg      char e_leading_zero[1];
7072016Scg      char e_dbx_type[1];
7172016Scg      char e_dbx_desc[2];
7272016Scg    } e_dbx;
7372016Scg#endif
7472016Scg  } e;
7572016Scg
7672016Scg  char e_value[4];
7772016Scg  char e_scnum[2];
7874994Sorion  char e_type[2];
7972016Scg  char e_sclass[1];
8072016Scg  char e_numaux[1];
8172016Scg  char padding[2];
8272016Scg};
8372016Scg
8472016Scg#define N_BTMASK	(0xf)
8572016Scg#define N_TMASK		(0x30)
8672016Scg#define N_BTSHFT	(4)
8772016Scg#define N_TSHIFT	(2)
8872016Scg
8972016Scgunion external_auxent
9074994Sorion{
9172016Scg  struct {
9274994Sorion    char x_tagndx[4];		/* str, un, or enum tag indx */
9374994Sorion    union {
9474994Sorion      struct {
9574994Sorion	char  x_lnno[2];	/* declaration line number */
9674994Sorion	char  x_size[2];	/* str/union/array size */
9774994Sorion      } x_lnsz;
9874994Sorion      char x_fsize[4];		/* size of function */
9972016Scg    } x_misc;
10072016Scg    union {
10174994Sorion      struct {			/* if ISFCN, tag, or .bb */
10274994Sorion	char x_lnnoptr[4];	/* ptr to fcn line # */
10373772Scg	char x_endndx[4];	/* entry ndx past block end */
10474994Sorion      } x_fcn;
10574994Sorion      struct {		/* if ISARY, up to 4 dimen. */
10674994Sorion	char x_dimen[E_DIMNUM][2];
10775174Sorion      } x_ary;
10874994Sorion    } x_fcnary;
10974994Sorion    char x_tvndx[2];		/* tv index */
110107285Scg  } x_sym;
11172016Scg
11288032Sorion  union {
11384771Sorion    char x_fname[E_FILNMLEN];
11474994Sorion    struct {
11572016Scg      char x_zeroes[4];
11672016Scg      char x_offset[4];
11772016Scg    } x_n;
11872016Scg  } x_file;
11972016Scg
12072016Scg  struct {
12172016Scg    char x_scnlen[4];		/* section length */
12272016Scg    char x_nreloc[2];		/* # relocation entries */
12372016Scg    char x_nlinno[2];		/* # line numbers */
12472016Scg  } x_scn;
12572016Scg
12672016Scg  struct {
12774763Scg    char x_tvfill[4];		/* tv fill value */
12872016Scg    char x_tvlen[2];		/* length of .tv */
12972016Scg    char x_tvran[2][2];		/* tv range */
13072016Scg  } x_tv;			/* .tv section info (in auxent of sym .tv)) */
13172016Scg
13272016Scg  char x_fill[20];		/* forces to 20-byte size */
13374994Sorion};
13472016Scg
13572016Scg#define	SYMENT	struct external_syment
13672016Scg#define	SYMESZ	20
13774994Sorion#define	AUXENT	union external_auxent
13872016Scg#define	AUXESZ	20
13974994Sorion
14072016Scg#define _ETEXT	"etext"
14174994Sorion
14272016Scg/********************** RELOCATION DIRECTIVES **********************/
14372016Scg
14472016Scgstruct external_reloc
14572016Scg{
14672016Scg  char r_vaddr[4];
14772016Scg  char r_symndx[4];
14872016Scg  char r_type[2];
14974994Sorion  char r_spare[2];
15072016Scg  char r_offset[4];
15172016Scg};
15272016Scg
15374994Sorion#define RELOC struct external_reloc
15472016Scg#define RELSZ 16
15572016Scg
15674994Sorion