1 /* tc-xtensa.h -- Header file for tc-xtensa.c.
2 Copyright (C) 2003 Free Software Foundation, Inc.
4 This file is part of GAS, the GNU Assembler.
6 GAS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GAS is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GAS; see the file COPYING. If not, write to the Free
18 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
24 #ifdef ANSI_PROTOTYPES
29 #error Xtensa support requires BFD_ASSEMBLER
33 #error Xtensa support requires ELF object format
36 #include "xtensa-config.h"
38 #define TARGET_BYTES_BIG_ENDIAN XCHAL_HAVE_BE
41 struct xtensa_frag_type
43 unsigned is_literal
:1;
45 unsigned is_loop_target
:1;
46 unsigned is_branch_target
:1;
49 /* Info about the current state of assembly, i.e., density, relax,
50 generics, freeregs, longcalls. These need to be passed to the
51 backend and then to the linking file. */
53 unsigned is_no_density
:1;
55 unsigned is_generics
:1;
56 unsigned is_longcalls
:1;
58 /* For text fragments that can generate literals at relax time, this
59 variable points to the frag where the literal will be stored. For
60 literal frags, this variable points to the nearest literal pool
61 location frag. This literal frag will be moved to after this
66 /* The destination segment for literal frags. (Note that this is only
67 valid after xtensa_move_literals. */
71 /* For the relaxation scheme, some literal fragments can have their
72 expansions modified by an instruction that relaxes. */
74 unsigned text_expansion
;
75 unsigned literal_expansion
;
76 unsigned unreported_expansion
;
79 typedef struct xtensa_block_info_struct
84 struct xtensa_block_info_struct
*next
;
94 typedef struct xtensa_segment_info_struct
96 fragS
*literal_pool_loc
;
97 xtensa_block_info
*blocks
[max_xt_sec
];
98 } xtensa_segment_info
;
100 typedef struct xtensa_symfield_type_struct
102 unsigned int plt
: 1;
103 unsigned int is_loop_target
: 1;
104 unsigned int is_branch_target
: 1;
105 } xtensa_symfield_type
;
108 /* Section renaming is only supported in Tensilica's version of GAS. */
109 #define XTENSA_SECTION_RENAME 1
110 #ifdef XTENSA_SECTION_RENAME
111 extern const char *xtensa_section_rename
112 PARAMS ((const char *));
114 /* Tensilica's section renaming feature is not included here. */
115 #define xtensa_section_rename(name) (name)
116 #endif /* XTENSA_SECTION_RENAME */
119 extern const char *xtensa_target_format
121 extern void xtensa_frag_init
123 extern void xtensa_cons_fix_new
124 PARAMS ((fragS
*, int, int, expressionS
*));
125 extern void xtensa_frob_label
126 PARAMS ((struct symbol
*));
127 extern void xtensa_end
129 extern void xtensa_post_relax_hook
131 extern void xtensa_file_arch_init
133 extern void xtensa_flush_pending_output
135 extern bfd_boolean xtensa_fix_adjustable
136 PARAMS ((struct fix
*));
137 extern void xtensa_symbol_new_hook
138 PARAMS ((symbolS
*));
139 extern long xtensa_relax_frag
140 PARAMS ((fragS
*, long, int *));
142 #define TARGET_FORMAT xtensa_target_format ()
143 #define TARGET_ARCH bfd_arch_xtensa
144 #define TC_SEGMENT_INFO_TYPE xtensa_segment_info
145 #define TC_SYMFIELD_TYPE xtensa_symfield_type
146 #define TC_FRAG_TYPE struct xtensa_frag_type
147 #define TC_FRAG_INIT(frag) xtensa_frag_init (frag)
148 #define TC_CONS_FIX_NEW xtensa_cons_fix_new
149 #define tc_canonicalize_symbol_name(s) xtensa_section_rename (s)
150 #define tc_init_after_args() xtensa_file_arch_init (stdoutput)
151 #define tc_fix_adjustable(fix) xtensa_fix_adjustable (fix)
152 #define tc_frob_label(sym) xtensa_frob_label (sym)
153 #define tc_symbol_new_hook(s) xtensa_symbol_new_hook (s)
154 #define md_elf_section_rename(name) xtensa_section_rename (name)
155 #define md_end xtensa_end
156 #define md_flush_pending_output() xtensa_flush_pending_output ()
157 #define md_operand(x)
158 #define TEXT_SECTION_NAME xtensa_section_rename (".text")
159 #define DATA_SECTION_NAME xtensa_section_rename (".data")
160 #define BSS_SECTION_NAME xtensa_section_rename (".bss")
163 /* The renumber_section function must be mapped over all the sections
164 after calling xtensa_post_relax_hook. That function is static in
165 write.c so it cannot be called from xtensa_post_relax_hook itself. */
167 #define md_post_relax_hook \
171 xtensa_post_relax_hook (); \
172 bfd_map_over_sections (stdoutput, renumber_sections, &i); \
177 /* Because xtensa relaxation can insert a new literal into the middle of
178 fragment and thus require re-running the relaxation pass on the
179 section, we need an explicit flag here. We explicitly use the name
180 "stretched" here to avoid changing the source code in write.c. */
182 #define md_relax_frag(segment, fragP, stretch) \
183 xtensa_relax_frag (fragP, stretch, &stretched)
186 #define LOCAL_LABELS_FB 1
187 #define WORKING_DOT_WORD 1
188 #define DOUBLESLASH_LINE_COMMENTS
189 #define TC_HANDLES_FX_DONE
190 #define TC_FINALIZE_SYMS_BEFORE_SIZE_SEG 0
192 #define MD_APPLY_SYM_VALUE(FIX) 0
194 #endif /* TC_XTENSA */