xref: /openbsd-src/gnu/usr.bin/binutils/include/coff/tic80.h (revision d2201f2f89f0be1a0be6f7568000ed297414a06d)
15f210c2aSfgsch /* coff information for TI TMS320C80 (MVP)
25f210c2aSfgsch 
35f210c2aSfgsch    Copyright 2001 Free Software Foundation, Inc.
45f210c2aSfgsch 
55f210c2aSfgsch    This program is free software; you can redistribute it and/or modify
65f210c2aSfgsch    it under the terms of the GNU General Public License as published by
75f210c2aSfgsch    the Free Software Foundation; either version 2 of the License, or
85f210c2aSfgsch    (at your option) any later version.
95f210c2aSfgsch 
105f210c2aSfgsch    This program is distributed in the hope that it will be useful,
115f210c2aSfgsch    but WITHOUT ANY WARRANTY; without even the implied warranty of
125f210c2aSfgsch    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
135f210c2aSfgsch    GNU General Public License for more details.
145f210c2aSfgsch 
155f210c2aSfgsch    You should have received a copy of the GNU General Public License
165f210c2aSfgsch    along with this program; if not, write to the Free Software
175f210c2aSfgsch    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
18f7cc78ecSespie 
19*d2201f2fSdrahn #define DO_NOT_DEFINE_FILHDR
20*d2201f2fSdrahn #define DO_NOT_DEFINE_SCNHDR
21*d2201f2fSdrahn #define L_LNNO_SIZE 2
22*d2201f2fSdrahn #include "coff/external.h"
23*d2201f2fSdrahn 
24f7cc78ecSespie /********************** FILE HEADER **********************/
25f7cc78ecSespie 
26*d2201f2fSdrahn struct external_filehdr
27*d2201f2fSdrahn   {
28f7cc78ecSespie     char f_magic[2];	/* magic number			*/
29f7cc78ecSespie     char f_nscns[2];	/* number of sections		*/
30f7cc78ecSespie     char f_timdat[4];	/* time & date stamp		*/
31f7cc78ecSespie     char f_symptr[4];	/* file pointer to symtab	*/
32f7cc78ecSespie     char f_nsyms[4];	/* number of symtab entries	*/
33f7cc78ecSespie     char f_opthdr[2];	/* sizeof(optional hdr)		*/
34f7cc78ecSespie     char f_flags[2];	/* flags			*/
35f7cc78ecSespie     char f_target_id[2];/* target id (TIc80 specific)	*/
36f7cc78ecSespie };
37f7cc78ecSespie 
38f7cc78ecSespie #define	TIC80_ARCH_MAGIC	0x0C1	/* Goes in the file header magic number field */
39f7cc78ecSespie #define TIC80_TARGET_ID		0x95	/* Goes in the target id field */
40f7cc78ecSespie 
41f7cc78ecSespie #define TIC80BADMAG(x) ((x).f_magic != TIC80_ARCH_MAGIC)
42f7cc78ecSespie 
43f7cc78ecSespie #define	FILHDR	struct external_filehdr
44f7cc78ecSespie #define	FILHSZ	22
45f7cc78ecSespie 
46f7cc78ecSespie #define TIC80_AOUTHDR_MAGIC	0x108	/* Goes in the optional file header magic number field */
47f7cc78ecSespie 
48f7cc78ecSespie /********************** SECTION HEADER **********************/
49f7cc78ecSespie 
50*d2201f2fSdrahn struct external_scnhdr
51*d2201f2fSdrahn {
52f7cc78ecSespie 	char		s_name[8];	/* section name			*/
53f7cc78ecSespie 	char		s_paddr[4];	/* physical address, aliased s_nlib */
54f7cc78ecSespie 	char		s_vaddr[4];	/* virtual address		*/
55f7cc78ecSespie 	char		s_size[4];	/* section size			*/
56f7cc78ecSespie 	char		s_scnptr[4];	/* file ptr to raw data for section */
57f7cc78ecSespie 	char		s_relptr[4];	/* file ptr to relocation	*/
58f7cc78ecSespie 	char		s_lnnoptr[4];	/* file ptr to line numbers	*/
59f7cc78ecSespie 	char		s_nreloc[2];	/* number of relocation entries	*/
60f7cc78ecSespie 	char		s_nlnno[2];	/* number of line number entries*/
61f7cc78ecSespie 	char		s_flags[2];	/* flags			*/
62f7cc78ecSespie 	char		s_reserved[1];	/* reserved (TIc80 specific)	*/
63f7cc78ecSespie 	char		s_mempage[1];	/* memory page number (TIc80)	*/
64f7cc78ecSespie };
65f7cc78ecSespie 
66*d2201f2fSdrahn /* Names of "special" sections.  */
67f7cc78ecSespie #define _TEXT	".text"
68f7cc78ecSespie #define _DATA	".data"
69f7cc78ecSespie #define _BSS	".bss"
70f7cc78ecSespie #define _CINIT	".cinit"
71f7cc78ecSespie #define _CONST	".const"
72f7cc78ecSespie #define _SWITCH	".switch"
73f7cc78ecSespie #define _STACK	".stack"
74f7cc78ecSespie #define _SYSMEM	".sysmem"
75f7cc78ecSespie 
76f7cc78ecSespie #define	SCNHDR	struct external_scnhdr
77f7cc78ecSespie #define	SCNHSZ	40
78f7cc78ecSespie 
79*d2201f2fSdrahn /* FIXME - need to correlate external_auxent with
80*d2201f2fSdrahn    TIc80 Code Generation Tools User's Guide, CG:A-25 */
81f7cc78ecSespie 
82f7cc78ecSespie /********************** RELOCATION DIRECTIVES **********************/
83f7cc78ecSespie 
84f7cc78ecSespie /* The external reloc has an offset field, because some of the reloc
85f7cc78ecSespie    types on the h8 don't have room in the instruction for the entire
86*d2201f2fSdrahn    offset - eg the strange jump and high page addressing modes.  */
87f7cc78ecSespie 
88*d2201f2fSdrahn struct external_reloc
89*d2201f2fSdrahn {
90f7cc78ecSespie   char r_vaddr[4];
91f7cc78ecSespie   char r_symndx[4];
92f7cc78ecSespie   char r_reserved[2];
93f7cc78ecSespie   char r_type[2];
94f7cc78ecSespie };
95f7cc78ecSespie 
96f7cc78ecSespie #define RELOC struct external_reloc
97f7cc78ecSespie #define RELSZ 12
98f7cc78ecSespie 
99f7cc78ecSespie /* TIc80 relocation types. */
100f7cc78ecSespie 
101f7cc78ecSespie #define R_ABS		0x00		/* Absolute address - no relocation */
102f7cc78ecSespie #define R_RELLONGX	0x11		/* PP: 32 bits, direct */
103f7cc78ecSespie #define R_PPBASE	0x34		/* PP: Global base address type */
104f7cc78ecSespie #define R_PPLBASE	0x35		/* PP: Local base address type */
105f7cc78ecSespie #define R_PP15		0x38		/* PP: Global 15 bit offset */
106f7cc78ecSespie #define R_PP15W		0x39		/* PP: Global 15 bit offset divided by 4 */
107f7cc78ecSespie #define R_PP15H		0x3A		/* PP: Global 15 bit offset divided by 2 */
108f7cc78ecSespie #define R_PP16B		0x3B		/* PP: Global 16 bit offset for bytes */
109f7cc78ecSespie #define R_PPL15		0x3C		/* PP: Local 15 bit offset */
110f7cc78ecSespie #define R_PPL15W	0x3D		/* PP: Local 15 bit offset divided by 4 */
111f7cc78ecSespie #define R_PPL15H	0x3E		/* PP: Local 15 bit offset divided by 2 */
112f7cc78ecSespie #define R_PPL16B	0x3F		/* PP: Local 16 bit offset for bytes */
113f7cc78ecSespie #define R_PPN15		0x40		/* PP: Global 15 bit negative offset */
114f7cc78ecSespie #define R_PPN15W	0x41		/* PP: Global 15 bit negative offset divided by 4 */
115f7cc78ecSespie #define R_PPN15H	0x42		/* PP: Global 15 bit negative offset divided by 2 */
116f7cc78ecSespie #define R_PPN16B	0x43		/* PP: Global 16 bit negative byte offset */
117f7cc78ecSespie #define R_PPLN15	0x44		/* PP: Local 15 bit negative offset */
118f7cc78ecSespie #define R_PPLN15W	0x45		/* PP: Local 15 bit negative offset divided by 4 */
119f7cc78ecSespie #define R_PPLN15H	0x46		/* PP: Local 15 bit negative offset divided by 2 */
120f7cc78ecSespie #define R_PPLN16B	0x47		/* PP: Local 16 bit negative byte offset */
121f7cc78ecSespie #define R_MPPCR15W	0x4E		/* MP: 15 bit PC-relative divided by 4 */
122f7cc78ecSespie #define R_MPPCR		0x4F		/* MP: 32 bit PC-relative divided by 4 */
123