xref: /openbsd-src/gnu/usr.bin/binutils-2.17/include/coff/arm.h (revision 3d8817e467ea46cf4772788d6804dd293abfb01a)
1*3d8817e4Smiod /* ARM COFF support for BFD.
2*3d8817e4Smiod    Copyright 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
3*3d8817e4Smiod 
4*3d8817e4Smiod    This file is part of BFD, the Binary File Descriptor library.
5*3d8817e4Smiod 
6*3d8817e4Smiod    This program is free software; you can redistribute it and/or modify
7*3d8817e4Smiod    it under the terms of the GNU General Public License as published by
8*3d8817e4Smiod    the Free Software Foundation; either version 2 of the License, or
9*3d8817e4Smiod    (at your option) any later version.
10*3d8817e4Smiod 
11*3d8817e4Smiod    This program is distributed in the hope that it will be useful,
12*3d8817e4Smiod    but WITHOUT ANY WARRANTY; without even the implied warranty of
13*3d8817e4Smiod    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*3d8817e4Smiod    GNU General Public License for more details.
15*3d8817e4Smiod 
16*3d8817e4Smiod    You should have received a copy of the GNU General Public License
17*3d8817e4Smiod    along with this program; if not, write to the Free Software Foundation,
18*3d8817e4Smiod    Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
19*3d8817e4Smiod 
20*3d8817e4Smiod #define COFFARM 1
21*3d8817e4Smiod 
22*3d8817e4Smiod #define L_LNNO_SIZE 2
23*3d8817e4Smiod #define INCLUDE_COMDAT_FIELDS_IN_AUXENT
24*3d8817e4Smiod #include "coff/external.h"
25*3d8817e4Smiod 
26*3d8817e4Smiod /* Bits for f_flags:
27*3d8817e4Smiod  	F_RELFLG	relocation info stripped from file
28*3d8817e4Smiod  	F_EXEC		file is executable (no unresolved external references)
29*3d8817e4Smiod  	F_LNNO		line numbers stripped from file
30*3d8817e4Smiod  	F_LSYMS		local symbols stripped from file
31*3d8817e4Smiod         F_INTERWORK     file supports switching between ARM and Thumb instruction sets
32*3d8817e4Smiod         F_INTERWORK_SET the F_INTERWORK bit is valid
33*3d8817e4Smiod  	F_APCS_FLOAT	code passes float arguments in float registers
34*3d8817e4Smiod  	F_PIC		code is reentrant/position-independent
35*3d8817e4Smiod  	F_AR32WR	file has byte ordering of an AR32WR machine (e.g. vax)
36*3d8817e4Smiod  	F_APCS_26	file uses 26 bit ARM Procedure Calling Standard
37*3d8817e4Smiod  	F_APCS_SET	the F_APCS_26, F_APCS_FLOAT and F_PIC bits have been initialised
38*3d8817e4Smiod  	F_SOFT_FLOAT	code does not use floating point instructions.  */
39*3d8817e4Smiod 
40*3d8817e4Smiod #define F_RELFLG	(0x0001)
41*3d8817e4Smiod #define F_EXEC		(0x0002)
42*3d8817e4Smiod #define F_LNNO		(0x0004)
43*3d8817e4Smiod #define F_LSYMS		(0x0008)
44*3d8817e4Smiod #define F_INTERWORK	(0x0010)
45*3d8817e4Smiod #define F_INTERWORK_SET	(0x0020)
46*3d8817e4Smiod #define F_APCS_FLOAT	(0x0040)
47*3d8817e4Smiod #undef  F_AR16WR
48*3d8817e4Smiod #define F_PIC		(0x0080)
49*3d8817e4Smiod #define	F_AR32WR	(0x0100)
50*3d8817e4Smiod #define F_APCS_26	(0x0400)
51*3d8817e4Smiod #define F_APCS_SET	(0x0800)
52*3d8817e4Smiod #define F_SOFT_FLOAT	(0x2000)
53*3d8817e4Smiod #define F_VFP_FLOAT	(0x4000)
54*3d8817e4Smiod 
55*3d8817e4Smiod /* Bits stored in flags field of the internal_f structure */
56*3d8817e4Smiod 
57*3d8817e4Smiod #define F_INTERWORK	(0x0010)
58*3d8817e4Smiod #define F_APCS_FLOAT	(0x0040)
59*3d8817e4Smiod #define F_PIC		(0x0080)
60*3d8817e4Smiod #define F_APCS26	(0x1000)
61*3d8817e4Smiod #define F_ARM_ARCHITECTURE_MASK (0x4000+0x0800+0x0400)
62*3d8817e4Smiod #define F_ARM_2		(0x0400)
63*3d8817e4Smiod #define F_ARM_2a	(0x0800)
64*3d8817e4Smiod #define F_ARM_3		(0x0c00)
65*3d8817e4Smiod #define F_ARM_3M	(0x4000)
66*3d8817e4Smiod #define F_ARM_4		(0x4400)
67*3d8817e4Smiod #define F_ARM_4T	(0x4800)
68*3d8817e4Smiod #define F_ARM_5		(0x4c00)
69*3d8817e4Smiod 
70*3d8817e4Smiod /*
71*3d8817e4Smiod   ARMMAGIC ought to encoded the procesor type,
72*3d8817e4Smiod   but it is too late to change it now, instead
73*3d8817e4Smiod   the flags field of the internal_f structure
74*3d8817e4Smiod   is used as shown above.
75*3d8817e4Smiod 
76*3d8817e4Smiod   XXX - NC 5/6/97.  */
77*3d8817e4Smiod 
78*3d8817e4Smiod #define	ARMMAGIC	0xa00  /* I just made this up */
79*3d8817e4Smiod 
80*3d8817e4Smiod #define ARMBADMAG(x) (((x).f_magic != ARMMAGIC))
81*3d8817e4Smiod 
82*3d8817e4Smiod #define	ARMPEMAGIC	0x1c0
83*3d8817e4Smiod #define	THUMBPEMAGIC	0x1c2
84*3d8817e4Smiod 
85*3d8817e4Smiod #undef  ARMBADMAG
86*3d8817e4Smiod #define ARMBADMAG(x) (((x).f_magic != ARMMAGIC) && ((x).f_magic != ARMPEMAGIC) && ((x).f_magic != THUMBPEMAGIC))
87*3d8817e4Smiod 
88*3d8817e4Smiod #define OMAGIC          0404    /* object files, eg as output */
89*3d8817e4Smiod #define ZMAGIC          0413    /* demand load format, eg normal ld output */
90*3d8817e4Smiod #define STMAGIC		0401	/* target shlib */
91*3d8817e4Smiod #define SHMAGIC		0443	/* host   shlib */
92*3d8817e4Smiod 
93*3d8817e4Smiod /* define some NT default values */
94*3d8817e4Smiod /*  #define NT_IMAGE_BASE        0x400000 moved to internal.h */
95*3d8817e4Smiod #define NT_SECTION_ALIGNMENT 0x1000
96*3d8817e4Smiod #define NT_FILE_ALIGNMENT    0x200
97*3d8817e4Smiod #define NT_DEF_RESERVE       0x100000
98*3d8817e4Smiod #define NT_DEF_COMMIT        0x1000
99*3d8817e4Smiod 
100*3d8817e4Smiod /* We use the .rdata section to hold read only data.  */
101*3d8817e4Smiod #define _LIT	".rdata"
102*3d8817e4Smiod 
103*3d8817e4Smiod /********************** RELOCATION DIRECTIVES **********************/
104*3d8817e4Smiod #ifdef ARM_WINCE
105*3d8817e4Smiod struct external_reloc
106*3d8817e4Smiod {
107*3d8817e4Smiod   char r_vaddr[4];
108*3d8817e4Smiod   char r_symndx[4];
109*3d8817e4Smiod   char r_type[2];
110*3d8817e4Smiod };
111*3d8817e4Smiod 
112*3d8817e4Smiod #define RELOC struct external_reloc
113*3d8817e4Smiod #define RELSZ 10
114*3d8817e4Smiod 
115*3d8817e4Smiod #else
116*3d8817e4Smiod struct external_reloc
117*3d8817e4Smiod {
118*3d8817e4Smiod   char r_vaddr[4];
119*3d8817e4Smiod   char r_symndx[4];
120*3d8817e4Smiod   char r_type[2];
121*3d8817e4Smiod   char r_offset[4];
122*3d8817e4Smiod };
123*3d8817e4Smiod 
124*3d8817e4Smiod #define RELOC struct external_reloc
125*3d8817e4Smiod #define RELSZ 14
126*3d8817e4Smiod #endif
127*3d8817e4Smiod 
128*3d8817e4Smiod #define ARM_NOTE_SECTION ".note"
129