Commit Graph

94 Commits

Author SHA1 Message Date
Julian Brown 4455e9aded gas/
* expr.c (add_to_result, subtract_from_result): Make global.
    * expr.h (add_to_result, subtract_from_result): Add prototypes.
    * config/tc-sh.c (sh_optimize_expr): Use add_to_result,
    subtract_from_result to handle extra bit of precision for .sleb128
    directive operands.

    gas/testsuite/
    * gas/all/gas.exp (sleb128-7): Don't run for tic4x, tic54x.
    * gas/all/sleb128-2.s: Reformat, use _ at start of labels, remove
    cruft.
    * gas/all/sleb128-3.s: Likewise.
    * gas/all/sleb128-4.s: Likewise.
    * gas/all/sleb128-5.s: Likewise.
    * gas/all/sleb128-7.s: Likewise.
    * gas/all/sleb128-2.d: Handle data sections named $DATA$.
    * gas/all/sleb128-3.d: Likewise.
    * gas/all/sleb128-4.d: Likewise.
    * gas/all/sleb128-5.d: Likewise.
    * gas/all/sleb128-7.d: Likewise.
2013-04-15 10:30:23 +00:00
Julian Brown 956a6ba3fe gas/
* read.c (convert_to_bignum): Add sign parameter. Use it
    instead of X_unsigned to determine sign of resulting bignum.
    (emit_expr): Pass extra argument to convert_to_bignum.
    (emit_leb128_expr): Use X_extrabit instead of X_unsigned. Pass
    X_extrabit to convert_to_bignum.
    (parse_bitfield_cons): Set X_extrabit.
    * expr.c (make_expr_symbol, expr_build_uconstant, operand):
    Initialise X_extrabit field as appropriate.
    (add_to_result): New.
    (subtract_from_result): New.
    (expr): Use above.
    * expr.h (expressionS): Add X_extrabit field.

    gas/testsuite/
    * gas/all/sleb128-2.s: New test.
    * gas/all/sleb128-3.s: Likewise.
    * gas/all/sleb128-4.s: Likewise.
    * gas/all/sleb128-5.s: Likewise.
    * gas/all/sleb128-7.s: Likewise.
    * gas/all/sleb128-2.d: New.
    * gas/all/sleb128-3.d: New.
    * gas/all/sleb123-4.d: New.
    * gas/all/sleb123-5.d: New.
    * gas/all/sleb123-7.d: New.
    * gas/all/gas.exp (sleb128-2, sleb128-3, sleb128-4, sleb128-5)
    (sleb128-7): Run new tests.
2013-04-11 10:54:13 +00:00
Chung-Lin Tang 8e723a1045 2013-03-08 Chung-Lin Tang <cltang@codesourcery.com>
* write.h (struct fix): Add fx_dot_frag field.
	(dot_frag): Declare.
	* write.c (dot_frag): New variable.
	(fix_new_internal): Set fx_dot_frag field with dot_frag.
	(fixup_segment): Base calculation of fx_offset with fx_dot_frag.
	* expr.c (expr): Save value of frag_now in dot_frag when setting
	dot_value.
	* read.c (emit_expr): Likewise. Delete comments.
2013-03-08 10:17:00 +00:00
Alan Modra 08ea70204d * frags.h (frag_offset_fixed_p): Update prototype.
* frags.c (frag_offset_fixed_p): Change type of "offset" to offsetT.
	* expr.c (expr, resolve_expression): Likewise for frag_off var.
2012-06-30 00:27:31 +00:00
Alan Modra 259af69e77 PR 12569
* expr.c (operand): Correct passing of "mode" to expr.
	* read.c (do_org): Allow expr_section.
	(get_known_segmented_expression): Don't assert anything about the
	segment.
2011-03-17 10:59:29 +00:00
Maciej W. Rozycki e66a3432ef PR gas/12282
* expr.c (expr_build_dot): Make a clone of the symbol to return if
	needed.
2010-12-04 00:19:19 +00:00
Richard Sandiford c969da6473 gas/
* symbols.c (S_FORCE_RELOC): Return true for indirect functions
	even if !strict.
	* expr.c (operand): Don't convert absolute symbols to constants
	if S_FORCE_RELOC is true.
	(expr): Only reduce subtractions between different symbols if
	S_FORCE_RELOC is false for both of them.
	* write.c (fixup_segment): Don't remove symbols if S_FORCE_RELOC
	is true for them, regardless of their segment.

gas/testsuite/
	* gas/i386/ifunc-2.s, gas/i386/ifunc-2.l: New test.
	* gas/i386/ifunc-3.s, gas/i386/ifunc-3.d: Likeise.
	* gas/i386/i386.exp: Run them.
2010-12-02 13:25:13 +00:00
Maciej W. Rozycki 4a826962e7 * symbols.h (dot_symbol): New declaration.
(dot_symbol_init): New prototype.
	* symbols.c (dot_symbol): New variable.
	(symbol_clone): Assert it's not dot_symbol being cloned.
	(dot_symbol_init): New function.
	(symbol_clone_if_forward_ref): Create a new temporary symbol
	when trying to clone dot_symbol.
	* expr.c (current_location): Refer to dot_symbol instead of
	making a new temporary symbol.
	* read.c (read_a_source_file): Update dot_symbol as we go.
	* as.c (main): Call dot_symbol_init.
2010-12-01 21:34:10 +00:00
Maciej W. Rozycki 3df4e177c9 * symbols.c (symbol_clone_if_forward_ref): Don't limit cloning
to expr_section symbols; clone all equated symbols.  Clear
	sy_resolving of the cloned copy.
	* expr.c (operand): Only clone equated symbols on a final
	(i.e. non-equated) reference.
2010-12-01 20:35:13 +00:00
Alan Modra 1e0f6894c8 * expr.c (expr): Correct returned segment value. 2010-09-29 06:48:30 +00:00
Alan Modra 93d90f466b PR gas/11867
* expr.c (operand <'-' and '~'>): Widen bignums.
	(operand <'!'>): Correct bignum result and convert to O_constant.
	* read.c (emit_expr): Don't assert on .byte bignum.  Don't display
	bignum truncated warning for sign extended bignums.
2010-08-02 13:19:44 +00:00
Jan Beulich b7adb16d69 gas/
2010-06-22  Jan Beulich  <jbeulich@novell.com>

	PR gas/11732
	* config/tc-i386-intel.c (i386_intel_parse_name): Handle pseudo
	symbols named "$".
	(i386_intel_operand): Remove bogus handling of pseudo symbols
	named "$".
	* expr.c (current_location): Remove 'static' and local
	declaration.
	* expr.h (current_location): Declare.

gas/testsuite/
2010-06-22  Jan Beulich  <jbeulich@novell.com>

	PR gas/11732
	* gas/i386/jump.d: Adjust.
	* gas/i386/jump.s: Add check for branch to 2+$.
2010-06-22 07:43:41 +00:00
H.J. Lu 34a7d6c6d3 Initialize the X_md field.
2010-04-21  H.J. Lu  <hongjiu.lu@intel.com>

	* expr.c (expr): Initialize the X_md field.
2010-04-21 17:10:44 +00:00
Nick Clifton 91d6fa6a03 Add -Wshadow to the gcc command line options used when compiling the binutils.
Fix up all warnings generated by the addition of this switch.
2009-12-11 13:42:17 +00:00
H.J. Lu 087d837e04 Call symbol_same_p to check to if 2 symbols are the same.
gas/

2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>

	PR gas/11037
	* expr.c (resolve_expression): Call symbol_same_p to check
	if 2 symbols are the same.

	* symbols.c (symbol_same_p): New.
	* symbols.h (symbol_same_p): Likewise.

gas/testsuite/

2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>

	PR gas/11037
	* gas/i386/intelpic.s: Add testcases.
	* gas/i386/intelpic.d: Updated.
2009-12-08 03:14:29 +00:00
Alan Modra 14610ad10e PR gas/10856
* expr.c (resolve_expression): Only add "left" value to O_symbol
	expression when the symbol is undefined and different from the
	original symbol.  Simplify negative logic.

	* gas/i386/intelpic.d: Correct.
2009-10-28 08:21:45 +00:00
Nick Clifton 1e9cc1c27b * po/bfd.pot: Updated by the Translation project.
* po/binutils.pot: Updated by the Translation project.
        * po/gold.pot: Updated by the Translation project.
        * po/gold.pot: Updated by the Translation project.
        * po/gprof.pot: Updated by the Translation project.
        * po/sv.po: Updated Swedish translation.
        * po/ld.pot: Updated by the Translation project.
        * po/fi.po: Updated Finnish translation.
        * po/ld.pot: Updated by the Translation project.
        * po/fi.po: Updated Finnish translation.

        Updated sources to compile cleanly with -Wc++-compat:
        * basic_blocks.c: Add casts.
        * cg_dfn.c: Add cast.
        * corefile.c: Add casts.
        * gmon_io.c: Add casts.
        * hist.c: Add cast.
        * source.c: Add cast.
        * sym_ids.c (struct match): Moved to top level.

        Updated soruces in ld/* to compile cleanly with -Wc++-compat:
        * ld.h (enum endian_enum,enum symbolic_enum,enum dynamic_list_enum): Move to top level.
        * ldcref.c: Add casts.
        * ldctor.c: Add casts.
        * ldexp.c
        * ldexp.h (enum node_tree_enum,enum phase_enum): Move to top level.
        * ldlang.c: Add casts. (lang_insert_orphan): Use enum name instead of integer.
        * ldlang.h (enum statement_enum): Move to top level.
        * ldmain.c: Add casts.
        * ldwrite.c: Add casts.
        * lexsup.c: Add casts. (enum control_enum): Move to top level.
        * mri.c: Add casts. (mri_draw_tree): Use enum name instead of integer.

        Updated sources to compile cleanly with -Wc++-compat:
        * basic_blocks.c: Add casts.
        * cg_dfn.c: Add cast.
        * corefile.c: Add casts.
        * gmon_io.c: Add casts.
        * hist.c: Add cast.
        * source.c: Add cast.
        * sym_ids.c (struct match): Moved to top level.

        * as.c (main): Call dwarf2_init.
        * config/obj-elf.c (struct group_list): New field.
        (build_group_lists): Use hash lookup.
        (free_section_idx): New function.
        (elf_frob_file): Adjust.
        * dwarf2dbg.c (all_segs_hash, last_seg_ptr): New variables.
        (get_line_subseg): Adjust.
        (dwarf2_init): New function.
        * dwarf2dbg.h (dwarf2_init): New declaration.
2009-09-11 15:27:38 +00:00
Alan Modra aa820537ea update copyright dates 2009-09-02 07:25:43 +00:00
Jan Beulich 1035ad423e gas/
2009-07-28  Jan Beulich  <jbeulich@novell.com>

	* expr.c (op_rank): Specify size. Remove O_md* initializers.
2009-07-28 06:20:49 +00:00
Nick Clifton 9c2799c243 * gas/app, gas/as.c, gas/as.h, gas/atof-generic.c, gas/cgen.c,
gas/config/atof-ieee.c, gas/config/obj-aout.c,
        gas/config/obj-coff.c, gas/config/obj-ecoff.c,
        gas/config/obj-elf.c, gas/config/obj-som.c, gas/config/tc-alpha.c,
        gas/config/tc-arc.c, gas/config/tc-arm.c, gas/config/tc-cr16.c,
        gas/config/tc-cris.c, gas/config/tc-crx.c, gas/config/tc-d30v.c,
        gas/config/tc-dlx.c, gas/config/tc-hppa.c, gas/config/tc-i370.c,
        gas/config/tc-i386-intel.c, gas/config/tc-i386.c,
        gas/config/tc-i860.c, gas/config/tc-i960.c, gas/config/tc-ia64.c,
        gas/config/tc-iq2000.c, gas/config/tc-m32c.c,
        gas/config/tc-m32r.c, gas/config/tc-m68hc11.c,
        gas/config/tc-m68k.c, gas/config/tc-maxq.c, gas/config/tc-mcore.c,
        gas/config/tc-mep.c, gas/config/tc-mips.c, gas/config/tc-mmix.c,
        gas/config/tc-mn10300.c, gas/config/tc-moxie.c,
        gas/config/tc-ns32k.c, gas/config/tc-pj.c, gas/config/tc-ppc.c,
        gas/config/tc-s390.c, gas/config/tc-score.c,
        gas/config/tc-score7.c, gas/config/tc-sh.c, gas/config/tc-sparc.c,
        gas/config/tc-spu.c, gas/config/tc-tic30.c, gas/config/tc-vax.c,
        gas/config/tc-xtensa.c, gas/config/xtensa-relax.c,
        gas/dw2gencfi.c, gas/dwarf2dbg.c, gas/ehopt.c, gas/expr.c,
        gas/frags.c, gas/input-file.c, gas/read.c, gas/sb.c,
        gas/subsegs.c, gas/symbols.c, gas/write.c: Change the name of the
        gas macro `assert' to `gas_assert'.
2009-06-22 17:56:02 +00:00
Jan Beulich fcaed75e52 gas/
2009-04-20  Jan Beulich  <jbeulich@novell.com>

	* expr.c (operand): Call md_need_index_operator() and
	md_operator() if defined. Add unary label.
	(operator): Call md_operator() if defined.
	(expr): Adjust assertions on range and rank of op_left and
	op_right. Don't abort on unhandled operators when reducing
	expressions with both operands being constant.
	(expr_set_rank): New.
	* expr.h (expr_set_rank): Declare.
2009-04-20 06:26:23 +00:00
Jan Beulich d85733c8e2 gas/
2009-04-16  Jan Beulich  <jbeulich@novell.com>

	* expr.c: Include limits.h if available, and #define CHAR_BITS
	otherwise.
	(expr): Check range of shift count when evaluating a constant
	expression.
2009-04-16 08:52:27 +00:00
Nick Clifton bfff164249 Add MN10300 linker relaxation support for symbol differences 2007-10-19 17:31:31 +00:00
Jan Beulich 5a918ce730 gas/
2007-09-26  Jan Beulich  <jbeulich@novell.com>

	* config/tc-i386.h (md_register_arithmetic): Define.
	* config/tc-ia64.h (md_register_arithmetic): Likewise.
	* doc/internals.texi: Document md_register_arithmetic.
	* expr.c (make_expr_symbol): Force O_register expressions into
	reg_section.
	(expr): Provide default for md_register_arithmetic. Don't resolve
	adding/subtracting constants to/from registers if
	md_register_arithmetic is zero.
2007-09-26 08:34:24 +00:00
Nick Clifton ec2655a6a7 Switch to GPLv3 2007-07-03 11:01:12 +00:00
Alan Modra db55703487 gas/
* expr.c (expr): Assert on rankarg, not rank which can be unsigned.
	* read.c (read_a_source_file): Remove buffer_limit[-1] assertion.
	Don't skip over NUL char.
	(pseudo_set): Set X_op for registers to O_register.
	* symbols.c (symbol_clone): Remove assertion that sym is defined.
	(resolve_symbol_value): Resolve O_register symbols.
	* config/tc-i386.c (parse_real_register): Don't use i386_float_regtab.
	Instead find st(0) by hash lookup.
	* config/tc-ppc.c (ppc_macro): Warning fix.
opcodes/
	* i386-opc.c (i386_float_regtab, i386_float_regtab_size): Delete.
	Move contents to..
	(i386_regtab): ..here.
	* i386-opc.h (i386_float_regtab, i386_float_regtab_size): Delete.
2007-04-21 06:54:57 +00:00
Ben Elliston 7b3835172a * expr.c (expr): Replace O_add case in switch (op_left) explaining
why it can never occur.
2006-10-24 18:10:57 +00:00
Alan Modra ebd1c8757c remove some duplicate #include's. 2006-06-07 11:27:58 +00:00
Ben Elliston 8c9f705ebb * expr.c (operand): Remove `if (0 && ..)' statement and
subsequently unused target_op label.  Collapse `if (1 || ..)'
        statement.
        * app.c (do_scrub_chars): Remove unused case 0, as it is handled
        separately above the switch.
2006-05-09 04:54:32 +00:00
Alan Modra 9963077898 PR 997
* frags.c (frag_offset_fixed_p): New function.
	* frags.h (frag_offset_fixed_p): Declare.
	* expr.c (expr): Use frag_offset_fixed_p when simplifying subtraction.
	(resolve_expression): Likewise.
2006-04-04 08:04:57 +00:00
Jan Beulich 2e1e12b1f4 gas/
2005-12-22  Jan Beulich  <jbeulich@novell.com>

	* symbols.h (snapshot_symbol): First parameter is now pointer
	to pointer to symbolS.
	* symbols.c (snapshot_symbol): Likewise. Store resulting symbol
	there. Use symbol_equated_p.
	* expr.c (resolve_expression): Change first argument to
	snapshot_symbol. Track possibly changed add_symbol consistently
	across function. Resolve more special cases with known result.
	Also update final_val when replacing add_symbol.

gas/testsuite/
2005-12-22  Jan Beulich  <jbeulich@novell.com>

	* gas/all/cond.s: Also check .if works on equates to undefined
	when the expression value can be known without knowing the
	value of the symbol.
	* gas/all/cond.l: Adjust.
	* gas/i386/equ.s: Also check .if works on (equates to)
	registers when the expression value can be known without
	knowing the value of the register.
	* gas/i386/equ.e: Adjust.
2005-12-22 17:05:40 +00:00
Nick Clifton 4fa6945e82 * expr.c (operand <case '$'>): Use DOLLAR_AMBIGU rather than flag_mri_m68k
as condition for parsing the '$' as a prefix.
* as.h (DOLLAR_AMBIGU): Define if needed.
2005-11-08 15:48:26 +00:00
Alan Modra fb7ccfc159 * expr.c (op_encoding): Map '=' to O_SINGLE_EQ, if defined.
* config/tc-z80.h: Define O_SINGLE_EQ as O_eq.
2005-11-07 02:15:47 +00:00
Alan Modra fee9cbc776 * expr.c (integer_constant): Match only 'B' as binary suffix if
NUMBERS_WITH_SUFFIX and LOCAL_LABELS_FB.  Allow both 'b' and 'B'
        otherwise.
2005-11-06 23:04:10 +00:00
Nick Clifton 9497f5ac6b This adjusts equate handling by
- allowing true forward references (which will always assume the referenced
  symbols have at the point of use) through the new .eqv pseudo-op and the
  new == operator
- disallowing changing .equiv-generated equates (so that the protection this
  provides is both forward and backward)
- snapshotting equates when their value gets changed so that previous uses
  don't get affected by the new value.
- allowing expressions in places where absolute expressions (or register
  names) are needed which were not completely resolvable at the point of
  their definition but which are fully resolvable at the point of use

In addition it fixes PR/288.
2005-10-11 11:16:17 +00:00
Nick Clifton 723a84724a * expr.c (operator): Allow "!=" as a synonym for "<>".
* doc/as.texinfo (Infix Op): Mention "!=".
2005-10-10 15:32:44 +00:00
Nick Clifton 4b4da1607a Update the address and phone number of the FSF 2005-05-05 09:13:19 +00:00
Ben Elliston 87c245cccc * Makefile.am (GAS_CFILES): Remove bignum-copy.c.
(GENERIC_OBJS): Likewise, remove bignum-copy.o.
	(bignum-copy.o): Remove.
	* Makefile.in: Regenerate.
	* makefile.vms (OBJS): Remove bignum-copy.obj.
	* symbols.h (local_symbol_make): Remove declaration.
	(verify_symbol_chain_2): Likewise.
	* symbols.c (local_symbol_make): Make static.
	(max_indent_level): Likewise.
	(verify_symbol_chain_2): Remove.
	* macro.c (macro_hash): Make static.
	* messages.c (fprint_value): Remove.
	* read.h (get_absolute_expr): Remove.
	(emit_leb128_expr): Likewise.
	(do_s_func): Likewise.
	* read.c (do_s_func): Make static.
	(emit_leb128_expr): Likewise.
	(get_absolute_expr): Likewise.
	* as.h (as_howmuch): Remove declaration.
	(fprint_value): Likewise.
	* as.c (myname): Make static.
	* input-scrub.c (as_howmuch): Remove.
	(as_1_char): Likewise.
	* input-file.h (input_file_is_open): Remove.
	* input-file.c (input_file_is_open): Likewise.
	* expr.h (expr_build_unary): Remove declaration.
	(expr_build_binary): Likewise.
	* expr.c (expr_build_unary): Remove.
	(expr_build_binary): Likewise.
	* hash.h (hash_replace): Remove declaration.
	(hash_delete): Likewise.
	* hash.c (hash_replace): Remove.
	(hash_delete): Likewise.
	* bignum-copy.c (bignum_copy): Move from here ..
	* config/tc-vax.c (bignum_copy): .. to here.
	* bignum.h (LOG_TO_BASE_2_OF_10): Remove.
	(bignum_copy): Remove extern declaration.
	* sb.h (string_count): Remove extern declaration.
	(sb_build, sb_add_buffer, sb_print, sb_print_at): Likewise.
	(sb_name): Likewise.
	* sb.c (dsize): Replace preprocessor macro with static int.
	(string_count): Make static.
	(sb_build, sb_add_buffer, sb_print, sb_print_at): Likewise.
	(sb_name): Likewise.
	* config/obj-coff.c (dim_index): Make static.
	* config/tc-i386.c (GOT_symbol): Likewise.
	(output_invalid_buf): Likewise.
	* doc/internals.texi (Warning and error messages): Remove the
	prototype for fprint_value.
2005-04-29 00:22:29 +00:00
Jan Beulich 43c3ab55ac gas/
2005-03-15  Jan Beulich  <jbeulich@novell.com>

	* expr.c (operand): Merge handling of unary + into that for unary
	-, !, and ~.
2005-03-15 15:41:31 +00:00
Nick Clifton fbacee5b43 Remove redundant code enclosed by #ifdef RELAX_PAREN_GROUPING....#endif. 2005-03-03 17:22:12 +00:00
Alan Modra 9d0e75cb1b * expr.c (integer_constant): Remove TARGET_WORD_SIZE hack.
* config/tc-m68k.h (TARGET_WORD_SIZE): Delete.
2005-03-01 22:35:21 +00:00
Alan Modra c9dea48b1f * as.h (assert): Warning fix.
* expr.c (expr): Correct assertion.
	* read.c (s_comm_internal): Remove assertion.
	* write.c (relax_segment): Enable vma assertion only for BFD_ASSEMBLER.
	(fixup_segment): Remove assertion.
	* config/tc-dlx.c (machine_ip): Remove untrue assertions.
	(md_apply_fix3): Likewise.
	* config/tc-i370.c (md_begin): Correct assertion.
	(i370_macro): Warning fix for assertion.
2005-03-01 02:00:15 +00:00
Mark Mitchell b2221023d3 * expr.c (operand): Handle the "~", "-", and "!" operators applied
to bignums.

	* gas/arm/bignum1.s: New test.
	* gas/arm/arm.exp: Run it.
2004-08-11 02:11:58 +00:00
Alan Modra 1181c20ef4 * expr.c (operand, operator): Don't reject '++' and '--'. 2004-05-23 04:35:11 +00:00
Alan Modra f4c724fc32 * expr.c (operand): Correct checks for ++ and --. 2004-04-16 01:55:27 +00:00
Nathan Sidwell 3e4caed2b1 * expr.c (operand): Reject ++ and --.
(operator): Likewise.
2004-03-18 09:19:20 +00:00
Kazu Hirata dd625418be * ehopt.c: Convert to ISO-C.
* emul.h: Likewise.
	* expr.c: Likewise.
	* expr.h: Likewise.
	* flonum-copy.c: Likewise.
	* flonum-mult.c: Likewise.
	* flonum.h: Likewise.
	* frags.c: Likewise.
	* frags.h: Likewise.
2003-11-22 16:03:03 +00:00
Richard Henderson 756d1d0188 * expr.c (make_expr_symbol): Fold FAKE_LABEL_NAME use into the
symbol_create call.
        (current_location): Use symbol_temp_new_now.
        * stabs.c (s_stab_generic): Use symbol_temp_new.
        * symbols.c (temp_label_name): Remove.
        (symbol_temp_new, symbol_temp_make): Use FAKE_LABEL_NAME.
2003-05-27 19:19:29 +00:00
Alan Modra 0200099915 * expr.c (operand): Add support for n.nn flonums. 2002-10-18 01:56:39 +00:00
Alan Modra f6cf69d700 * expr.c (expr): Simplify foo-foo here.
(clean_up_expression): Remove O_subtract code.
2002-09-20 00:58:39 +00:00