New ARC implementation.
[deliverable/binutils-gdb.git] / gas / config / tc-arc.h
CommitLineData
252b5132 1/* tc-arc.h - Macros and type defines for the ARC.
886a2506
NC
2 Copyright 2014 Free Software Foundation, Inc.
3
4 Contributed by Claudiu Zissulescu (claziss@synopsys.com)
252b5132
RH
5
6 This file is part of GAS, the GNU Assembler.
7
8 GAS is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as
ec2655a6 10 published by the Free Software Foundation; either version 3,
252b5132
RH
11 or (at your option) any later version.
12
13 GAS is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
16 the GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GAS; see the file COPYING. If not, write to the Free
4b4da160
NC
20 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
21 02110-1301, USA. */
252b5132 22
252b5132 23
886a2506
NC
24/* By convention, you should define this macro in the `.h' file. For
25 example, `tc-m68k.h' defines `TC_M68K'. You might have to use this
26 if it is necessary to add CPU specific code to the object format
27 file. */
28#define TC_ARC
252b5132 29
886a2506 30/* We want local label support. */
252b5132
RH
31#define LOCAL_LABELS_FB 1
32
886a2506
NC
33/* This macro is the BFD architecture to pass to
34 `bfd_set_arch_mach'. */
252b5132
RH
35#define TARGET_ARCH bfd_arch_arc
36
886a2506
NC
37/* The `extsym - .' expressions can be emitted using PC-relative
38 relocs. */
0d2bcfaf 39#define DIFF_EXPR_OK
4a314ec8 40
886a2506 41#define REGISTER_PREFIX '%'
4a314ec8 42
886a2506 43#undef LITTLE_ENDIAN
252b5132 44#define LITTLE_ENDIAN 1234
0d2bcfaf 45
886a2506 46#undef BIG_ENDIAN
252b5132
RH
47#define BIG_ENDIAN 4321
48
886a2506
NC
49#ifdef TARGET_BYTES_BIG_ENDIAN
50
51# define DEFAULT_TARGET_FORMAT "elf32-bigarc"
52# define DEFAULT_BYTE_ORDER BIG_ENDIAN
53
54#else
55/* You should define this macro to be non-zero if the target is big
56 endian, and zero if the target is little endian. */
57# define TARGET_BYTES_BIG_ENDIAN 0
58
59# define DEFAULT_TARGET_FORMAT "elf32-littlearc"
60# define DEFAULT_BYTE_ORDER LITTLE_ENDIAN
61
62#endif /* TARGET_BYTES_BIG_ENDIAN. */
63
252b5132
RH
64/* The endianness of the target format may change based on command
65 line arguments. */
886a2506
NC
66extern const char *arc_target_format;
67
68/* This macro is the BFD target name to use when creating the output
69 file. This will normally depend upon the `OBJ_FMT' macro. */
70#define TARGET_FORMAT arc_target_format
71
72/* `md_short_jump_size'
73 `md_long_jump_size'
74 `md_create_short_jump'
75 `md_create_long_jump'
76
77 If `WORKING_DOT_WORD' is defined, GAS will not do broken word
78 processing (*note Broken words::.). Otherwise, you should set
79 `md_short_jump_size' to the size of a short jump (a jump that is
80 just long enough to jump around a long jmp) and `md_long_jump_size'
81 to the size of a long jump (a jump that can go anywhere in the
82 function). You should define `md_create_short_jump' to create a
83 short jump around a long jump, and define `md_create_long_jump' to
84 create a long jump. */
252b5132 85#define WORKING_DOT_WORD
252b5132 86
886a2506 87#define LISTING_HEADER "ARC GAS "
252b5132 88
886a2506
NC
89/* The number of bytes to put into a word in a listing. This affects
90 the way the bytes are clumped together in the listing. For
91 example, a value of 2 might print `1234 5678' where a value of 1
92 would print `12 34 56 78'. The default value is 4. */
93#define LISTING_WORD_SIZE 2
252b5132 94
886a2506
NC
95/* If you define this macro, it should return the position from which
96 the PC relative adjustment for a PC relative fixup should be made.
97 On many processors, the base of a PC relative instruction is the
98 next instruction, so this macro would return the length of an
99 instruction, plus the address of the PC relative fixup. The latter
100 can be calculated as fixp->fx_where +
101 fixp->fx_frag->fr_address. */
102extern long md_pcrel_from_section (struct fix *, segT);
103#define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)
104
105/* [ ] is index operator. */
106#define NEED_INDEX_OPERATOR
bcee8eb8 107
886a2506 108#define MAX_MEM_FOR_RS_ALIGN_CODE (1+2)
a161fe53 109
886a2506
NC
110/* HANDLE_ALIGN called after all the assembly has been done,
111 so we can fill in all the rs_align_code type frags with
112 nop instructions. */
113#define HANDLE_ALIGN(FRAGP) arc_handle_align (FRAGP)
114
115/* Values passed to md_apply_fix3 don't include the symbol value. */
a161fe53
AM
116#define MD_APPLY_SYM_VALUE(FIX) 0
117
118/* No shared lib support, so we don't need to ensure externally
119 visible symbols can be overridden. */
120#define EXTERN_FORCE_RELOC 0
886a2506
NC
121
122/* You may define this macro to generate a fixup for a data allocation
123 pseudo-op. */
124#define TC_CONS_FIX_NEW(FRAG, OFF, LEN, EXP, RELOC) \
125 arc_cons_fix_new ((FRAG), (OFF), (LEN), (EXP), (RELOC))
126
127/* We don't want gas to fixup the following program memory related
128 relocations. */
129#define TC_VALIDATE_FIX(FIXP,SEG,SKIP) \
130 if ((FIXP->fx_r_type == BFD_RELOC_ARC_GOTPC32) \
131 && FIXP->fx_addsy != NULL \
132 && FIXP->fx_subsy == NULL) \
133 { \
134 symbol_mark_used_in_reloc (FIXP->fx_addsy); \
135 goto SKIP; \
136 }
137
138/* BFD_RELOC_ARC_TLS_GD_LD may use fx_subsy to store a label that is
139 later turned into fx_offset. */
140#define TC_FORCE_RELOCATION_SUB_LOCAL(FIX, SEG) \
141 ((FIX)->fx_r_type == BFD_RELOC_ARC_TLS_GD_LD)
142
143#define TC_VALIDATE_FIX_SUB(FIX, SEG) \
144 ((md_register_arithmetic || (SEG) != reg_section) \
145 && ((FIX)->fx_r_type == BFD_RELOC_GPREL32 \
146 || (FIX)->fx_r_type == BFD_RELOC_GPREL16 \
147 || (FIX)->fx_r_type == BFD_RELOC_ARC_TLS_DTPOFF \
148 || (FIX)->fx_r_type == BFD_RELOC_ARC_TLS_DTPOFF_S9 \
149 || TC_FORCE_RELOCATION_SUB_LOCAL (FIX, SEG)))
150
151/* We use this to mark the end-loop label. We use this mark for ZOL
152 validity checks. */
153#define TC_SYMFIELD_TYPE unsigned int
154#define ARC_GET_FLAG(s) (*symbol_get_tc (s))
155#define ARC_SET_FLAG(s,v) (*symbol_get_tc (s) |= (v))
156
157/* The symbol is a ZOL's end loop label. */
158#define ARC_FLAG_ZOL (1 << 0)
159
160/* We use this hook to check the validity of the last to instructions
161 of a ZOL. */
162#define tc_frob_label(S) arc_frob_label (S)
163
164#define GLOBAL_OFFSET_TABLE_NAME "_GLOBAL_OFFSET_TABLE_"
165#define DYNAMIC_STRUCT_NAME "_DYNAMIC"
166
167/* We need to take care of not having section relative fixups for the
168 fixups with respect to Position Independent Code. */
169#define tc_fix_adjustable(FIX) tc_arc_fix_adjustable(FIX)
170
171/* This hook is required to parse register names as operands. */
172#define md_parse_name(name, exp, m, c) arc_parse_name (name, exp)
173
174extern bfd_boolean arc_parse_name (const char *, struct expressionS *);
175extern int tc_arc_fix_adjustable (struct fix *);
176extern void arc_handle_align (fragS *);
177extern void arc_cons_fix_new (fragS *, int, int, expressionS *,
178 bfd_reloc_code_real_type);
179extern void arc_frob_label (symbolS *);
180
181/* The blink register is r31. */
182#define DWARF2_DEFAULT_RETURN_COLUMN 31
183/* Registers are generally saved at negative offsets to the CFA. */
184#define DWARF2_CIE_DATA_ALIGNMENT (-4)
185
186/* Define the NOPs. */
187#define NOP_OPCODE_S 0x000078E0
188#define NOP_OPCODE_L 0x264A7000 /* mov 0,0. */
189
This page took 0.65729 seconds and 4 git commands to generate.