Enable -z separate-code, -z common and -z text for more targets
[binutils-gdb.git] / gas / read.h
blob3cdd408168fd93acc1e84bb474f6840b0be655df
1 /* read.h - of read.c
2 Copyright (C) 1986-2024 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 3, or (at your option)
9 any later version.
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, 51 Franklin Street - Fifth Floor, Boston, MA
19 02110-1301, USA. */
21 extern char *input_line_pointer; /* -> char we are parsing now. */
22 extern bool input_from_string;
24 /* Define to make whitespace be allowed in many syntactically
25 unnecessary places. Normally undefined. For compatibility with
26 ancient GNU cc. */
27 /* #undef PERMIT_WHITESPACE */
28 #define PERMIT_WHITESPACE
30 #ifdef PERMIT_WHITESPACE
31 #define SKIP_WHITESPACE() \
32 ((*input_line_pointer == ' ') ? ++input_line_pointer : 0)
33 #define SKIP_ALL_WHITESPACE() \
34 while (*input_line_pointer == ' ') ++input_line_pointer
35 #else
36 #define SKIP_WHITESPACE() know (*input_line_pointer != ' ' )
37 #define SKIP_ALL_WHITESPACE() SKIP_WHITESPACE()
38 #endif
40 #define SKIP_WHITESPACE_AFTER_NAME() \
41 do \
42 { \
43 if (* input_line_pointer == '"') \
44 ++ input_line_pointer; \
45 if (* input_line_pointer == ' ') \
46 ++ input_line_pointer; \
47 } \
48 while (0)
50 #define LEX_NAME (1) /* may continue a name */
51 #define LEX_BEGIN_NAME (2) /* may begin a name */
52 #define LEX_END_NAME (4) /* ends a name */
54 #define is_name_beginner(c) \
55 ( lex_type[(unsigned char) (c)] & LEX_BEGIN_NAME )
56 #define is_part_of_name(c) \
57 ( lex_type[(unsigned char) (c)] & LEX_NAME )
58 #define is_name_ender(c) \
59 ( lex_type[(unsigned char) (c)] & LEX_END_NAME )
61 /* The distinction of "line" and "statement" sadly is blurred by unhelpful
62 naming of e.g. the underlying array. Most users really mean "end of
63 statement". Going forward only these wrappers are supposed to be used. */
64 #define is_end_of_stmt(c) \
65 (is_end_of_line[(unsigned char) (c)])
66 #define is_end_of_line(c) \
67 (is_end_of_line[(unsigned char) (c)] == 1)
69 #ifndef is_a_char
70 #define CHAR_MASK (0xff)
71 #define NOT_A_CHAR (CHAR_MASK+1)
72 #define is_a_char(c) (((unsigned) (c)) <= CHAR_MASK)
73 #endif /* is_a_char() */
75 extern char lex_type[];
76 extern char is_end_of_line[];
78 extern int is_it_end_of_statement (void);
79 extern char *find_end_of_line (char *, int);
81 extern int target_big_endian;
83 /* These are initialized by the CPU specific target files (tc-*.c). */
84 extern const char comment_chars[];
85 extern const char line_comment_chars[];
86 extern const char line_separator_chars[];
88 /* Table of -I directories. */
89 extern const char **include_dirs;
90 extern size_t include_dir_count;
91 extern size_t include_dir_maxlen;
93 /* The offset in the absolute section. */
94 extern addressT abs_section_offset;
96 /* The label on a line, used by some of the pseudo-ops. */
97 extern symbolS *line_label;
99 /* This is used to support MRI common sections. */
100 extern symbolS *mri_common_symbol;
102 /* True if a stabs line debug statement is currently being emitted. */
103 extern int outputting_stabs_line_debug;
105 /* Possible arguments to .linkonce. */
106 enum linkonce_type {
107 LINKONCE_UNSET = 0,
108 LINKONCE_DISCARD,
109 LINKONCE_ONE_ONLY,
110 LINKONCE_SAME_SIZE,
111 LINKONCE_SAME_CONTENTS
114 #ifndef TC_CASE_SENSITIVE
115 extern char original_case_string[];
116 #endif
118 #ifndef TC_PARSE_CONS_RETURN_TYPE
119 #define TC_PARSE_CONS_RETURN_TYPE bfd_reloc_code_real_type
120 #define TC_PARSE_CONS_RETURN_NONE BFD_RELOC_NONE
121 #endif
123 extern void pop_insert (const pseudo_typeS *);
124 extern unsigned int get_stab_string_offset (const char *, segT);
125 extern void aout_process_stab (int, const char *, int, int, int);
126 extern char *demand_copy_string (int *lenP);
127 extern char *demand_copy_C_string (int *len_pointer);
128 extern char get_absolute_expression_and_terminator (long *val_pointer);
129 extern offsetT get_absolute_expression (void);
130 extern unsigned int next_char_of_string (void);
131 extern void s_mri_sect (char *);
132 extern char *mri_comment_field (char *);
133 extern void mri_comment_end (char *, int);
134 extern void init_include_dir (void);
135 extern void add_include_dir (char *);
136 extern FILE *search_and_open (const char *, char *);
137 extern void cons (int nbytes);
138 extern void demand_empty_rest_of_line (void);
139 extern void emit_expr (expressionS *exp, unsigned int nbytes);
140 extern void emit_expr_with_reloc (expressionS *exp, unsigned int nbytes,
141 TC_PARSE_CONS_RETURN_TYPE);
142 extern void emit_expr_fix (expressionS *, unsigned int, fragS *, char *,
143 TC_PARSE_CONS_RETURN_TYPE);
144 extern void emit_leb128_expr (expressionS *, int);
145 extern void equals (char *, int);
146 extern void float_cons (int);
147 extern void ignore_rest_of_line (void);
148 #define discard_rest_of_line ignore_rest_of_line
149 extern unsigned output_leb128 (char *, valueT, int);
150 extern void pseudo_set (symbolS * symbolP);
151 extern void read_a_source_file (const char *name);
152 extern void read_begin (void);
153 extern void read_end (void);
154 extern void read_print_statistics (FILE *);
155 extern char *read_symbol_name (void);
156 extern unsigned sizeof_leb128 (valueT, int);
157 extern void stabs_generate_asm_file (void);
158 extern void stabs_generate_asm_lineno (void);
159 extern void stabs_generate_asm_func (const char *, const char *);
160 extern void stabs_generate_asm_endfunc (const char *, const char *);
161 extern void stabs_begin (void);
162 extern void stabs_end (void);
163 extern void do_repeat (size_t, const char *, const char *, const char *);
164 extern void end_repeat (int);
165 extern void do_parse_cons_expression (expressionS *, int);
166 extern void generate_lineno_debug (void);
167 extern void do_align (unsigned int align, char *fill, unsigned int length,
168 unsigned int max);
169 extern void bss_alloc (symbolS *, addressT, unsigned);
170 extern offsetT parse_align (int);
171 extern symbolS *s_comm_internal (int, symbolS *(*) (int, symbolS *, addressT));
172 extern symbolS *s_lcomm_internal (int, symbolS *, addressT);
173 extern void temp_ilp (char *);
174 extern void restore_ilp (void);
175 extern void s_file_string (char *);
177 extern void s_abort (int) ATTRIBUTE_NORETURN;
178 extern void s_align_bytes (int);
179 extern void s_align_ptwo (int);
180 extern void s_base64 (int);
181 extern void s_bundle_align_mode (int);
182 extern void s_bundle_lock (int);
183 extern void s_bundle_unlock (int);
184 extern void s_comm (int);
185 extern void s_data (int);
186 extern void s_desc (int);
187 extern void s_else (int);
188 extern void s_elseif (int);
189 extern void s_end (int);
190 extern void s_endif (int);
191 extern void s_err (int);
192 extern void s_errwarn (int);
193 extern void s_fail (int);
194 extern void s_file (int);
195 extern void s_fill (int);
196 extern void s_float_space (int);
197 extern void s_func (int);
198 extern void s_globl (int);
199 extern void s_if (int);
200 extern void s_ifb (int);
201 extern void s_ifc (int);
202 extern void s_ifdef (int);
203 extern void s_ifeqs (int);
204 extern void s_ignore (int);
205 extern void s_incbin (int);
206 extern void s_include (int);
207 extern void s_irp (int);
208 extern void s_lcomm (int);
209 extern void s_lcomm_bytes (int);
210 extern void s_leb128 (int);
211 extern void s_linefile (int);
212 extern void s_linkonce (int);
213 extern void s_lsym (int);
214 extern void s_macro (int);
215 extern void s_mexit (int);
216 extern void s_mri (int);
217 extern void s_mri_common (int);
218 extern void s_nop (int);
219 extern void s_nops (int);
220 extern void s_org (int);
221 extern void s_print (int);
222 extern void s_purgem (int);
223 extern void s_rept (int);
224 extern void s_rva (int);
225 extern void s_set (int);
226 extern void s_space (int);
227 extern void s_stab (int);
228 extern void s_struct (int);
229 extern void s_text (int);
230 extern void s_weakref (int);
231 extern void s_xstab (int);
232 extern void stringer (int);