diff options
author | Ian Lance Taylor <ian@airs.com> | 1993-07-21 00:41:42 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1993-07-21 00:41:42 +0000 |
commit | 5ac34ac37e3786b1fbc52aa9df376fff6a1e8e1a (patch) | |
tree | bf71fb272c4a13449f3dcc4d6ac486784e909cac /gas/config/tc-i386.c | |
parent | b9b9f55a52a01203776fcd35f2870634068d683a (diff) | |
download | gdb-5ac34ac37e3786b1fbc52aa9df376fff6a1e8e1a.zip gdb-5ac34ac37e3786b1fbc52aa9df376fff6a1e8e1a.tar.gz gdb-5ac34ac37e3786b1fbc52aa9df376fff6a1e8e1a.tar.bz2 |
* 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.
Diffstat (limited to 'gas/config/tc-i386.c')
-rw-r--r-- | gas/config/tc-i386.c | 70 |
1 files changed, 30 insertions, 40 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 3774d93..3694ac2 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -1,5 +1,5 @@ /* i386.c -- Assemble code for the Intel 80386 - Copyright (C) 1989, 1991, 1992 Free Software Foundation. + Copyright (C) 1989, 1991, 1992, 1993 Free Software Foundation. This file is part of GAS, the GNU Assembler. @@ -522,7 +522,7 @@ static void pe (e) expressionS *e; { - fprintf (stdout, " segment %s\n", segment_name (e->X_seg)); + fprintf (stdout, " operation %d\n", e->X_op); fprintf (stdout, " add_number %d (%x)\n", e->X_add_number, e->X_add_number); if (e->X_add_symbol) @@ -531,10 +531,10 @@ pe (e) ps (e->X_add_symbol); fprintf (stdout, "\n"); } - if (e->X_subtract_symbol) + if (e->X_op_symbol) { - fprintf (stdout, " sub_symbol "); - ps (e->X_subtract_symbol); + fprintf (stdout, " op_symbol "); + ps (e->X_op_symbol); fprintf (stdout, "\n"); } } @@ -1254,10 +1254,10 @@ md_assemble (line) holds the correct displacement size. */ exp = &disp_expressions[i.disp_operands++]; i.disps[o] = exp; - exp->X_seg = absolute_section; + exp->X_op = O_constant; exp->X_add_number = 0; exp->X_add_symbol = (symbolS *) 0; - exp->X_subtract_symbol = (symbolS *) 0; + exp->X_op_symbol = (symbolS *) 0; } /* Select the correct segment for the memory operand. */ @@ -1337,11 +1337,8 @@ md_assemble (line) if (t->opcode_modifier & Jump) { int n = i.disps[0]->X_add_number; - segT seg; - seg = i.disps[0]->X_seg; - - if (seg == absolute_section) + if (i.disps[0]->X_op == O_constant) { if (fits_in_signed_byte (n)) { @@ -1417,7 +1414,7 @@ md_assemble (line) } p = frag_more (size); - if (i.disps[0]->X_seg == absolute_section) + if (i.disps[0]->X_op == O_constant) { md_number_to_chars (p, n, size); if (size == 1 && !fits_in_signed_byte (n)) @@ -1428,23 +1425,20 @@ md_assemble (line) } else { - fix_new (frag_now, p - frag_now->fr_literal, size, - i.disps[0]->X_add_symbol, i.disps[0]->X_subtract_symbol, - i.disps[0]->X_add_number, 1, NO_RELOC); + fix_new_exp (frag_now, p - frag_now->fr_literal, size, + i.disps[0], 1, NO_RELOC); } } else if (t->opcode_modifier & JumpInterSegment) { p = frag_more (1 + 2 + 4); /* 1 opcode; 2 segment; 4 offset */ p[0] = t->base_opcode; - if (i.imms[1]->X_seg == absolute_section) + if (i.imms[1]->X_op == O_constant) md_number_to_chars (p + 1, i.imms[1]->X_add_number, 4); else - fix_new (frag_now, p + 1 - frag_now->fr_literal, 4, - i.imms[1]->X_add_symbol, - i.imms[1]->X_subtract_symbol, - i.imms[1]->X_add_number, 0, NO_RELOC); - if (i.imms[0]->X_seg != absolute_section) + fix_new_exp (frag_now, p + 1 - frag_now->fr_literal, 4, + i.imms[1], 0, NO_RELOC); + if (i.imms[0]->X_op != O_constant) as_bad ("can't handle non absolute segment in long call/jmp"); md_number_to_chars (p + 5, i.imms[0]->X_add_number, 2); } @@ -1510,7 +1504,7 @@ md_assemble (line) { if (i.disps[n]) { - if (i.disps[n]->X_seg == absolute_section) + if (i.disps[n]->X_op == O_constant) { if (i.types[n] & (Disp8 | Abs8)) { @@ -1532,9 +1526,8 @@ md_assemble (line) { /* not absolute_section */ /* need a 32-bit fixup (don't support 8bit non-absolute disps) */ p = frag_more (4); - fix_new (frag_now, p - frag_now->fr_literal, 4, - i.disps[n]->X_add_symbol, i.disps[n]->X_subtract_symbol, - i.disps[n]->X_add_number, 0, NO_RELOC); + fix_new_exp (frag_now, p - frag_now->fr_literal, 4, + i.disps[n], 0, NO_RELOC); } } } @@ -1549,7 +1542,7 @@ md_assemble (line) { if (i.imms[n]) { - if (i.imms[n]->X_seg == absolute_section) + if (i.imms[n]->X_op == O_constant) { if (i.types[n] & (Imm8 | Imm8S)) { @@ -1579,9 +1572,8 @@ md_assemble (line) else size = 4; p = frag_more (size); - fix_new (frag_now, p - frag_now->fr_literal, size, - i.imms[n]->X_add_symbol, i.imms[n]->X_subtract_symbol, - i.imms[n]->X_add_number, 0, NO_RELOC); + fix_new_exp (frag_now, p - frag_now->fr_literal, size, + i.imms[n], 0, NO_RELOC); } } } @@ -1696,18 +1688,18 @@ i386_operand (operand_string) exp_seg = expression (exp); input_line_pointer = save_input_line_pointer; - if (exp_seg == absent_section) + if (exp.X_op == O_absent) { /* missing or bad expr becomes absolute 0 */ as_bad ("missing or invalid immediate expression '%s' taken as 0", operand_string); - exp->X_seg = absolute_section; + exp->X_op = O_constant; exp->X_add_number = 0; exp->X_add_symbol = (symbolS *) 0; - exp->X_subtract_symbol = (symbolS *) 0; + exp->X_op_symbol = (symbolS *) 0; i.types[this_operand] |= Imm; } - else if (exp_seg == absolute_section) + else if (exp.X_op == O_constant) { i.types[this_operand] |= smallest_imm_type (exp->X_add_number); } @@ -1937,18 +1929,18 @@ i386_operand (operand_string) as_bad ("Ignoring junk '%s' after expression", input_line_pointer); RESTORE_END_STRING (displacement_string_end); input_line_pointer = save_input_line_pointer; - if (exp_seg == absent_section) + if (exp.X_op == O_absent) { /* missing expr becomes absolute 0 */ as_bad ("missing or invalid displacement '%s' taken as 0", operand_string); i.types[this_operand] |= (Disp | Abs); - exp->X_seg = absolute_section; + exp->X_op = O_constant; exp->X_add_number = 0; exp->X_add_symbol = (symbolS *) 0; - exp->X_subtract_symbol = (symbolS *) 0; + exp->X_op_symbol = (symbolS *) 0; } - else if (exp_seg == absolute_section) + else if (exp.X_op == O_constant) { i.types[this_operand] |= SMALLEST_DISP_TYPE (exp->X_add_number); } @@ -2042,7 +2034,6 @@ md_estimate_size_before_relax (fragP, segment) fragP->fr_fix += 4; fix_new (fragP, old_fr_fix, 4, fragP->fr_symbol, - (symbolS *) 0, fragP->fr_offset, 1, NO_RELOC); break; @@ -2054,7 +2045,6 @@ md_estimate_size_before_relax (fragP, segment) fragP->fr_fix += 1 + 4; /* we've added an opcode byte */ fix_new (fragP, old_fr_fix + 1, 4, fragP->fr_symbol, - (symbolS *) 0, fragP->fr_offset, 1, NO_RELOC); break; } @@ -2187,7 +2177,7 @@ md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol) md_number_to_chars (ptr, 0xe9, 1); /* opcode for long jmp */ md_number_to_chars (ptr + 1, offset, 4); fix_new (frag, (ptr + 1) - frag->fr_literal, 4, - to_symbol, (symbolS *) 0, (long) 0, 0, NO_RELOC); + to_symbol, (offsetT) 0, 0, NO_RELOC); } else { |