Commit Graph

34 Commits

Author SHA1 Message Date
Vladimir Makarov
ff0f011267 * expr.c (operand): Check more correctly that there is no advance
in operand after atof_generic in order to decide "is it label 0f
	or floating point number?".
1998-08-20 18:28:07 +00:00
Vladimir Makarov
bb89d84ac7 * expr.c (operand): Check correctly that there is no advance in
operand after atof_generic in order to decide "is it label 0f or
	floating point number".
PR16670
1998-08-20 16:10:35 +00:00
Ian Lance Taylor
4d315b8660 * expr.c (op_encoding): Make const.
(expr_set_precedence): New function.
	(expr_begin): Don't set operator rankings, just call
	expr_set_precedence.
	* expr.h (expr_set_precedence): Declare.
	* read.c (s_mri): Call expr_set_precedence.
1998-07-03 19:55:44 +00:00
Ian Lance Taylor
c246596af7 Fix gcc -Wall warnings. See ChangeLog for details. 1998-03-29 03:45:46 +00:00
Doug Evans
e5d62150f3 * expr.h (expr_build_uconstant): Add prototype.
(expr_build_unary,expr_build_binary): Add prototypes.
	* expr.c (expr_build_uconstant): New function.
	(expr_build_unary,expr_build_binary): New functions.
1998-03-25 22:03:19 +00:00
Jeff Law
b463948b73 * expr.c (integer_constant 32bit bignum): Mask off bits outside
the range we care about.
1997-12-17 20:19:26 +00:00
Ian Lance Taylor
30d0557caa * expr.c (operand): Simplify 0b handling. Don't treat 0b as a
binary number if the next character is '+' or '-'.
1997-02-27 05:28:17 +00:00
Ian Lance Taylor
52e1cf9d01 * subsegs.c (subseg_set): Permit SEG_ABSOLUTE in know expression.
* expr.c (expr): Account for new operatorT values in know
	expression.

	* write.c (fixup_segment): Clear fixp->fx_subsy if the relocation
	is fully resolved.
1995-09-21 20:42:11 +00:00
Ian Lance Taylor
3dce804d95 * expr.c (operand): Handle 08 and 09 in MRI mode.
* macro.c (ISSEP): Remove duplicated `"' character.
 	(get_any_string): Copy some characters for which ISSEP is true:
	';', '>', '(', ')'.  Otherwise we can get in an infinite loop.
	* read.c (s_space): In MRI mode, the expressions stop at the first
	unquoted space.
	(cons_worker): In MRI mode, restore the terminating character at
	the end of the function.
1995-09-07 21:54:13 +00:00
Ian Lance Taylor
219deb70ce Initial support for MRI style labels and expressions.
* as.h (flag_mri): Declare/define.
	* as.c (show_usage): Mention -M and its synonym --mri.
	(parse_args): Add 'M' to std_shortopts.  Add "mri" to
	std_longopts.  Set flag_mri if -M is seen.
	(main): Call parse_args before input_scrub_begin.  Call
	expr_begin.
	* app.c (do_scrub_begin): Don't set lex for '"' or '\'' in MRI
	mode.  Do set lex for ';', '*', and '!' in MRI mode.
	(do_scrub_next_char): Remove MRI ifdef in LEX_IS_WHITESPACE case.
	In MRI mode, keep spaces between labels and colons.  Remove MRI
	ifndef around LEX_IS_ONECHAR_QUOTE case.  In MRI mode, don't use
	'!' or '*' as comment characters even if they are in
	comment_chars.
	* read.h (lex_type): No longer const.
	* read.c: Include libiberty.h.
	(lex_type): No longer const.
	(read_begin): In MRI mode, set lex_type of '?' to 3.
	(potable): Add dc, dc.b, dc.d, dc.l, dc.s, dc.w, dc.x, ds, ds.b,
	ds.l, ds.w, and xdef.
	(read_a_source_file): Change LABELS_WITHOUT_COLON ifdef to check
	for MRI mode at runtime rather than compile time.  Handle the EQU
	pseudo-op in MRI mode.  Remove bogus MRI ifdef around done_pseudo.
	Change NO_PSEUDO_DOT ifdef to also take effect for MRI mode at
	runtime.
	(cons): In MRI mode, always call parse_mri_cons rather than
	TC_PARSE_CONS_EXPRESSION.
	(parse_mri_cons): Always compile, not just when MRI is defined.
	Call TC_PARSE_CONS_EXPRESSION, not expression, when the input is
	not a string constant.  Handle A and E modifiers.
	(float_cons): Accept :xxxx, where the x's are hex digits.
	* expr.h (operatorT): Add O_eq, O_ne, O_lt, O_le, O_ge, O_gt.
	(expr_begin): Declare.
	* expr.c (integer_constant): In MRI mode, if the base was not
	specified, look for a suffix on the number to set the base.
	(mri_char_constant): New static function.
	(operand): Remove MRI ifdef.  In MRI mode, do various things: Pass
	0 as the base when calling integer_constant if there was no
	prefix.  Check for a hex constant suffix if when a leading '0' is
	seen.  Don't accept 0x or 0b as a prefix.  Check for E'chars' and
	A'chars'.  Handle MRI character constants.  Treat '"' as the
	unary bitwise not operator.  Treat $ as the program counter, or as
	the prefix for a hex constant.  Treat % as the prefix for a binary
	constant and @ as the prefix for an octal constant.  Treat : as
	the prefix for a hex constant.
	(op_encoding): Set '"' to O_bit_not, '<' to O_lt, and '>' to O_gt.
	(op_rank): No longer const.  Change rank values.
	(expr_begin): New function.
	(operator): New static function.
	(expr): Use operator.  Don't bother to mention the operator in
	warnings.  Remove bogus #if 0 code.  Handle new operatorT values.
	* atof-generic.c (atof_generic): In MRI mode, accept underscores
	around the exponent in floating point numbers.
	* symbols.h (symbols_case_sensitive): Declare.
	* symbols.c (symbols_case_sensitive): New global variable.
	(symbol_create): Check symbols_case_sensitive.
	(symbol_find_base): Likewise.
	(resolve_symbol_value): Handle new operatorT values.
	(print_expr_1): Likewise.
	(S_IS_LOCAL): In MRI mode, names beginning with two '?' characters
	are local.
1995-08-01 22:01:01 +00:00
Ken Raeburn
3a762a0bfd Use new hex-value code in libiberty:
* Makefile.in (VMS_OTHER_OBJS): Add ../libiberty/hex.o.
(OBJS): Delete hex-value.o.
(REAL_SOURCES): Delete hex-value.c.
(hex-value.o): Delete dependencies.
* hex-value.c: Deleted.
* as.c (main): Call hex_init.
* expr.c, config/tc-mips.c: Include libiberty.h.  Replace hex_value array
references with hex_* macros.
1995-01-12 23:00:26 +00:00
Jeff Law
fcacfef6ae * expr.c (expr): Don't reduce the difference of two symbols in the
same frag if the symbols are not in normal sections.
1994-09-14 03:53:14 +00:00
Ken Raeburn
d90f530be0 * expr.c (make_expr_symbol): If operator is O_symbol and X_add_number is zero,
just return the symbol.  If operator is O_constant, resolve the symbol's value
before returning.
(operand): Permit use of "[]" for grouping.
(clean_up_expression): For difference of two symbols in the same frag, add the
difference of their offsets into X_add_number.
(expr): Reduce difference of two symbols in same frag to their difference.
1994-09-13 02:10:43 +00:00
Ken Raeburn
351878df5a whitespace/formatting changes 1994-01-28 00:58:00 +00:00
Ken Raeburn
7691379e7f * expr.c (operand): For floating point operand with unusual fp char from
FLT_CHARS, preserve the character.  Patch from Lisa Repka.
1994-01-20 18:26:17 +00:00
Jeff Law
009dc5e1e5 * struc-symbol.h: Add new "sy_used" field to the symbol structure.
* expr.c (operand): Set sy_used for any symbol used as an operand.
	(expr): Likewise for any symbol used in an expression.
	* config/tc-hppa.h (tc_frob_symbol): Define.  Punt imported
	symbols which are never used and absolute symbols which local scope.
1993-11-02 06:10:52 +00:00
Jeff Law
d4c8cbd8ef * expr.c (make_expr_symbol): Delete DOT_LABEL_PREFIX code
and instead simply use the string defined by FAKE_LABEL_NAME.
        (operand): Likewise.
        * read.c (s_stab_generic): Likewise.
1993-10-31 02:13:34 +00:00
Ian Lance Taylor
58d4951d00 gcc lint. See ChangeLog for details. Also:
* config/obj-elf.h (S_SET_SIZE): Actually set the size.
1993-09-10 16:01:07 +00:00
Ian Lance Taylor
5ac34ac37e * Extensive changes to permit symbols to contain any expression
type and to delay the computation of the expression until the
	value is actually needed.  This permits setting symbols to values
	calculated based on object code size.  Expressions were changed to
	no longer be in a section, to stop the overloading of segment and
	expression type that previously occurred.

	* as.c (big_section, pass1_section, diff_section, absent_section):
	Removed.
	(expr_section): Added (used for dummy symbols which hold
	intermediate expression values).
	(perform_an_assembly_pass): Create expr_section, do not create the
	sections now removed.
	* as.h (segT): Removed SEG_ABSENT, SEG_PASS1, SEG_BIG, and
	SEG_DIFFERENCE.  Added SEG_EXPR.
	(SEG_NORMAL): Corresponding changes.
	* subsegs.c (seg_name, subsegs_begin): Changed accordingly.
	* write.c (write_object_file): Ditto.
	* config/obj-aout.c (seg_N_TYPE): Ditto.
	* config/obj-bout.c (seg_N_TYPE): Ditto.
	* config/obj-coff.c (seg_N_TYPE): Ditto.
	* config/obj-coffbfd.c (seg_N_TYPE): Ditto.
	* config/obj-vms.c (seg_N_TYPE): Ditto.

	* expr.h (operatorT): Moved in from expr.c, added some values.
	(expressionS): Added X_op field, removed X_seg field; renamed
	X_subtract_symbol to X_op_symbol.
	* expr.c: Extensive changes to assign expression types rather than
	sections and to simplify the parsing.
	* write.c (fix_new_internal): New static function.
	(fix_new): Removed sub_symbol argument.
	(fix_new_exp): New function, takes expression argument.
	* write.h: Prototype changes for fix_new and fix_new_exp.
	* cond.c (s_if): Changed accordingly.
	* read.c (s_lsym, pseudo_set, emit_expr, parse_bitfield_cons,
	parse_repeat_cons, get_segmented_expression,
	get_known_segmented_expression, get_absolute_expression): Ditto.
	* symbols.c (resolve_symbol_value, S_GET_VALUE, S_SET_VALUE):
	Ditto.
	* write.c (write_object_file): Ditto.
	* config/obj-coff.c (obj_coff_def, obj_coff_val): Ditto.
	* config/obj-coffbfd.c (obj_coff_def, obj_coff_val,
	obj_coff_endef, yank_symbols): Ditto.
	* config/obj-elf.c (obj_elf_stab_generic, obj_elf_size): Ditto.
	* config/tc-a29k.c (md_assemble, parse_operand, machine_ip,
	print_insn, md_operand): Ditto.
	* config/tc-h8300.c (parse_exp, colonmod24, check_operand,
	do_a_fix_imm, build_bytes): Ditto.
	* config/tc-h8500.c (parse_exp, skip_colonthing, parse_reglist,
	get_specific, check, insert, md_convert_frag): Ditto.
	* config/tc-hppa.c (the_insn, fix_new_hppa, cons_fix_new_hppa,
	md_assemble, pa_ip, getExpression, getAbsoluteExpression,
	evaluateAbsolute, pa_build_unwind_subspace, pa_entry,
	process_exit): Ditto.
	* config/tc-hppa.h (STAB_FIXUP, is_DP_relative, is_PC_relative,
	is_complex): Ditto.
	* config/tc-i386.c (pe, md_assemble, i386_operand,
	md_estimate_size_before_relax, md_create_long_jump): Ditto.
	* config/tc-i860.c (md_assemble, getExpression, print_insn):
	Ditto.
	* config/tc-i960.c (parse_expr, subs, segs, md_convert_frag,
	get_cdisp, mem_fmt, parse_ldconst, relax_cobr, s_sysproc,
	i960_handle_align): Ditto.
	* config/tc-m68k.c (struct m68k_exp, struct m68k_it, seg, op,
	subs, add_fix, isvar, m68k_ip, md_assemble, md_convert_frag_1,
	md_estimate_size_before_relax, md_create_long_jump, get_num):
	Ditto.
	* config/tc-m88k.c (md_assemble, get_imm16, get_pcr,
	md_create_short_jump, md_create_long_jump): Ditto.
	* config/tc-mips.c (md_assemble, append_insn, gp_reference,
	macro_build, macro, my_getExpression): Ditto.  Also removed
	get_optional_absolute_expression; just use get_absolute_expression
	instead.
	* config/tc-ns32k.c (get_addr_mode, evaluate_expr, convert_iif,
	fix_new_ns32k, fix_new_ns32k_exp, cons_fix_new_ns32k): Ditto.
	* config/tc-ns32k.h (fix_new_ns32k prototype): Ditto.
	* config/tc-sh.c (parse_exp, check, insert, md_convert_frag):
	Ditto.
	* config/tc-sparc.c (md_assemble, sparc_ip, getExpression,
	print_insn): Ditto.
	* config/tc-tahoe.c (struct top, md_estimate_size_before_relax,
	tip_op, md_assemble): Ditto.
	* config/tc-vax.c (seg_of_operand, md_assemble,
	md_estimate_size_before_relax, md_create_long_jump): Ditto.
	* config/tc-z8k.c (parse_exp, check_operand, newfix): Ditto.
1993-07-21 00:41:42 +00:00
Ian Lance Taylor
ffffc8fb5c * expr.c (clean_up_expression): Don't cancel the subtraction of
undefined symbols.

Fixes PR 2997.

	* read.c (s_data), config/obj-coffbfd.c (obj_coff_data): If -R,
	switch to text section rather than data section.

Fixes PR 2971.
1993-07-19 18:46:39 +00:00
Ken Raeburn
dae92eaba0 (integer_constant, floating_constant): Now return void. 1993-07-07 12:35:48 +00:00
Ken Raeburn
49864cfa6c read.c (s_align_bytes): Properly record alignment.
expr.c (__): Undefine before defining.
as.c (got_sig): Don't return anything; return type might be void.
Whitespace/comment cleanup in frags.c.
Some patches for `-pedantic' or `-fno-common' compilation.
(Some of these changes are from Michael Meissner; see change log.)
1993-05-27 19:42:23 +00:00
Ian Lance Taylor
f2f7d044cd * expr.c, write.c: Ultrix native 4.2 cc requires assert condition
to be on a single line.
1993-03-12 20:01:28 +00:00
Ken Raeburn
0bd77bc4fc expr.c (operand): handle logical end-of-line characters line newline 1993-01-05 14:17:21 +00:00
Ken Raeburn
d841bc4954 comment reformatting 1993-01-04 13:12:27 +00:00
Ian Lance Taylor
85825401dc Wed Dec 30 10:18:57 1992 Ian Lance Taylor (ian@cygnus.com)
* app.c, config/tc-*.c: Don't include read.h, since it is already
	included by as.h.

	* These are based on patches from Minh Tran-le
	<mtranle@paris.intellicorp.com>.
	* configure.in (i[34]86-ibm-aix*): Accept i486 for host.  Use
	obj_format coffbfd and gas_target i386coff for target.
	(i[34]86-*-isc*): New host (uses sysv).
	* config/i386aix.mt: Removed (no longer used).
	* config/mh-i386aix (RANLIB): Use true rather than /bin/true.
	(MINUS_G): Removed.
	(LDFLAGS): Added, defined as -shlib.
	* config/te-i386aix.h (REVERSE_SORT_RELOCS): Undefine.
	* config/te-sco386.h (LOCAL_LABEL): Don't define.
	(DOT_LABEL_PREFIX): Define.
	* expr.c (operand): If DOT_LABEL_PREFIX, use .L0\001 as a label
	name rather than L0\001.
	* read.c (s_lcomm): Make a frag in SEG_BSS rather than using
	local_bss_counter.
	* symbols.c, symbols.h (local_bss_counter): Removed.
	* write.c (write_object_file): bss no longer uses
	local_bss_counter.  Pass correct data and bss size to
	VMS_write_object_file.
	* config/obj-vms.c (VMS_write_object_file): Accept bss size as
	argument, rather than using local_bss_counter.
	* config/tc-m88k.c (s_bss): Don't use local_bss_counter.
	* config/tc-sparc.c (s_reserve): Don't use local_bss_counter.
	* config/obj-coffbfd.c (had_lineno, had_reloc): Removed.
	(size_section): Restored sanity check.
	(do_relocs_for): Base section address on s_paddr rather than
	computing it.  Adjust a29k R_IHIHALF special case to account for
	section paddr (used to require paddr to be zero).  If there are no
	reclos, set s_relptr to 0.  Set relocation size in object_headers.
	(fill_section): Always set s_vaddr here, removing
	ZERO_BASED_SEGMENTS case.  Force s_scnptr for bss to 0.  Don't set
	NOLOAD for i386 .bss, because it confuses the SVR3 native linker.
	Set STYP_INFO for .comment.
	(coff_header_append): Use object headers and H_{SET,GET}_* macros.
	Make aouthdr writing depend on OBJ_COFF_OMIT_OPTIONAL_HEADER.
	(crawl_symbols): Handle 8 character section name correctly.  Use
	H_{SET,GET}_* macros.
	(do_linenos_for): Set lineno size in object_headers.
	(write_object_file): Use H_{SET,GET}_* macros.  Don't bother to
	set s_vaddr here.  If string_byte_count remains 4, set it back to
	0, and only write strings out if there are some.  Call
	fill_section before do_relocs_for and do_linenos_for.
	(obj_coff_section): Handle optional quoted second argument giving
	section characteristics.
	(obj_coff_bss): Added to handle .bss.
	(obj_coff_ident): Added to handle .ident (puts string in .comment
	section).
	(obj_coff_lcomm): Put common symbols in .bss, not .data.
	(fixup_mdeps): Change to segment.  Call frag_wane after
	md_convert_frag.
	(fixup_segment): Explicitly check S_IS_COMMON before making 386
	adjustment (already happened only for common symbols, but this is
	clearer).
	* config/obj-coffbfd.h (OBJ_COFF_OMIT_OPTIONAL_HEADER): Define.
	* config/tc-i386.c (s_bss): Don't use if I386COFF.
	(md_pseudo_table): Ignore .optim and .noopt.
	(tc_coff_sizemachdep): New function.
	* config/tc-i386.h (REVERSE_SORT_RELOCS): Undef, for SVR3
	compatibility.
	(LOCAL_LABEL): Removed definition.
	(DOT_LABEL_PREFIX): Defined.
1992-12-30 20:34:14 +00:00
Ken Raeburn
2ed83a5973 handle local label number zero -- 0f, 0b, 0$ -- correctly 1992-12-28 18:37:21 +00:00
Steve Chamberlain
f8701a3ff8 Thu Jun 4 11:59:13 1992 Steve Chamberlain (sac@thepub.cygnus.com)
* expr.c(expr): allow SEG_REGISTER in expressions.
	* read.c(pseudo_set): register expressions can be the source of a
	set.
	* subsegs.c (subseg_new): Now -R forces all changes to SEG_DATA to
	goto SEG_TEXT (if a.out)
	* write.c (write_object_file): If a.out don't use the old way for
	-R.
	* config/obj-a.out (s_sect): complain if the user tries to use a
	subsegment with a value which might interfere with out -R hackery.
	* config/tc-m68k.c (m68k_reg_parse): lookup names in symbol table
	rather than use ugly if tree. (init_regtable): insert register
	names into symbol table.
1992-06-04 19:21:58 +00:00
Steve Chamberlain
14d3e47bfa * expr.c: If an expression is single comma, then return with
SEG_ABSENT rather than an error - since the sparc front end does
	really strange things with things like fbge,a
1992-02-26 06:11:47 +00:00
Steve Chamberlain
f24f757780 * as.h: include bfd.h if using many sections
* expr.c: LOCAL_LABELS_FB had been changed to lower case - so
	local labels didn't work.
	* listing.c (list_symbol_table): don't core dump when there's no
	symbol there.
	* write.c, write.h: call fix_new with the right number of args on
	the H8.
	* config/tc-h8300.[ch] : fix bugs reported by HMSI, and make
	errors nicer
1992-02-25 22:27:44 +00:00
Steve Chamberlain
c593cf412b * app.c: MRI compatibility - allow single quote to start a string.
* as.c: fix typo recently introduced.
	* as.h : Don't include aout/reloc.h - it's not right for COFF!
	* expr.c: Much rewriting, to accomodate MRI syntax for
	expressions. Also easier to read now.
	* listing.c: Put back defuns
	* read.c: modified to accept MRI syntax, put back listing pseudo
	ops so that an assembler built with NO_LISTING ignores list ops
	rather than pukes.
	* write.c, write.h: fixs - only keep a reloc type in a fix if the target
	machine is a SPARC or a 29K.
	* config/obj-aout.c: added s_sect pseudo op
	* config/obj-coffbfd.c: lints, set the filehdr flags right and
	fill in the timestamp.
	* config/obj-coffbfd.h: Since we don't include aout/reloc.h
	anymore, define all the relocs which the tc-<x> bit will use so we
	can translate from them to the coff types.
	* config/tc-a29k.c: reloc_type isn't ane enum any more
	* config/tc-m68k.c: Added NO_RELOC definition.

Now compiles for sparc aout, 68k aout (MRI and MIT syntax),
29k coff.

So far works as replacement for sparc and 68k /bin/as.
1992-02-22 20:45:24 +00:00
K. Richard Pixley
8b228fe958 force all files to end in "/* end of filename" 1992-02-13 09:13:54 +00:00
K. Richard Pixley
a39116f1c9 White space and comments only. The devo tree prior to this delta is
tagged as "vanilla" for your convenience.

There are also some comment changes.
1992-02-13 08:33:54 +00:00
K. Richard Pixley
fecd2382e7 Initial revision 1991-04-04 18:19:53 +00:00