Commit graph

11 commits

Author SHA1 Message Date
Ian Lance Taylor
5f8cb05eef * config/tc-sh.c (sh_relax): Rename from relax, and make global.
Renamed all uses.
	(insert): Pass a size of 2, not 4.
	(build_relax): Remove unused len variable.
	(md_show_usage): Mention -little option.
	(md_convert_frag): Add segT argument.  Rewrite to generate relocs
	rather than to generate complete instructions here.
	(md_apply_fix): Adjust and clarify R_SH_PCRELIMM8BY4 case for
	changes in insert and md_pcrel_from.  Add cases for R_SH_PCDISP
	and R_SH_PCDISP8BY2.
	(md_pcrel_from): Don't subtract 1, add 2.
	(tc_coff_fix2rtype): Remove.
	(sh_coff_reloc_mangle): New function.
	* config/tc-sh.h (TC_COFF_FIX2RTYPE): Just return fx_r_type.
	(sh_relax): Declare.
	(TC_COUNT_RELOC): If relaxing, count PC relative relocs.
	(TC_RELOC_MANGLE): Define.
	(sh_coff_reloc_mangle): Declare.
	(tc_coff_sizemachdep): Declare.
	* tc.h (md_convert_frag): Add segT parameter to non BFD_ASSEMBLER
	declaration.
	* write.c (cvt_frag_to_fill): Add sec argument to non
	BFD_ASSEMBLER version.  Pass it to md_convert_frag.
	(write_object_file): Pass SEG_TEXT to cvs_frag_to_fill.
	* config/obj-coff.c (do_relocs_for): Pass segment info to
	TC_RELOC_MANGLE.
	(fixup_mdeps): Pass segment type to md_convert_frag.
	* config/tc-a29k.c (md_convert_frag): Add segT argument.
	* config/tc-h8300.c (md_convert_frag): Likewise.
	* config/tc-h8500.c (md_convert_frag): Likewise.
	* config/tc-i386.c (md_convert_frag): Likewise.
	* config/tc-i860.c (md_convert_frag): Likewise.
	* config/tc-i960.c (md_convert_frag): Likewise.
	* config/tc-m68k.c (md_convert_frag): Likewise.
	* config/tc-m88k.h (md_convert_frag): Likewise.
	* config/tc-ns32k.c (md_convert_frag): Likewise.
	* config/tc-rce.c (md_convert_frag): Likewise.
	* config/tc-tahoe.c (md_convert_frag): Likewise.
	* config/tc-vax.c (md_convert_frag): Likewise.
	* config/tc-w65.c (md_convert_frag): Likewise.
	* config/tc-z8k.c (md_convert_frag): Likewise.
	* config/tc-h8300.h (TC_RELOC_MANGLE): Add segment argument.
	* config/tc-h8500.h (TC_RELOC_MANGLE): Likewise.
	* config/tc-rce.h (TC_RELOC_MANGLE): Likewise.
	* config/tc-w65.h (TC_RELOC_MANGLE): Likewise.
	* config/tc-z8k.h (TC_RELOC_MANGLE): Likewise.
1995-07-19 16:14:49 +00:00
Ken Raeburn
9b0da28b13 write.c: Complain about .space or .org moving backwards.
Do generic rs_machine_dependent relaxation only if TC_GENERIC_RELAX_TABLE is
defined.  Use its value as the base of the table, so the actual declaration
can be cpu-specific (and const or not as appropriate).  For other cpus where
this isn't done (the majority), delete md_relax_table altogether.

For machines with WORKING_DOT_WORD, delete md_{short,long}_jump_size.
1995-04-11 06:10:34 +00:00
Ken Raeburn
03678945bd (md_operand): Replaced empty function in .c file with empty macro in .h file. 1995-02-28 23:37:38 +00:00
David MacKenzie
f3d817d8b7 * as.c (show_usage): Remove target specific messages;
instead, call md_show_usage.
	(parse_args): Use getopt_long_only.  Take pointers to argc and
	argv.
	(main): Pass parse_args pointers.
	* as.h: Remove 3 variables that are redundant with flagseen.
	* as.c, messages.c: Change their users to use flagseen.
	Define getopt stuff.
	* tc.h: Update md_parse_option decl.  Add md_show_usage decl.
	* config/tc-*.c: Add md_shortopts, md_longopts,
	md_longopts_size, md_show_usage.  Change calling convention for
	md_parse_option.  Remove md_parse_long_option.
	* config/tc-ns32k.c: Rename `struct option' to `struct ns32k_option'.
	* config/tc-i386.h: Don't define md_parse_option.
1994-06-03 17:42:27 +00:00
Ken Raeburn
6868afe647 * as.c (main): Only invoke md_end if it's defined as a macro.
* tc.h (md_end): Don't declare it.
* config/tc-*.[ch] (md_end): Deleted, in cases where it doesn't do anything.
* config/tc-vax.c (vip_end): Deleted null function.
* config/tc-mips.c (md_mips_end): Renamed from md_end.
* config/tc-mips.h (md_mips_end): Declare.
(md_end): New macro, calls md_mips_end.

* write.c (write_object_file): Don't close output file.
* as.c (main): Close output file (if needed) after calling listing_print, which
should be after calling write_object_file, which sets the frag addresses.
1993-12-20 16:48:00 +00:00
Ken Raeburn
c999fd9fc2 * config/tc-vax.c (tc_aout_fix_to_chars): Local variable NBYTES_R_LENGTH now
const.

* config/obj-*.c, config/tc-*.c: Omit superfluous "return" statements at ends
of functions.  Don't check for null return from hash_new, since it won't return
at all if there's no memory available.  Also, check for null return from
hash_insert, rather than zero-length string, as success indicator.
1993-12-16 21:31:22 +00:00
Ken Raeburn
bfbfba45ba Lots of changes for:
- sparc[lite]-coff as well as sparc-lynx
 - producing coff (including debug info) under BFD_ASSEMBLER option
 - cleanup of cpu-specific code in non-cpu-specific files
   (especially write.c)
 - providing common code to avoid duplication in cpu-specific files
   (specifically, md_number_to_chars)
 - stylistic changes & misc cleanup

================

* config/tc-sparc.c (tc_gen_reloc): Make adjustment to addend be dependent on
howto fields, not on format flavour.

* struc-symbol.h (struct symbol): New fields sy_obj and sy_tc, defined as types
OBJ_SYMFIELD_TYPE and TC_SYMFIELD_TYPE, if those macros are defined.
* config/obj-coff.h (TC_SYMFIELD_TYPE, OBJ_SYMFIELD_TYPE): Define.
(TARGET_SYMBOL_FIELDS, I960_SYM_FIELDS): Don't define.
(sy_tc, sy_obj): Define so that the fields look like they used to, until all
references get changed.

* write.c (fixup_segment): Lots of variables no longer register.  Reordered
some code for easier reading.
* config/obj-coff.c (obj_coff_dim): dim_index no longer register.  Deleted
superfluous return statement.
(obj_coff_line, obj_coff_size, obj_coff_scl, obj_coff_type, obj_coff_val,
tag_init, tag_insert): Deleted superfluous return statement.
(align, obj_coff_section): Deleted debugging printfs.
* config/tc-i386.c (md_assemble): Discard some register decls.  Use assignment
rather than memcpy to copy template.
(op_hash, reg_hash, prefix_hash): Default C initialization of statics is
sufficient.
* config/tc-sparc.c (print_insn): Array Reloc is now const, and points to
const.

* config/obj-coff.h (TARGET_FORMAT): Only use coff-sparc-lynx if TE_LYNX; use
coff-sparc otherwise.
[USE_NATIVE_HEADERS]: Delete this code; it isn't used.

* write.c (fixup_segment): Call TC_VALIDATE_FIX, if defined, before processing
a fixup.  Call TC_ADJUST_RELOC_COUNT just before returning.  Remove some
i960-coff-specific code.
(TC_ADJUST_RELOC_COUNT): Default to doing nothing.
* config/tc-i960.h (TC_ADJUST_RELOC_COUNT) [OBJ_COFF]: Define.
(i960_validate_fix): Declare.
(TC_VALIDATE_FIX): Define.
* config/tc-i960.c (i960_validate_fix): New function.

* write.c (number_to_chars_littleendian): New function.  Write out bytes in
little endian order, doing size and range checking.
(number_to_chars_bigendian): New function, similar.
* write.h: Declare them.
* config/tc-*.c (md_number_to_chars): Use them.
* config/tc-vax.c (md_apply_fix): Ditto.
* config/tc-i386.c (md_apply_fix): Ditto.

* config/obj-coff.c: Rearranged code for handling line number data.
(line_fsym): Renamed from function_lineoff in BFD_ASSEMBLER case, since the
usage is different from non-BFD_ASSEMBLER case.
(in_function, clear_function, set_function): New macros, to combine some of the
functionality implemented in differnet ways in BFD_ASSEMBLER and non-... code.
Used in other functions that used to check function_lineoff &c.
(obj_emit_lineno): Split into two copies, one for BFD_ASSEMBLER, one for not.
Non-BFD_ASSEMBLER version now has temporary variable to contain char* pointer
pointed to by char** argument.  Always follow CROSS_COMPILE code; easier to
read that way.
(obj_coff_ln): Don't call add_lineno or c_line_new if appline is set.
(obj_coff_endef) [BFD_ASSEMBLER]: Don't do anything special for ".bf", it's
been done elsewhere.
(coff_frob_symbol): If ilne number data is pending, call add_linesym to flush it.
(coff_frob_file): Don't do that here.
* config/obj-coff.h (coff_frob_file): Declare.
(obj_frob_file): Define, to call it.

* config/tc-sparc.h (md_create_short_jump, md_create_long_jump,
md_estimate_size_before_relax: Define them as macros calling as_fatal.
* config/tc-sparc.c: Don't define them as functions.
1993-12-03 03:10:08 +00:00
Ken Raeburn
43029a8f84 Whitespace/comment cleanup. Use PARAMS in tc-vax.c.
Make various routines return null pointer instead of empty string for
success indication.
1993-09-28 04:47:32 +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
Mark Eichin
025b030243 fix definitions of md_create_long_jump, md_create_short_jump,
md_number_to_chars, and md_section_align to correctly use valueT and addressT
1993-07-12 19:42:32 +00:00
Ken Raeburn
7943af02d9 tahoe code from fsf - untested 1992-12-03 23:41:18 +00:00