summaryrefslogtreecommitdiff
path: root/gas/expr.c
Commit message (Collapse)AuthorAgeFilesLines
* gas/Julian Brown2013-04-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | * 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.
* gas/Julian Brown2013-04-111-10/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-03-08 Chung-Lin Tang <cltang@codesourcery.com>Chung-Lin Tang2013-03-081-1/+4
| | | | | | | | | | | * 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.
* * frags.h (frag_offset_fixed_p): Update prototype.Alan Modra2012-06-301-4/+4
| | | | | * frags.c (frag_offset_fixed_p): Change type of "offset" to offsetT. * expr.c (expr, resolve_expression): Likewise for frag_off var.
* PR 12569Alan Modra2011-03-171-5/+2
| | | | | | | * 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.
* PR gas/12282Maciej W. Rozycki2010-12-041-1/+1
| | | | | * expr.c (expr_build_dot): Make a clone of the symbol to return if needed.
* gas/Richard Sandiford2010-12-021-3/+10
| | | | | | | | | | | | | | | | * 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.
* * symbols.h (dot_symbol): New declaration.Maciej W. Rozycki2010-12-011-1/+1
| | | | | | | | | | | | | (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.
* * symbols.c (symbol_clone_if_forward_ref): Don't limit cloningMaciej W. Rozycki2010-12-011-2/+7
| | | | | | | 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.
* * expr.c (expr): Correct returned segment value.Alan Modra2010-09-291-8/+19
|
* PR gas/11867Alan Modra2010-08-021-7/+14
| | | | | | | * 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.
* gas/Jan Beulich2010-06-221-2/+1
| | | | | | | | | | | | | | | | | | | | 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+$.
* Initialize the X_md field.H.J. Lu2010-04-211-0/+1
| | | | | | 2010-04-21 H.J. Lu <hongjiu.lu@intel.com> * expr.c (expr): Initialize the X_md field.
* Add -Wshadow to the gcc command line options used when compiling the binutils.Nick Clifton2009-12-111-4/+4
| | | | Fix up all warnings generated by the addition of this switch.
* Call symbol_same_p to check to if 2 symbols are the same.H.J. Lu2009-12-081-2/+1
| | | | | | | | | | | | | | | | | | | | | 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.
* PR gas/10856Alan Modra2009-10-281-8/+13
| | | | | | | | * 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.
* * po/bfd.pot: Updated by the Translation project.Nick Clifton2009-09-111-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* update copyright datesAlan Modra2009-09-021-1/+1
|
* gas/Jan Beulich2009-07-281-17/+1
| | | | | | 2009-07-28 Jan Beulich <jbeulich@novell.com> * expr.c (op_rank): Specify size. Remove O_md* initializers.
* * gas/app, gas/as.c, gas/as.h, gas/atof-generic.c, gas/cgen.c,Nick Clifton2009-06-221-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | 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'.
* gas/Jan Beulich2009-04-201-7/+104
| | | | | | | | | | | | | 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.
* gas/Jan Beulich2009-04-161-0/+15
| | | | | | | | | 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.
* Add MN10300 linker relaxation support for symbol differencesNick Clifton2007-10-191-0/+3
|
* gas/Jan Beulich2007-09-261-4/+12
| | | | | | | | | | | | | 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.
* Switch to GPLv3Nick Clifton2007-07-031-1/+1
|
* gas/Alan Modra2007-04-211-2/+2
| | | | | | | | | | | | | | | | | * 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.
* * expr.c (expr): Replace O_add case in switch (op_left) explainingBen Elliston2006-10-241-1/+3
| | | | why it can never occur.
* remove some duplicate #include's.Alan Modra2006-06-071-1/+0
|
* * expr.c (operand): Remove `if (0 && ..)' statement andBen Elliston2006-05-091-11/+1
| | | | | | | 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.
* PR 997Alan Modra2006-04-041-5/+13
| | | | | | | * 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.
* gas/Jan Beulich2005-12-221-14/+78
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* * expr.c (operand <case '$'>): Use DOLLAR_AMBIGU rather than flag_mri_m68kNick Clifton2005-11-081-3/+3
| | | | | as condition for parsing the '$' as a prefix. * as.h (DOLLAR_AMBIGU): Define if needed.
* * expr.c (op_encoding): Map '=' to O_SINGLE_EQ, if defined.Alan Modra2005-11-071-1/+4
| | | | * config/tc-z80.h: Define O_SINGLE_EQ as O_eq.
* * expr.c (integer_constant): Match only 'B' as binary suffix ifAlan Modra2005-11-061-1/+4
| | | | | NUMBERS_WITH_SUFFIX and LOCAL_LABELS_FB. Allow both 'b' and 'B' otherwise.
* This adjusts equate handling byNick Clifton2005-10-111-11/+211
| | | | | | | | | | | | | | | - 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.
* * expr.c (operator): Allow "!=" as a synonym for "<>".Nick Clifton2005-10-101-4/+10
| | | | * doc/as.texinfo (Infix Op): Mention "!=".
* Update the address and phone number of the FSFNick Clifton2005-05-051-2/+2
|
* * Makefile.am (GAS_CFILES): Remove bignum-copy.c.Ben Elliston2005-04-291-29/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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.
* gas/Jan Beulich2005-03-151-19/+15
| | | | | | | 2005-03-15 Jan Beulich <jbeulich@novell.com> * expr.c (operand): Merge handling of unary + into that for unary -, !, and ~.
* Remove redundant code enclosed by #ifdef RELAX_PAREN_GROUPING....#endif.Nick Clifton2005-03-031-6/+1
|
* * expr.c (integer_constant): Remove TARGET_WORD_SIZE hack.Alan Modra2005-03-011-5/+1
| | | | * config/tc-m68k.h (TARGET_WORD_SIZE): Delete.
* * as.h (assert): Warning fix.Alan Modra2005-03-011-1/+1
| | | | | | | | | | | * 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.
* * expr.c (operand): Handle the "~", "-", and "!" operators appliedMark Mitchell2004-08-111-0/+29
| | | | | | | to bignums. * gas/arm/bignum1.s: New test. * gas/arm/arm.exp: Run it.
* * expr.c (operand, operator): Don't reject '++' and '--'.Alan Modra2004-05-231-6/+9
|
* * expr.c (operand): Correct checks for ++ and --.Alan Modra2004-04-161-2/+2
|
* * expr.c (operand): Reject ++ and --.Nathan Sidwell2004-03-181-0/+15
| | | | (operator): Likewise.
* * ehopt.c: Convert to ISO-C.Kazu Hirata2003-11-221-49/+30
| | | | | | | | | | | * 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.
* * expr.c (make_expr_symbol): Fold FAKE_LABEL_NAME use into theRichard Henderson2003-05-271-10/+2
| | | | | | | | 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.
* * expr.c (operand): Add support for n.nn flonums.Alan Modra2002-10-181-16/+28
|
* * expr.c (expr): Simplify foo-foo here.Alan Modra2002-09-201-18/+2
| | | | (clean_up_expression): Remove O_subtract code.