aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-arm.h
blob: a493052ca8268328afc4fead779a185ce674e3ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/* This file is tc-arm.h
   Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
   Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
	Modified by David Taylor (dtaylor@armltd.co.uk)

   This file is part of GAS, the GNU Assembler.

   GAS is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   GAS is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with GAS; see the file COPYING.  If not, write to the Free
   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
   02111-1307, USA.  */

#define TC_ARM 1

#ifndef TARGET_BYTES_BIG_ENDIAN
#define TARGET_BYTES_BIG_ENDIAN 0
#endif

#define WORKING_DOT_WORD

#define COFF_MAGIC ARMMAGIC
#define TARGET_ARCH bfd_arch_arm

#define AOUT_MACHTYPE 0

#define DIFF_EXPR_OK

#ifdef  LITTLE_ENDIAN
#undef  LITTLE_ENDIAN
#endif
#ifdef  BIG_ENDIAN
#undef  BIG_ENDIAN
#endif

#define LITTLE_ENDIAN 1234
#define BIG_ENDIAN 4321

#ifdef OBJ_AOUT
#ifdef TE_RISCIX
#define TARGET_FORMAT "a.out-riscix"
#else
#define ARM_BI_ENDIAN
#define TARGET_FORMAT \
  (target_big_endian ? "a.out-arm-big" : "a.out-arm-little")
#endif
#endif

#ifdef OBJ_AIF
#define TARGET_FORMAT "aif"
#endif

#ifdef OBJ_COFF
# define ARM_BI_ENDIAN
  extern boolean arm_validate_fix ();
# define TC_VALIDATE_FIX(fixP,segType,Label) if (arm_validate_fix (fixP)) add_symbolP = fixP->fx_addsy
# ifdef TE_PE
#  define TC_FORCE_RELOCATION(x) ((x)->fx_r_type==BFD_RELOC_RVA)
#  define TARGET_FORMAT (target_big_endian ? "pe-arm-big" : "pe-arm-little")
# else
#  define TARGET_FORMAT (target_big_endian ? "coff-arm-big" : "coff-arm-little")
   /* Tell tc-arm.c to support runtime endian selection.  */
# endif
#endif

/* start-sanitize-armelf */
#ifdef OBJ_ELF
extern boolean arm_validate_fix ();
#define TC_VALIDATE_FIX(fixP,segType,Label) if (arm_validate_fix (fixP)) add_symbolP = fixP->fx_addsy
#define ARM_BI_ENDIAN
#define TARGET_FORMAT (target_big_endian ? "elf32-bigarm" : "elf32-littlearm")
#endif
/* end-sanitize-armelf */

#define md_convert_frag(b,s,f)		{as_fatal (_("arm convert_frag\n"));}

extern void arm_cleanup PARAMS ((void));
extern void arm_start_line_hook PARAMS ((void));
extern void arm_frob_label PARAMS ((struct symbol *));
#define md_cleanup() arm_cleanup ()
#define md_start_line_hook() arm_start_line_hook ()
#define tc_frob_label(S) arm_frob_label (S)
/* We also need to mark assembler created symbols:  */
#define tc_frob_fake_label(S) arm_frob_label (S)
/* NOTE: The fake label creation in stabs.c:s_stab_generic() has
   deliberately not been updated to mark assembler created stabs
   symbols as Thumb.  */

/* start-sanitize-armelf */
#ifdef OBJ_ELF
#define obj_fix_adjustable(fixP) arm_fix_adjustable(fixP)
#else
/* end-sanitize-armelf */
#define obj_fix_adjustable(fixP) 0
/* start-sanitize-armelf */
#endif
/* end-sanitize-armelf */

/* We need to keep some local information on symbols.  */

#define TC_SYMFIELD_TYPE unsigned int
#define ARM_GET_FLAG(s)   	((s)->sy_tc)
#define ARM_SET_FLAG(s,v) 	((s)->sy_tc |= (v))
#define ARM_RESET_FLAG(s,v) 	((s)->sy_tc &= ~(v))

#define ARM_FLAG_THUMB 		(1 << 0)	/* The symbol is a Thumb symbol rather than an Arm symbol.  */
#define ARM_FLAG_INTERWORK 	(1 << 1)	/* The symbol is attached to code that suppports interworking.  */
#define THUMB_FLAG_FUNC		(1 << 2)	/* The symbol is attached to the start of a Thumb function.  */

#define ARM_IS_THUMB(s)		(ARM_GET_FLAG (s) & ARM_FLAG_THUMB)
#define ARM_IS_INTERWORK(s)	(ARM_GET_FLAG (s) & ARM_FLAG_INTERWORK)
#define THUMB_IS_FUNC(s)	(ARM_GET_FLAG (s) & THUMB_FLAG_FUNC)

#define ARM_SET_THUMB(s,t)      ((t) ? ARM_SET_FLAG (s, ARM_FLAG_THUMB)     : ARM_RESET_FLAG (s, ARM_FLAG_THUMB))
#define ARM_SET_INTERWORK(s,t)  ((t) ? ARM_SET_FLAG (s, ARM_FLAG_INTERWORK) : ARM_RESET_FLAG (s, ARM_FLAG_INTERWORK))
#define THUMB_SET_FUNC(s,t)     ((t) ? ARM_SET_FLAG (s, THUMB_FLAG_FUNC)    : ARM_RESET_FLAG (s, THUMB_FLAG_FUNC))


#define TC_FIX_TYPE PTR
#define TC_INIT_FIX_DATA(FIXP) ((FIXP)->tc_fix_data = NULL)

#define TC_START_LABEL(C,STR) \
  (c == ':' || (c == '/' && arm_data_in_code ()))
int arm_data_in_code PARAMS ((void));

#define tc_canonicalize_symbol_name(str) \
  arm_canonicalize_symbol_name (str);
char *arm_canonicalize_symbol_name PARAMS ((char *));

#if 0	/* It isn't as simple as this */
#define tc_frob_symbol(sym,punt)	\
{	if (S_IS_LOCAL (sym))		\
	  {				\
	    punt = 1;			\
	    sym->sy_used_in_reloc = 0;	\
	  }}
#endif 

#ifdef OBJ_ELF
#define obj_frob_symbol(sym, punt)  armelf_frob_symbol (sym, punt)
#endif

/* Finish processing the entire symbol table:  */
#ifdef OBJ_ELF
#define obj_adjust_symtab armelf_adjust_symtab 
extern void armelf_adjust_symtab PARAMS ((void));
#else
#define obj_adjust_symtab arm_adjust_symtab 
extern void arm_adjust_symtab PARAMS ((void));
#endif

#if 0
#define tc_crawl_symbol_chain(a)	{;}	/* not used */
#define tc_headers_hook(a)		{;}	/* not used */
#endif

#define tc_aout_pre_write_hook(x)	{;}	/* not used */

#define LISTING_HEADER "ARM GAS "

#define OPTIONAL_REGISTER_PREFIX '%'

#define md_operand(x)

#define TC_HANDLES_FX_DONE

#define MD_APPLY_FIX3

#define LOCAL_LABEL(name) (name[0] == '.' \
                           && (name[1] == 'L'))
#define LOCAL_LABELS_FB  1

/* end of tc-arm.h */