1999-05-03 15:29:11 +08:00
|
|
|
/* read.h - of read.c
|
2022-01-02 06:30:17 +08:00
|
|
|
Copyright (C) 1986-2022 Free Software Foundation, Inc.
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
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
|
2007-07-03 19:01:12 +08:00
|
|
|
the Free Software Foundation; either version 3, or (at your option)
|
1999-05-03 15:29:11 +08:00
|
|
|
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
|
2000-12-14 09:12:43 +08:00
|
|
|
along with GAS; see the file COPYING. If not, write to the Free
|
2005-05-05 17:13:19 +08:00
|
|
|
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
|
|
|
|
02110-1301, USA. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2000-12-14 09:12:43 +08:00
|
|
|
extern char *input_line_pointer; /* -> char we are parsing now. */
|
Use bool in gas
* as.h (POISON_BFD_BOOLEAN): Define.
* as.c, * as.h, * atof-generic.c, * config/atof-ieee.c,
* config/bfin-aux.h, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-elf.h, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arc.h, * config/tc-arm.c, * config/tc-arm.h,
* config/tc-avr.c, * config/tc-avr.h, * config/tc-bfin.c,
* config/tc-bfin.h, * config/tc-bpf.c, * config/tc-cris.c,
* config/tc-csky.c, * config/tc-csky.h, * config/tc-d10v.c,
* config/tc-d10v.h, * config/tc-d30v.c, * config/tc-d30v.h,
* config/tc-dlx.c, * config/tc-dlx.h, * config/tc-epiphany.c,
* config/tc-epiphany.h, * config/tc-fr30.c, * config/tc-fr30.h,
* config/tc-frv.c, * config/tc-frv.h, * config/tc-ft32.c,
* config/tc-ft32.h, * config/tc-h8300.c, * config/tc-hppa.c,
* config/tc-i386-intel.c, * config/tc-i386.c, * config/tc-ia64.c,
* config/tc-ip2k.c, * config/tc-iq2000.c, * config/tc-iq2000.h,
* config/tc-lm32.c, * config/tc-lm32.h, * config/tc-m32c.c,
* config/tc-m32c.h, * config/tc-m32r.c, * config/tc-m32r.h,
* config/tc-m68hc11.c, * config/tc-m68k.c, * config/tc-mcore.c,
* config/tc-mcore.h, * config/tc-mep.c, * config/tc-mep.h,
* config/tc-metag.c, * config/tc-metag.h,
* config/tc-microblaze.c, * config/tc-mips.c, * config/tc-mips.h,
* config/tc-mmix.c, * config/tc-mn10200.c, * config/tc-mn10300.c,
* config/tc-mn10300.h, * config/tc-moxie.c, * config/tc-msp430.c,
* config/tc-msp430.h, * config/tc-mt.c, * config/tc-mt.h,
* config/tc-nds32.c, * config/tc-nds32.h, * config/tc-nios2.c,
* config/tc-ns32k.c, * config/tc-or1k.c, * config/tc-or1k.h,
* config/tc-pdp11.c, * config/tc-ppc.c, * config/tc-pru.c,
* config/tc-pru.h, * config/tc-riscv.c, * config/tc-riscv.h,
* config/tc-rx.c, * config/tc-rx.h, * config/tc-s12z.c,
* config/tc-s12z.h, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score.h, * config/tc-score7.c, * config/tc-sh.c,
* config/tc-sh.h, * config/tc-spu.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tic6x.h, * config/tc-tilegx.c,
* config/tc-tilepro.c, * config/tc-v850.c, * config/tc-v850.h,
* config/tc-visium.c, * config/tc-visium.h, * config/tc-wasm32.c,
* config/tc-wasm32.h, * config/tc-xc16x.c, * config/tc-xgate.c,
* config/tc-xstormy16.c, * config/tc-xstormy16.h,
* config/tc-xtensa.c, * config/tc-xtensa.h, * config/tc-z80.c,
* config/tc-z8k.c, * config/xtensa-istack.h,
* config/xtensa-relax.c, * config/xtensa-relax.h, * dw2gencfi.c,
* dwarf2dbg.c, * dwarf2dbg.h, * expr.c, * expr.h, * frags.c,
* frags.h, * listing.c, * macro.c, * output-file.c, * read.c,
* read.h, * stabs.c, * symbols.c, * write.c: Replace bfd_boolean
with bool, FALSE with false, and TRUE with true.
2021-03-31 08:12:05 +08:00
|
|
|
extern bool input_from_string;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2000-12-14 09:12:43 +08:00
|
|
|
/* Define to make whitespace be allowed in many syntactically
|
|
|
|
unnecessary places. Normally undefined. For compatibility with
|
|
|
|
ancient GNU cc. */
|
1999-05-03 15:29:11 +08:00
|
|
|
/* #undef PERMIT_WHITESPACE */
|
2000-12-14 09:12:43 +08:00
|
|
|
#define PERMIT_WHITESPACE
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#ifdef PERMIT_WHITESPACE
|
2000-12-14 09:12:43 +08:00
|
|
|
#define SKIP_WHITESPACE() \
|
2004-02-07 00:00:21 +08:00
|
|
|
((*input_line_pointer == ' ') ? ++input_line_pointer : 0)
|
2016-12-06 00:54:59 +08:00
|
|
|
#define SKIP_ALL_WHITESPACE() \
|
|
|
|
while (*input_line_pointer == ' ') ++input_line_pointer
|
1999-05-03 15:29:11 +08:00
|
|
|
#else
|
2016-12-06 00:54:59 +08:00
|
|
|
#define SKIP_WHITESPACE() know (*input_line_pointer != ' ' )
|
|
|
|
#define SKIP_ALL_WHITESPACE() SKIP_WHITESPACE()
|
1999-05-03 15:29:11 +08:00
|
|
|
#endif
|
|
|
|
|
2015-08-21 23:42:14 +08:00
|
|
|
#define SKIP_WHITESPACE_AFTER_NAME() \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
if (* input_line_pointer == '"') \
|
|
|
|
++ input_line_pointer; \
|
|
|
|
if (* input_line_pointer == ' ') \
|
|
|
|
++ input_line_pointer; \
|
|
|
|
} \
|
|
|
|
while (0)
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
#define LEX_NAME (1) /* may continue a name */
|
|
|
|
#define LEX_BEGIN_NAME (2) /* may begin a name */
|
1999-06-06 02:19:09 +08:00
|
|
|
#define LEX_END_NAME (4) /* ends a name */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define is_name_beginner(c) \
|
|
|
|
( lex_type[(unsigned char) (c)] & LEX_BEGIN_NAME )
|
|
|
|
#define is_part_of_name(c) \
|
|
|
|
( lex_type[(unsigned char) (c)] & LEX_NAME )
|
1999-06-06 02:19:09 +08:00
|
|
|
#define is_name_ender(c) \
|
|
|
|
( lex_type[(unsigned char) (c)] & LEX_END_NAME )
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#ifndef is_a_char
|
|
|
|
#define CHAR_MASK (0xff)
|
|
|
|
#define NOT_A_CHAR (CHAR_MASK+1)
|
2000-12-14 09:12:43 +08:00
|
|
|
#define is_a_char(c) (((unsigned) (c)) <= CHAR_MASK)
|
1999-05-03 15:29:11 +08:00
|
|
|
#endif /* is_a_char() */
|
|
|
|
|
|
|
|
extern char lex_type[];
|
|
|
|
extern char is_end_of_line[];
|
|
|
|
|
2003-11-28 03:14:41 +08:00
|
|
|
extern int is_it_end_of_statement (void);
|
2005-05-17 22:02:30 +08:00
|
|
|
extern char *find_end_of_line (char *, int);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
extern int target_big_endian;
|
|
|
|
|
|
|
|
/* These are initialized by the CPU specific target files (tc-*.c). */
|
|
|
|
extern const char comment_chars[];
|
|
|
|
extern const char line_comment_chars[];
|
|
|
|
extern const char line_separator_chars[];
|
|
|
|
|
|
|
|
/* Table of -I directories. */
|
2016-02-26 00:55:21 +08:00
|
|
|
extern const char **include_dirs;
|
1999-05-03 15:29:11 +08:00
|
|
|
extern int include_dir_count;
|
|
|
|
extern int include_dir_maxlen;
|
|
|
|
|
|
|
|
/* The offset in the absolute section. */
|
|
|
|
extern addressT abs_section_offset;
|
|
|
|
|
|
|
|
/* The label on a line, used by some of the pseudo-ops. */
|
|
|
|
extern symbolS *line_label;
|
|
|
|
|
|
|
|
/* This is used to support MRI common sections. */
|
|
|
|
extern symbolS *mri_common_symbol;
|
|
|
|
|
2000-12-05 08:56:09 +08:00
|
|
|
/* True if a stabs line debug statement is currently being emitted. */
|
2000-12-13 05:21:39 +08:00
|
|
|
extern int outputting_stabs_line_debug;
|
2000-12-05 08:56:09 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
/* Possible arguments to .linkonce. */
|
2000-12-14 09:12:43 +08:00
|
|
|
enum linkonce_type {
|
1999-05-03 15:29:11 +08:00
|
|
|
LINKONCE_UNSET = 0,
|
|
|
|
LINKONCE_DISCARD,
|
|
|
|
LINKONCE_ONE_ONLY,
|
|
|
|
LINKONCE_SAME_SIZE,
|
|
|
|
LINKONCE_SAME_CONTENTS
|
|
|
|
};
|
|
|
|
|
2004-02-09 20:12:42 +08:00
|
|
|
#ifndef TC_CASE_SENSITIVE
|
2000-11-03 03:32:47 +08:00
|
|
|
extern char original_case_string[];
|
|
|
|
#endif
|
|
|
|
|
gas TC_PARSE_CONS_EXPRESSION communication with TC_CONS_FIX_NEW
A number of targets pass extra information from TC_PARSE_CONS_EXPRESSION
to TC_CONS_FIX_NEW via static variables. That's OK, but not best
practice. tc-ppc.c goes further in implementing its own replacement
for cons(), because the generic one doesn't allow relocation modifiers
on constants. This patch fixes both of these warts.
* gas/config/tc-alpha.h (TC_CONS_FIX_NEW): Add RELOC parameter.
* gas/config/tc-arc.c (arc_cons_fix_new): Add reloc parameter.
* gas/config/tc-arc.h (arc_cons_fix_new): Update prototype.
(TC_CONS_FIX_NEW): Add RELOC parameter.
* gas/config/tc-arm.c (cons_fix_new_arm): Similarly
* gas/config/tc-arm.h (cons_fix_new_arm, TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-cr16.c (cr16_cons_fix_new): Similarly.
* gas/config/tc-cr16.h (cr16_cons_fix_new, TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-crx.h (TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-m32c.c (m32c_cons_fix_new): Similarly.
* gas/config/tc-m32c.h (m32c_cons_fix_new, TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-mn10300.c (mn10300_cons_fix_new): Similarly.
* gas/config/tc-mn10300.h (mn10300_cons_fix_new, TC_CONS_FIX_NEW):
Similarly.
* gas/config/tc-ns32k.c (cons_fix_new_ns32k): Similarly.
* gas/config/tc-ns32k.h (cons_fix_new_ns32k): Similarly.
* gas/config/tc-pj.c (pj_cons_fix_new_pj): Similarly.
* gas/config/tc-pj.h (pj_cons_fix_new_pj, TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-rx.c (rx_cons_fix_new): Similarly.
* gas/config/tc-rx.h (rx_cons_fix_new, TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-sh.c (sh_cons_fix_new): Similarly.
* gas/config/tc-sh.h (sh_cons_fix_new, TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-tic54x.c (tic54x_cons_fix_new): Similarly.
* gas/config/tc-tic54x.h (tic54x_cons_fix_new, TC_CONS_FIX_NEW):
Similarly.
* gas/config/tc-tic6x.c (tic6x_cons_fix_new): Similarly.
* gas/config/tc-tic6x.h (tic6x_cons_fix_new, TC_CONS_FIX_NEW):
Similarly.
* gas/config/tc-arc.c (arc_parse_cons_expression): Return reloc.
* gas/config/tc-arc.h (arc_parse_cons_expression): Update proto.
* gas/config/tc-avr.c (exp_mod_data): Make global.
(pexp_mod_data): Delete.
(avr_parse_cons_expression): Return exp_mod_data pointer.
(avr_cons_fix_new): Add exp_mod_data_t pointer param.
(exp_mod_data_t): Move typedef..
* gas/config/tc-avr.h: ..to here.
(exp_mod_data): Declare.
(TC_PARSE_CONS_RETURN_TYPE, TC_PARSE_CONS_RETURN_NONE): Define.
(avr_parse_cons_expression, avr_cons_fix_new): Update prototype.
(TC_CONS_FIX_NEW): Update.
* gas/config/tc-hppa.c (hppa_field_selector): Delete static var.
(cons_fix_new_hppa): Add hppa_field_selector param.
(fix_new_hppa): Adjust.
(parse_cons_expression_hppa): Return field selector.
* gas/config/tc-hppa.h (parse_cons_expression_hppa): Update proto.
(cons_fix_new_hppa): Likewise.
(TC_PARSE_CONS_RETURN_TYPE, TC_PARSE_CONS_RETURN_NONE): Define.
* gas/config/tc-i386.c (got_reloc): Delete static var.
(x86_cons_fix_new): Add reloc param.
(x86_cons): Return got reloc.
* gas/config/tc-i386.h (x86_cons, x86_cons_fix_new): Update proto.
(TC_CONS_FIX_NEW): Add RELOC param.
* gas/config/tc-ia64.c (ia64_cons_fix_new): Add reloc param. Adjust
calls.
* gas/config/tc-ia64.h (ia64_cons_fix_new): Update prototype.
(TC_CONS_FIX_NEW): Add reloc param.
* gas/config/tc-microblaze.c (parse_cons_expression_microblaze):
Return reloc.
(cons_fix_new_microblaze): Add reloc param.
* gas/config/tc-microblaze.h: Formatting.
(parse_cons_expression_microblaze): Update proto.
(cons_fix_new_microblaze): Likewise.
* gas/config/tc-nios2.c (nios2_tls_ldo_reloc): Delete static var.
(nios2_cons): Return ldo reloc.
(nios2_cons_fix_new): Delete.
* gas/config/tc-nios2.h (nios2_cons): Update prototype.
(nios2_cons_fix_new, TC_CONS_FIX_NEW): Delete.
* gas/config/tc-ppc.c (md_pseudo_table): Remove quad, long, word,
short. Make llong use cons.
(ppc_elf_suffix): Return BFD_RELOC_NONE rather than BFD_RELOC_UNUSED.
(ppc_elf_cons): Delete.
(ppc_elf_parse_cons): New function.
(ppc_elf_validate_fix): Don't check for BFD_RELOC_UNUSED.
(md_assemble): Use BFD_RELOC_NONE rather than BFD_RELOC_UNUSED.
* gas/config/tc-ppc.h (TC_PARSE_CONS_EXPRESSION): Define
(ppc_elf_parse_cons): Declare.
* gas/config/tc-sparc.c (sparc_cons_special_reloc): Delete static var.
(sparc_cons): Return reloc specifier.
(cons_fix_new_sparc): Add reloc specifier param.
(sparc_cfi_emit_pcrel_expr): Use emit_expr_with_reloc.
* gas/config/tc-sparc.h (TC_PARSE_CONS_RETURN_TYPE): Define.
(TC_PARSE_CONS_RETURN_NONE): Define.
(sparc_cons, cons_fix_new_sparc): Update prototype.
* gas/config/tc-v850.c (hold_cons_reloc): Delete static var.
(v850_reloc_prefix): Use BFD_RELOC_NONE rather than BFD_RELOC_UNUSED.
(md_assemble): Likewise.
(parse_cons_expression_v850): Return reloc.
(cons_fix_new_v850): Add reloc parameter.
* gas/config/tc-v850.h (parse_cons_expression_v850): Update proto.
(cons_fix_new_v850): Likewise.
* gas/config/tc-vax.c (vax_cons_special_reloc): Delete static var.
(vax_cons): Return reloc.
(vax_cons_fix_new): Add reloc parameter.
* gas/config/tc-vax.h (vax_cons, vax_cons_fix_new): Update proto.
* gas/config/tc-xstormy16.c (xstormy16_cons_fix_new): Add reloc param.
* gas/config/tc-xstormy16.h (xstormy16_cons_fix_new): Update proto.
* gas/dwarf2dbg.c (TC_PARSE_CONS_RETURN_NONE): Provide default.
(emit_fixed_inc_line_addr): Adjust exmit_expr_fix calls.
* gas/read.c (TC_PARSE_CONS_EXPRESSION): Return value.
(do_parse_cons_expression): Adjust.
(cons_worker): Pass return value from TC_PARSE_CONS_EXPRESSION
to emit_expr_with_reloc.
(emit_expr_with_reloc): New function handling reloc, mostly
extracted from..
(emit_expr): ..here.
(emit_expr_fix): Add reloc param. Adjust TC_CONS_FIX_NEW invocation.
Handle reloc.
(parse_mri_cons): Convert to ISO.
* gas/read.h (TC_PARSE_CONS_RETURN_TYPE): Define.
(TC_PARSE_CONS_RETURN_NONE): Define.
(emit_expr_with_reloc): Declare.
(emit_expr_fix): Update prototype.
* gas/write.c (write_object_file): Update TC_CONS_FIX_NEW invocation.
2014-04-08 13:08:22 +08:00
|
|
|
#ifndef TC_PARSE_CONS_RETURN_TYPE
|
|
|
|
#define TC_PARSE_CONS_RETURN_TYPE bfd_reloc_code_real_type
|
|
|
|
#define TC_PARSE_CONS_RETURN_NONE BFD_RELOC_NONE
|
|
|
|
#endif
|
|
|
|
|
2003-11-28 03:14:41 +08:00
|
|
|
extern void pop_insert (const pseudo_typeS *);
|
1999-05-03 15:29:11 +08:00
|
|
|
extern unsigned int get_stab_string_offset
|
Use bool in gas
* as.h (POISON_BFD_BOOLEAN): Define.
* as.c, * as.h, * atof-generic.c, * config/atof-ieee.c,
* config/bfin-aux.h, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-elf.h, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arc.h, * config/tc-arm.c, * config/tc-arm.h,
* config/tc-avr.c, * config/tc-avr.h, * config/tc-bfin.c,
* config/tc-bfin.h, * config/tc-bpf.c, * config/tc-cris.c,
* config/tc-csky.c, * config/tc-csky.h, * config/tc-d10v.c,
* config/tc-d10v.h, * config/tc-d30v.c, * config/tc-d30v.h,
* config/tc-dlx.c, * config/tc-dlx.h, * config/tc-epiphany.c,
* config/tc-epiphany.h, * config/tc-fr30.c, * config/tc-fr30.h,
* config/tc-frv.c, * config/tc-frv.h, * config/tc-ft32.c,
* config/tc-ft32.h, * config/tc-h8300.c, * config/tc-hppa.c,
* config/tc-i386-intel.c, * config/tc-i386.c, * config/tc-ia64.c,
* config/tc-ip2k.c, * config/tc-iq2000.c, * config/tc-iq2000.h,
* config/tc-lm32.c, * config/tc-lm32.h, * config/tc-m32c.c,
* config/tc-m32c.h, * config/tc-m32r.c, * config/tc-m32r.h,
* config/tc-m68hc11.c, * config/tc-m68k.c, * config/tc-mcore.c,
* config/tc-mcore.h, * config/tc-mep.c, * config/tc-mep.h,
* config/tc-metag.c, * config/tc-metag.h,
* config/tc-microblaze.c, * config/tc-mips.c, * config/tc-mips.h,
* config/tc-mmix.c, * config/tc-mn10200.c, * config/tc-mn10300.c,
* config/tc-mn10300.h, * config/tc-moxie.c, * config/tc-msp430.c,
* config/tc-msp430.h, * config/tc-mt.c, * config/tc-mt.h,
* config/tc-nds32.c, * config/tc-nds32.h, * config/tc-nios2.c,
* config/tc-ns32k.c, * config/tc-or1k.c, * config/tc-or1k.h,
* config/tc-pdp11.c, * config/tc-ppc.c, * config/tc-pru.c,
* config/tc-pru.h, * config/tc-riscv.c, * config/tc-riscv.h,
* config/tc-rx.c, * config/tc-rx.h, * config/tc-s12z.c,
* config/tc-s12z.h, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score.h, * config/tc-score7.c, * config/tc-sh.c,
* config/tc-sh.h, * config/tc-spu.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tic6x.h, * config/tc-tilegx.c,
* config/tc-tilepro.c, * config/tc-v850.c, * config/tc-v850.h,
* config/tc-visium.c, * config/tc-visium.h, * config/tc-wasm32.c,
* config/tc-wasm32.h, * config/tc-xc16x.c, * config/tc-xgate.c,
* config/tc-xstormy16.c, * config/tc-xstormy16.h,
* config/tc-xtensa.c, * config/tc-xtensa.h, * config/tc-z80.c,
* config/tc-z8k.c, * config/xtensa-istack.h,
* config/xtensa-relax.c, * config/xtensa-relax.h, * dw2gencfi.c,
* dwarf2dbg.c, * dwarf2dbg.h, * expr.c, * expr.h, * frags.c,
* frags.h, * listing.c, * macro.c, * output-file.c, * read.c,
* read.h, * stabs.c, * symbols.c, * write.c: Replace bfd_boolean
with bool, FALSE with false, and TRUE with true.
2021-03-31 08:12:05 +08:00
|
|
|
(const char *, const char *, bool);
|
2003-11-28 03:14:41 +08:00
|
|
|
extern void aout_process_stab (int, const char *, int, int, int);
|
|
|
|
extern char *demand_copy_string (int *lenP);
|
|
|
|
extern char *demand_copy_C_string (int *len_pointer);
|
|
|
|
extern char get_absolute_expression_and_terminator (long *val_pointer);
|
|
|
|
extern offsetT get_absolute_expression (void);
|
|
|
|
extern unsigned int next_char_of_string (void);
|
|
|
|
extern void s_mri_sect (char *);
|
|
|
|
extern char *mri_comment_field (char *);
|
|
|
|
extern void mri_comment_end (char *, int);
|
|
|
|
extern void add_include_dir (char *path);
|
|
|
|
extern void cons (int nbytes);
|
|
|
|
extern void demand_empty_rest_of_line (void);
|
|
|
|
extern void emit_expr (expressionS *exp, unsigned int nbytes);
|
gas TC_PARSE_CONS_EXPRESSION communication with TC_CONS_FIX_NEW
A number of targets pass extra information from TC_PARSE_CONS_EXPRESSION
to TC_CONS_FIX_NEW via static variables. That's OK, but not best
practice. tc-ppc.c goes further in implementing its own replacement
for cons(), because the generic one doesn't allow relocation modifiers
on constants. This patch fixes both of these warts.
* gas/config/tc-alpha.h (TC_CONS_FIX_NEW): Add RELOC parameter.
* gas/config/tc-arc.c (arc_cons_fix_new): Add reloc parameter.
* gas/config/tc-arc.h (arc_cons_fix_new): Update prototype.
(TC_CONS_FIX_NEW): Add RELOC parameter.
* gas/config/tc-arm.c (cons_fix_new_arm): Similarly
* gas/config/tc-arm.h (cons_fix_new_arm, TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-cr16.c (cr16_cons_fix_new): Similarly.
* gas/config/tc-cr16.h (cr16_cons_fix_new, TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-crx.h (TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-m32c.c (m32c_cons_fix_new): Similarly.
* gas/config/tc-m32c.h (m32c_cons_fix_new, TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-mn10300.c (mn10300_cons_fix_new): Similarly.
* gas/config/tc-mn10300.h (mn10300_cons_fix_new, TC_CONS_FIX_NEW):
Similarly.
* gas/config/tc-ns32k.c (cons_fix_new_ns32k): Similarly.
* gas/config/tc-ns32k.h (cons_fix_new_ns32k): Similarly.
* gas/config/tc-pj.c (pj_cons_fix_new_pj): Similarly.
* gas/config/tc-pj.h (pj_cons_fix_new_pj, TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-rx.c (rx_cons_fix_new): Similarly.
* gas/config/tc-rx.h (rx_cons_fix_new, TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-sh.c (sh_cons_fix_new): Similarly.
* gas/config/tc-sh.h (sh_cons_fix_new, TC_CONS_FIX_NEW): Similarly.
* gas/config/tc-tic54x.c (tic54x_cons_fix_new): Similarly.
* gas/config/tc-tic54x.h (tic54x_cons_fix_new, TC_CONS_FIX_NEW):
Similarly.
* gas/config/tc-tic6x.c (tic6x_cons_fix_new): Similarly.
* gas/config/tc-tic6x.h (tic6x_cons_fix_new, TC_CONS_FIX_NEW):
Similarly.
* gas/config/tc-arc.c (arc_parse_cons_expression): Return reloc.
* gas/config/tc-arc.h (arc_parse_cons_expression): Update proto.
* gas/config/tc-avr.c (exp_mod_data): Make global.
(pexp_mod_data): Delete.
(avr_parse_cons_expression): Return exp_mod_data pointer.
(avr_cons_fix_new): Add exp_mod_data_t pointer param.
(exp_mod_data_t): Move typedef..
* gas/config/tc-avr.h: ..to here.
(exp_mod_data): Declare.
(TC_PARSE_CONS_RETURN_TYPE, TC_PARSE_CONS_RETURN_NONE): Define.
(avr_parse_cons_expression, avr_cons_fix_new): Update prototype.
(TC_CONS_FIX_NEW): Update.
* gas/config/tc-hppa.c (hppa_field_selector): Delete static var.
(cons_fix_new_hppa): Add hppa_field_selector param.
(fix_new_hppa): Adjust.
(parse_cons_expression_hppa): Return field selector.
* gas/config/tc-hppa.h (parse_cons_expression_hppa): Update proto.
(cons_fix_new_hppa): Likewise.
(TC_PARSE_CONS_RETURN_TYPE, TC_PARSE_CONS_RETURN_NONE): Define.
* gas/config/tc-i386.c (got_reloc): Delete static var.
(x86_cons_fix_new): Add reloc param.
(x86_cons): Return got reloc.
* gas/config/tc-i386.h (x86_cons, x86_cons_fix_new): Update proto.
(TC_CONS_FIX_NEW): Add RELOC param.
* gas/config/tc-ia64.c (ia64_cons_fix_new): Add reloc param. Adjust
calls.
* gas/config/tc-ia64.h (ia64_cons_fix_new): Update prototype.
(TC_CONS_FIX_NEW): Add reloc param.
* gas/config/tc-microblaze.c (parse_cons_expression_microblaze):
Return reloc.
(cons_fix_new_microblaze): Add reloc param.
* gas/config/tc-microblaze.h: Formatting.
(parse_cons_expression_microblaze): Update proto.
(cons_fix_new_microblaze): Likewise.
* gas/config/tc-nios2.c (nios2_tls_ldo_reloc): Delete static var.
(nios2_cons): Return ldo reloc.
(nios2_cons_fix_new): Delete.
* gas/config/tc-nios2.h (nios2_cons): Update prototype.
(nios2_cons_fix_new, TC_CONS_FIX_NEW): Delete.
* gas/config/tc-ppc.c (md_pseudo_table): Remove quad, long, word,
short. Make llong use cons.
(ppc_elf_suffix): Return BFD_RELOC_NONE rather than BFD_RELOC_UNUSED.
(ppc_elf_cons): Delete.
(ppc_elf_parse_cons): New function.
(ppc_elf_validate_fix): Don't check for BFD_RELOC_UNUSED.
(md_assemble): Use BFD_RELOC_NONE rather than BFD_RELOC_UNUSED.
* gas/config/tc-ppc.h (TC_PARSE_CONS_EXPRESSION): Define
(ppc_elf_parse_cons): Declare.
* gas/config/tc-sparc.c (sparc_cons_special_reloc): Delete static var.
(sparc_cons): Return reloc specifier.
(cons_fix_new_sparc): Add reloc specifier param.
(sparc_cfi_emit_pcrel_expr): Use emit_expr_with_reloc.
* gas/config/tc-sparc.h (TC_PARSE_CONS_RETURN_TYPE): Define.
(TC_PARSE_CONS_RETURN_NONE): Define.
(sparc_cons, cons_fix_new_sparc): Update prototype.
* gas/config/tc-v850.c (hold_cons_reloc): Delete static var.
(v850_reloc_prefix): Use BFD_RELOC_NONE rather than BFD_RELOC_UNUSED.
(md_assemble): Likewise.
(parse_cons_expression_v850): Return reloc.
(cons_fix_new_v850): Add reloc parameter.
* gas/config/tc-v850.h (parse_cons_expression_v850): Update proto.
(cons_fix_new_v850): Likewise.
* gas/config/tc-vax.c (vax_cons_special_reloc): Delete static var.
(vax_cons): Return reloc.
(vax_cons_fix_new): Add reloc parameter.
* gas/config/tc-vax.h (vax_cons, vax_cons_fix_new): Update proto.
* gas/config/tc-xstormy16.c (xstormy16_cons_fix_new): Add reloc param.
* gas/config/tc-xstormy16.h (xstormy16_cons_fix_new): Update proto.
* gas/dwarf2dbg.c (TC_PARSE_CONS_RETURN_NONE): Provide default.
(emit_fixed_inc_line_addr): Adjust exmit_expr_fix calls.
* gas/read.c (TC_PARSE_CONS_EXPRESSION): Return value.
(do_parse_cons_expression): Adjust.
(cons_worker): Pass return value from TC_PARSE_CONS_EXPRESSION
to emit_expr_with_reloc.
(emit_expr_with_reloc): New function handling reloc, mostly
extracted from..
(emit_expr): ..here.
(emit_expr_fix): Add reloc param. Adjust TC_CONS_FIX_NEW invocation.
Handle reloc.
(parse_mri_cons): Convert to ISO.
* gas/read.h (TC_PARSE_CONS_RETURN_TYPE): Define.
(TC_PARSE_CONS_RETURN_NONE): Define.
(emit_expr_with_reloc): Declare.
(emit_expr_fix): Update prototype.
* gas/write.c (write_object_file): Update TC_CONS_FIX_NEW invocation.
2014-04-08 13:08:22 +08:00
|
|
|
extern void emit_expr_with_reloc (expressionS *exp, unsigned int nbytes,
|
|
|
|
TC_PARSE_CONS_RETURN_TYPE);
|
|
|
|
extern void emit_expr_fix (expressionS *, unsigned int, fragS *, char *,
|
|
|
|
TC_PARSE_CONS_RETURN_TYPE);
|
2020-08-04 04:02:24 +08:00
|
|
|
extern void emit_leb128_expr (expressionS *, int);
|
2016-02-18 17:47:31 +08:00
|
|
|
extern void equals (char *, int);
|
|
|
|
extern void float_cons (int);
|
2003-11-28 03:14:41 +08:00
|
|
|
extern void ignore_rest_of_line (void);
|
2005-05-17 22:02:30 +08:00
|
|
|
#define discard_rest_of_line ignore_rest_of_line
|
2016-02-18 17:47:31 +08:00
|
|
|
extern unsigned output_leb128 (char *, valueT, int);
|
2003-11-28 03:14:41 +08:00
|
|
|
extern void pseudo_set (symbolS * symbolP);
|
2016-02-26 00:55:21 +08:00
|
|
|
extern void read_a_source_file (const char *name);
|
2003-11-28 03:14:41 +08:00
|
|
|
extern void read_begin (void);
|
|
|
|
extern void read_print_statistics (FILE *);
|
2015-01-12 22:24:20 +08:00
|
|
|
extern char *read_symbol_name (void);
|
2016-02-18 17:47:31 +08:00
|
|
|
extern unsigned sizeof_leb128 (valueT, int);
|
2003-11-28 03:14:41 +08:00
|
|
|
extern void stabs_generate_asm_file (void);
|
|
|
|
extern void stabs_generate_asm_lineno (void);
|
|
|
|
extern void stabs_generate_asm_func (const char *, const char *);
|
|
|
|
extern void stabs_generate_asm_endfunc (const char *, const char *);
|
2017-10-20 18:45:19 +08:00
|
|
|
extern void do_repeat (size_t, const char *, const char *);
|
|
|
|
extern void do_repeat_with_expander (size_t, const char *, const char *, const char *);
|
2003-11-28 03:14:41 +08:00
|
|
|
extern void end_repeat (int);
|
|
|
|
extern void do_parse_cons_expression (expressionS *, int);
|
|
|
|
|
|
|
|
extern void generate_lineno_debug (void);
|
|
|
|
|
|
|
|
extern void s_abort (int) ATTRIBUTE_NORETURN;
|
|
|
|
extern void s_align_bytes (int arg);
|
|
|
|
extern void s_align_ptwo (int);
|
2016-03-07 23:16:28 +08:00
|
|
|
extern void do_align (unsigned int align, char *fill, unsigned int length,
|
|
|
|
unsigned int max);
|
2016-02-18 17:47:31 +08:00
|
|
|
extern void bss_alloc (symbolS *, addressT, unsigned);
|
2003-12-13 16:23:05 +08:00
|
|
|
extern offsetT parse_align (int);
|
|
|
|
extern symbolS *s_comm_internal (int, symbolS *(*) (int, symbolS *, addressT));
|
2003-12-13 16:59:24 +08:00
|
|
|
extern symbolS *s_lcomm_internal (int, symbolS *, addressT);
|
2004-11-10 11:28:45 +08:00
|
|
|
extern void s_app_file_string (char *, int);
|
2003-11-28 03:14:41 +08:00
|
|
|
extern void s_app_file (int);
|
|
|
|
extern void s_app_line (int);
|
2012-03-14 00:59:57 +08:00
|
|
|
extern void s_bundle_align_mode (int);
|
|
|
|
extern void s_bundle_lock (int);
|
|
|
|
extern void s_bundle_unlock (int);
|
2003-11-28 03:14:41 +08:00
|
|
|
extern void s_comm (int);
|
|
|
|
extern void s_data (int);
|
|
|
|
extern void s_desc (int);
|
|
|
|
extern void s_else (int arg);
|
|
|
|
extern void s_elseif (int arg);
|
|
|
|
extern void s_end (int arg);
|
|
|
|
extern void s_endif (int arg);
|
|
|
|
extern void s_err (int);
|
2004-11-22 21:05:27 +08:00
|
|
|
extern void s_errwarn (int);
|
2003-11-28 03:14:41 +08:00
|
|
|
extern void s_fail (int);
|
|
|
|
extern void s_fill (int);
|
|
|
|
extern void s_float_space (int mult);
|
|
|
|
extern void s_func (int);
|
|
|
|
extern void s_globl (int arg);
|
|
|
|
extern void s_if (int arg);
|
2005-05-06 14:38:11 +08:00
|
|
|
extern void s_ifb (int arg);
|
2003-11-28 03:14:41 +08:00
|
|
|
extern void s_ifc (int arg);
|
|
|
|
extern void s_ifdef (int arg);
|
|
|
|
extern void s_ifeqs (int arg);
|
|
|
|
extern void s_ignore (int arg);
|
|
|
|
extern void s_include (int arg);
|
|
|
|
extern void s_irp (int arg);
|
|
|
|
extern void s_lcomm (int needs_align);
|
|
|
|
extern void s_lcomm_bytes (int needs_align);
|
|
|
|
extern void s_leb128 (int sign);
|
|
|
|
extern void s_linkonce (int);
|
|
|
|
extern void s_lsym (int);
|
|
|
|
extern void s_macro (int);
|
|
|
|
extern void s_mexit (int);
|
|
|
|
extern void s_mri (int);
|
|
|
|
extern void s_mri_common (int);
|
|
|
|
extern void s_org (int);
|
|
|
|
extern void s_print (int);
|
|
|
|
extern void s_purgem (int);
|
|
|
|
extern void s_rept (int);
|
|
|
|
extern void s_set (int);
|
|
|
|
extern void s_space (int mult);
|
2020-09-14 23:14:24 +08:00
|
|
|
extern void s_nop (int);
|
2018-02-28 06:45:48 +08:00
|
|
|
extern void s_nops (int);
|
2003-11-28 03:14:41 +08:00
|
|
|
extern void s_stab (int what);
|
|
|
|
extern void s_struct (int);
|
|
|
|
extern void s_text (int);
|
|
|
|
extern void stringer (int append_zero);
|
|
|
|
extern void s_xstab (int what);
|
|
|
|
extern void s_rva (int);
|
|
|
|
extern void s_incbin (int);
|
gas/ChangeLog:
* read.c (potable): Add weakref.
(s_weakref): New.
* read.h (s_weakref): Declare.
* struc-symbol.h (struct symbol): Add sy_weakrefr and sy_weakrefd.
* symbols.c (colon): Clear weakrefr.
(symbol_find_exact): Rename to, and reimplement in terms of...
(symbol_find_exact_noref): ... new function.
(symbol_find): Likewise...
(symbol_find_noref): ... ditto.
(resolve_symbol_value): Resolve weakrefr without setting their
values.
(S_SET_WEAK): Call hook.
(S_GET_VALUE): Follow weakref link.
(S_SET_VALUE): Clear weakrefr.
(S_IS_WEAK): Follow weakref link.
(S_IS_WEAKREFR, S_SET_WEAKREFR, S_CLEAR_WEAKREFR): New.
(S_IS_WEAKREFD, S_SET_WEAKREFD, S_CLEAR_WEAKREFD): New.
(symbol_set_value_expression, symbol_set_frag): Clear weakrefr.
(symbol_mark_used): Follow weakref link.
(print_symbol_value_1): Print weak, weakrefr and weakrefd.
* symbols.h (symbol_find_noref, symbol_find_exact_noref): Declare.
(S_IS_WEAKREFR, S_SET_WEAKREFR, S_CLEAR_WEAKREFR): Declare.
(S_IS_WEAKREFD, S_SET_WEAKREFD, S_CLEAR_WEAKREFD): Declare.
* write.c (adust_reloc_syms): Follow weakref link. Do not
complain if target is undefined.
(write_object_file): Likewise. Remove weakrefr symbols. Drop
unreferenced weakrefd symbols.
* config/obj-coff.c (obj_frob_symbol): Do not force WEAKREFD
symbols EXTERNAL.
(pecoff_obj_set_weak_hook, pecoff_obj_clear_weak_hook): New.
* config/obj-coff.h (obj_set_weak_hook, obj_clear_weak_hook): Define.
* doc/as.texinfo: Document weakref.
* doc/internals.texi: Document new struct members, internal
functions and hooks.
gas/testsuite/ChangeLog:
* gas/all/weakref1.s, gas/all/weakref1.d: New test.
* gas/all/weakref1g.d, gas/all/weakref1l.d: New tests.
* gas/all/weakref1u.d, gas/all/weakref1w.d: New tests.
* gas/all/weakref2.s, gas/all/weakref3.s: New tests.
* gas/all/gas.exp: Run new tests.
2005-10-25 01:51:42 +08:00
|
|
|
extern void s_weakref (int);
|
2017-01-12 22:56:13 +08:00
|
|
|
extern void temp_ilp (char *);
|
|
|
|
extern void restore_ilp (void);
|