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-tahoe.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-tahoe.c')
-rw-r--r-- | gas/config/tc-tahoe.c | 88 |
1 files changed, 39 insertions, 49 deletions
diff --git a/gas/config/tc-tahoe.c b/gas/config/tc-tahoe.c index 7bd97b5..5fc47d3 100644 --- a/gas/config/tc-tahoe.c +++ b/gas/config/tc-tahoe.c @@ -30,6 +30,8 @@ struct top /* tahoe instruction operand */ char *top_error; /* Say if operand is inappropriate */ + segT seg_of_operand; /* segment as returned by expression()*/ + expressionS exp_of_operand; /* The expression as parsed by expression()*/ byte top_dispsize; /* Number of bytes in the displacement if we @@ -665,7 +667,7 @@ md_estimate_size_before_relax (fragP, segment_type) *p |= TAHOE_PC_OR_LONG; /* We now know how big it will be, one long word. */ fragP->fr_fix += 1 + 4; - fix_new (fragP, old_fr_fix + 1, fragP->fr_symbol, 0, + fix_new (fragP, old_fr_fix + 1, fragP->fr_symbol, fragP->fr_offset, FX_PCREL32, NULL); frag_wane (fragP); } @@ -684,7 +686,7 @@ md_estimate_size_before_relax (fragP, segment_type) *p++ = TAHOE_JMP; *p++ = TAHOE_PC_REL_LONG; fragP->fr_fix += 1 + 1 + 1 + 4; - fix_new (fragP, old_fr_fix + 3, fragP->fr_symbol, 0, + fix_new (fragP, old_fr_fix + 3, fragP->fr_symbol, fragP->fr_offset, FX_PCREL32, NULL); frag_wane (fragP); } @@ -705,7 +707,7 @@ md_estimate_size_before_relax (fragP, segment_type) *p++ = TAHOE_JMP; *p++ = TAHOE_PC_REL_LONG; fragP->fr_fix += 2 + 2 + 4; - fix_new (fragP, old_fr_fix + 4, fragP->fr_symbol, 0, + fix_new (fragP, old_fr_fix + 4, fragP->fr_symbol, fragP->fr_offset, FX_PCREL32, NULL); frag_wane (fragP); } @@ -726,7 +728,7 @@ md_estimate_size_before_relax (fragP, segment_type) *p++ = TAHOE_JMP; *p++ = TAHOE_PC_REL_LONG; fragP->fr_fix += 2 + 2 + 2 + 4; - fix_new (fragP, old_fr_fix + 6, fragP->fr_symbol, 0, + fix_new (fragP, old_fr_fix + 6, fragP->fr_symbol, fragP->fr_offset, FX_PCREL32, NULL); frag_wane (fragP); } @@ -743,7 +745,7 @@ md_estimate_size_before_relax (fragP, segment_type) *fragP->fr_opcode = TAHOE_JMP; *p++ = TAHOE_PC_REL_LONG; fragP->fr_fix += 1 + 4; - fix_new (fragP, old_fr_fix + 1, fragP->fr_symbol, 0, + fix_new (fragP, old_fr_fix + 1, fragP->fr_symbol, fragP->fr_offset, FX_PCREL32, NULL); frag_wane (fragP); } @@ -1261,64 +1263,52 @@ tip_op (optex, topP) /* statement has no syntax goofs yet: lets sniff the expression */ input_line_pointer = point; expP = &(topP->exp_of_operand); - switch (expression (expP)) + topP->seg_of_operand = expression (expP); + switch (expP->X_op) { - /* If expression == SEG_PASS1, expression() will have set - need_pass_2 = 1. */ - case SEG_ABSENT: + case O_absent: /* No expression. For BSD4.2 compatibility, missing expression is - absolute 0 */ - expP->X_seg = SEG_ABSOLUTE; + absolute 0 */ + expP->X_op = O_constant; expP->X_add_number = 0; really_none = 1; - case SEG_ABSOLUTE: - /* for SEG_ABSOLUTE, we shouldnt need to set X_subtract_symbol, - X_add_symbol to any particular value. */ + case O_constant: + /* for SEG_ABSOLUTE, we shouldnt need to set X_op_symbol, + X_add_symbol to any particular value. */ /* But, we will program defensively. Since this situation occurs - rarely so it costs us little to do so. */ + rarely so it costs us little to do so. */ expP->X_add_symbol = NULL; - expP->X_subtract_symbol = NULL; + expP->X_op_symbol = NULL; /* How many bytes are needed to express this abs value? */ abs_width = ((((expP->X_add_number & 0xFFFFFF80) == 0) || ((expP->X_add_number & 0xFFFFFF80) == 0xFFFFFF80)) ? 1 : (((expP->X_add_number & 0xFFFF8000) == 0) || ((expP->X_add_number & 0xFFFF8000) == 0xFFFF8000)) ? 2 : 4); - case SEG_TEXT: - case SEG_DATA: - case SEG_BSS: - case SEG_UNKNOWN: + + case O_symbol: break; - case SEG_DIFFERENCE: + default: /* - * Major bug. We can't handle the case of a - * SEG_DIFFERENCE expression in a synthetic opcode - * variable-length instruction. - * We don't have a frag type that is smart enough to - * relax a SEG_DIFFERENCE, and so we just force all - * SEG_DIFFERENCEs to behave like SEG_PASS1s. - * Clearly, if there is a demand we can invent a new or - * modified frag type and then coding up a frag for this - * case will be easy. SEG_DIFFERENCE was invented for the - * .words after a CASE opcode, and was never intended for - * instruction operands. - */ + * Major bug. We can't handle the case of a operator + * expression in a synthetic opcode variable-length + * instruction. We don't have a frag type that is smart + * enough to relax a operator, and so we just force all + * operators to behave like SEG_PASS1s. Clearly, if there is + * a demand we can invent a new or modified frag type and + * then coding up a frag for this case will be easy. + */ need_pass_2 = 1; - case SEG_PASS1: op_bad = "Can't relocate expression error."; break; - case SEG_BIG: + case O_big: /* This is an error. Tahoe doesn't allow any expressions - bigger that a 32 bit long word. Any bigger has to be referenced - by address. */ + bigger that a 32 bit long word. Any bigger has to be referenced + by address. */ op_bad = "Expression is too large for a 32 bits."; break; - - default: - as_fatal ("Complier Bug: I got segment %d in tip_op.", expP->X_seg); - break; } if (*input_line_pointer != '\0') { @@ -1706,7 +1696,7 @@ md_assemble (instruction_string) /* Here to make main operand frag(s). */ this_add_number = expP->X_add_number; this_add_symbol = expP->X_add_symbol; - to_seg = expP->X_seg; + to_seg = operandP->seg_of_operand; know (to_seg == SEG_UNKNOWN || \ to_seg == SEG_ABSOLUTE || \ to_seg == SEG_DATA || \ @@ -1731,7 +1721,7 @@ md_assemble (instruction_string) branch), so I set up the frag, and let GAS do the rest. */ p = frag_more (dispsize); fix_new (frag_now, p - frag_now->fr_literal, - this_add_symbol, 0, this_add_number, + this_add_symbol, this_add_number, size_to_fx (dispsize, 1), NULL); } @@ -1810,7 +1800,7 @@ md_assemble (instruction_string) TAHOE_ABSOLUTE_ADDR ? TAHOE_ABSOLUTE_ADDR : TAHOE_PC_REL_LONG); fix_new (frag_now, p - frag_now->fr_literal, - this_add_symbol, 0, this_add_number, + this_add_symbol, this_add_number, (to_seg != SEG_ABSOLUTE) ? FX_PCREL32 : FX_32, NULL); /* * Now (eg) BLEQ 1f @@ -1826,7 +1816,7 @@ md_assemble (instruction_string) TAHOE_ABSOLUTE_ADDR ? TAHOE_ABSOLUTE_ADDR : TAHOE_PC_REL_LONG); fix_new (frag_now, p - frag_now->fr_literal, - this_add_symbol, 0, this_add_number, + this_add_symbol, this_add_number, (to_seg != SEG_ABSOLUTE) ? FX_PCREL32 : FX_32, NULL); /* Now (eg) JMP foo */ break; @@ -1840,7 +1830,7 @@ md_assemble (instruction_string) TAHOE_ABSOLUTE_ADDR ? TAHOE_ABSOLUTE_ADDR : TAHOE_PC_REL_LONG); fix_new (frag_now, p - frag_now->fr_literal, - this_add_symbol, 0, this_add_number, + this_add_symbol, this_add_number, (to_seg != SEG_ABSOLUTE) ? FX_PCREL32 : FX_32, NULL); /* * Now (eg) ACBx 1f @@ -1859,7 +1849,7 @@ md_assemble (instruction_string) TAHOE_ABSOLUTE_ADDR ? TAHOE_ABSOLUTE_ADDR : TAHOE_PC_REL_LONG); fix_new (frag_now, p - frag_now->fr_literal, - this_add_symbol, 0, this_add_number, + this_add_symbol, this_add_number, (to_seg != SEG_ABSOLUTE) ? FX_PCREL32 : FX_32, NULL); /* * Now (eg) xOBxxx 1f @@ -1916,7 +1906,7 @@ md_assemble (instruction_string) p = frag_more (5); *p++ = TAHOE_IMMEDIATE_LONGWORD; fix_new (frag_now, p - frag_now->fr_literal, - this_add_symbol, 0, this_add_number, + this_add_symbol, this_add_number, FX_32, NULL); } else @@ -2009,7 +1999,7 @@ md_assemble (instruction_string) break; }; fix_new (frag_now, p + 1 - frag_now->fr_literal, - this_add_symbol, 0, this_add_number, + this_add_symbol, this_add_number, size_to_fx (dispsize, pc_rel), NULL); } break; |