Commit Graph

83 Commits

Author SHA1 Message Date
Ken Raeburn 1dc1e7989f * config/tc-mips.c: Use USE_STDARG and USE_VARARGS instead of NO_STDARG &c.
* config/tc-mips.c (mips_target_format): Changed to a function, checking flavor
and byte order at run time.
(md_parse_option, cases OPTION_EB and OPTION_EL): Set target_big_endian here.
(md_begin): Not here.
* config/tc-mips.h (mips_target_format): Adjust declaration.
(TARGET_FORMAT): Call mips_target_format.

* config/tc-mips.h (USE_GLOBAL_POINTER_OPT): Define in terms of OUTPUT_FLAVOR.
* config/tc-mips.c (g_switch_value, g_switch_seen): Define unconditionally.
(md_begin, mips_ip, md_parse_option, s_change_sec, s_option, s_abicalls,
nopic_need_relax): Check USE_GLOBAL_POINTER_OPT at run time, instead of
compiling conditionally on GPOPT.
(GPOPT): Don't define.
(md_shortopts): Always include -G.
(RDATA_SECTION_NAME): Select at run time.
(md_begin): Test for ELF format at run time instead of compile time.
(mips_ip, s_change_sec): Ditto.
(md_parse_option, cases OPTION_CALL_SHARED and OPTION_NON_SHARED): Ditto.
(OPTION_CALL_SHARED, OPTION_NON_SHARED, mips_regmask_frag): Define
unconditionally.
1995-05-02 19:33:00 +00:00
Ken Raeburn d8a1c247ae Fix for PR6697:
(nopic_need_relax): New static function, split out from
md_estimate_size_before_relax.
(md_estimate_size_before_relax): Call it.
(load_address, macro): In NO_PIC branches, if nopic_need_relax returns nonzero,
don't attempt GP optimization.
1995-04-11 01:29:49 +00:00
Ian Lance Taylor 6b67ed7865 tweak previous patch 1995-02-24 20:25:52 +00:00
Ian Lance Taylor 7811254cb0 * config/tc-mips.c (load_register): Correctly handle 32 bit values
with the high bit set in 64 bit mode.
PR 6381.
1995-02-24 19:42:43 +00:00
Ian Lance Taylor 546f553610 * config/tc-mips.c (append_insn): If listing_prev_line is called,
call frag_grow to make sure there is still room for a variant.
1995-02-23 02:20:57 +00:00
Ian Lance Taylor 61420a2049 * config/tc-mips.c (md_pseudo_table): Add 2byte, 4byte and 8byte
if OBJ_ELF.  From gary@Intrepid.COM (Gary Funck).
1995-02-17 20:13:41 +00:00
Ian Lance Taylor 49ad0c4cf3 * config/tc-mips.c (md_apply_fix): Accept BFD_RELOC_16, for
DWARF.  From gary@Intrepid.COM (Gary Funck).
1995-02-15 21:08:05 +00:00
Ian Lance Taylor adcf2b9d57 * config/tc-mips.c (macro): Handle M_U{L,S}D[_A] (unaligned double
loads and stores).
1995-02-15 20:43:57 +00:00
Ian Lance Taylor b2b8c24e2f * config/tc-mips.c (macro): Don't use the target register as a
base register when building the address for M_L{W,D}{L,R}_AB.
1995-02-15 16:48:18 +00:00
Ken Raeburn 3a762a0bfd Use new hex-value code in libiberty:
* Makefile.in (VMS_OTHER_OBJS): Add ../libiberty/hex.o.
(OBJS): Delete hex-value.o.
(REAL_SOURCES): Delete hex-value.c.
(hex-value.o): Delete dependencies.
* hex-value.c: Deleted.
* as.c (main): Call hex_init.
* expr.c, config/tc-mips.c: Include libiberty.h.  Replace hex_value array
references with hex_* macros.
1995-01-12 23:00:26 +00:00
Ken Raeburn 483971bdbf * config/tc-mips.c (RELAX_RELOC1, RELAX_RELOC2): Cast values to bfd_vma before
subtracting.
1995-01-10 01:45:53 +00:00
Ian Lance Taylor 1113140a24 * config/tc-mips.c (mips_ip): Fix handling of floating point
values when GPOPT is not defined.
1995-01-08 21:17:56 +00:00
Ken Raeburn 87e4849501 * frags.c (frag_init): Call obstack_begin on `frags'.
* subsegs.c (subsegs_begin): Don't do it here.
* as.c (main): Call frag_init before subsegs_begin.

* frags.c (frag_append_1_char): New function.
* frags.h (frag_append_1_char): Declare it.
(FRAG_APPEND_1_CHAR): Call it.  Old definition is commented out for now.

* as.h (struct frag): Added (but commented out) new fields for tracking current
alignment.
(frag_now_fix): Changed macro to function declaration.
* frags.c (frag_now_fix): Define function here.
(frag_new): Use it instead of accessing `frags' directly.
* frags.h (frags): Change comment to indicate it shouldn't be accessed directly.
* subsegs.h (struct frchain): New field frch_obstack, intended to eventually
replace global `frags' obstack.
* subsegs.c (subseg_set_rest): Use frag_now_fix instead of accessing `frags'
directly.  Initialize fields of new frchainS explicitly instead of with memset.
* config/obj-coff.c (obj_coff_ln) [!BFD_ASSEMBLER]: Use frag_now_fix.
* config/tc-mips.c (s_loc), config/obj-vms.c (vms_resolve_symbol_redef),
symbols.c (colon): Likewise.
1994-12-20 22:42:03 +00:00
Ian Lance Taylor 847a01cd4c * config/tc-mips.c (load_register): Rewrite to handle O_big 64 bit
constants.
	(mips_ip): Accept O_big constants in case 'I'.  Change case
	'i'/'j' to treat an O_big constant as an out of range value.
1994-12-19 22:02:01 +00:00
Ian Lance Taylor da15a93ea1 * config/tc-mips.c (s_change_sec): If not GPOPT, don't permit
switching to the readonly data section.
1994-11-01 22:07:46 +00:00
Ian Lance Taylor 94b68f040c * config/tc-mips.c (macro): Ensure that mips2 case of M_LI_DD in
.rdata does not become a variant frag.
1994-10-25 21:24:02 +00:00
Ian Lance Taylor 4bb0cc41f2 * config/tc-mips.c (mips_cpu): Initialize to -1.
(md_begin): Don't mips_cpu if it was already set.
	(md_parse_option): For -mipsN, don't set mips_cpu if it was
	already set.  For -mcpu=, just set mips_cpu, not mips_isa.
1994-10-25 18:47:09 +00:00
Ian Lance Taylor 9da4c5d130 * config/tc-mips.c (md_pseudo_table): If OBJ_ELF, handle .section.
(s_elf_section): New static function.
	* ecoff.c (ecoff_build_symbols): Don't abort if we don't recognize
	the section when setting the storage class; default to sc_Data.
1994-10-22 00:51:53 +00:00
Ian Lance Taylor 7b777690a8 * config/tc-mips.c (md_apply_fix): Correct branch overflow test.
Use as_bad_where and as_warn_where rather than as_bad and as_warn.
1994-09-28 15:55:31 +00:00
Ian Lance Taylor e8d4d4758b * config/tc-mips.c (md_shortopts): Remove E.
(md_longopts): Add EB and EL.
	(md_parse_option): Handle -EB and -EL as separate options, rather
	than as a single -E option with an argument.
1994-09-20 20:16:24 +00:00
Ken Raeburn 460531dad9 Use EXIT_SUCCESS and EXIT_FAILURE in all exit calls.
Use exit rather than returning from main, for consistency on VMS.
Call as_fatal instead of as_bad or as_warn followed by exit.
1994-09-13 23:07:48 +00:00
Ian Lance Taylor c1444ec48f * config/tc-mips.c (md_pseudo_table): Handle .globl and .global.
(s_mips_globl): New static function; needed for Irix 5 support.
	* ecoff.c (ecoff_build_symbols): If BSF_FUNCTION is set for an
	external symbol with no type, set the type to st_Proc rather than
	st_Global.  Don't set the index of an external st_Proc or
	st_StaticProc symbol unless it is also a local symbol.
1994-09-12 22:11:18 +00:00
Ian Lance Taylor 8c63448afe * config/tc-mips.c (mips_cpu): New static variable.
(insns_since_cache_access): New static variable.
	(md_begin): Set mips_cpu as well as mips_isa.
	(append_insn): If mips_cpu is 4600, require four nop instructions
	between an instruction which accesses the cache and certain CACHE
	instructions.  Keep track of the number of instructions seen since
	an instruction which accesses the cache.
	(md_parse_option): Set mips_cpu as well as mips_isa.
PR 5433.
1994-09-06 15:51:09 +00:00
Ian Lance Taylor 55933a587a * config/tc-mips.c (md_parse_option): Accept -mcpu=4400, 4600, and
orion.
1994-08-09 15:18:26 +00:00
Stan Shebs 6f0b87c329 * as.c (show_usage): Break long string into shorter ones.
(parse_args): Add -v, prints version id and continues.
	* config/tc-mips.c (md_show_usage): Break long string.
1994-06-30 00:55:33 +00:00
Ian Lance Taylor 36a87ad7c5 * config/tc-mips.c (mips_ip): Permit non constant expressions in
'u' case: lets lui %hi(foo) work correctly.
1994-06-15 16:49:51 +00:00
Ian Lance Taylor d2c71068e8 * config/tc-mips.c (RDATA_SECTION_NAME): Define.
(macro): Correct M_LI_SS SVR4_PIC/EMBEDDED_PIC case.  After M_LI_D
	or M_L_DOB or label dob, force a new frag to avoid getting
	confused in tc_gen_reloc.
	(mips_ip): Use RDATA_SECTION_NAME, not .rdata.
	(s_change_sec): Likewise.
1994-06-06 17:16:16 +00:00
David MacKenzie baed44cd14 * as.c (show_usage), config/tc-alpha.c (md_show_usage),
config/tc-mips.c (md_show_usage): Fix up messages.
1994-06-03 21:19:02 +00:00
David MacKenzie def66e248c * as.h: Replace flagseen with separate variables.
* as.c (parse_args): Set them.  Don't accept -1 option, or -v
	explicitly (it's a synonym for --version).
	* as.c, input-scrub.c, messages.c, read.c, symbols.c, write.c,
	config/obj-aout.c, config/obj-aout.h, config/obj-bout.c,
	config/obj-bout.h, config/obj-coff.c, config/obj-coff.h,
	config/obj-vms.c, config/tc-hppa.c, config/tc-i386.c,
	config/tc-i960.c, config/tc-m68k.c, config/tc-mips.c,
	config/tc-vax.c: Use the new flag variables instead of flagseen.
	* config/tc-vax.c [OBJ_VMS]: Recognize -+, -1, -v, and document in
	usage.
1994-06-03 20:59:20 +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
Ian Lance Taylor 0221ddf71a * config/tc-mips.c (mips_ip): Force floating point values to be
aligned correctly.
1994-06-01 14:56:21 +00:00
Ian Lance Taylor 6fdc26e663 * config/tc-mips.c (append_insn): Permit branches to be switched
with the preceding instruction even if .set nobopt has been seen.
	.set nobopt actually controls whether to bring up an instruction
	from the branch target, which gas does not currently support.
1994-04-21 19:53:25 +00:00
Ian Lance Taylor 2f06dd5c75 Remove assertion that was not intended to be checked in. 1994-04-14 17:59:14 +00:00
Ian Lance Taylor ecd4ca1cef * config/tc-mips.h (DIFF_EXPR_OK): Define.
* config/tc-mips.c (macro_build): Permit BFD_RELOC_PCREL_LO16 for
	certain cases of 'i', 'j' and 'o'.  Change 'u' to take an
	argument, the reloc type.
	(load_register): Pass reloc type to macro_build for 'u'.
	(macro): Likewise.  For M_LA_AB permit a difference expression
	when generating embedded PIC code between an arbitrary symbol and
	a symbol in the .text section.
	(mips_force_relocation): Force BFD_RELOC_PCREL_HI16_S and
	BFD_RELOC_PCREL_LO16 to be emitted.
	(md_apply_fix): Check that most relocs are not PC relative.
	Handle BFD_RELOC_PCREL_HI16_S and BFD_RELOC_PCREL_LO16.
	(tc_gen_reloc): Change #error to as_fatal.  Handle
	BFD_RELOC_PCREL_LO16 and BFD_RELOC_PCREL_HI16_S.
1994-04-14 17:39:55 +00:00
Ian Lance Taylor 1c803e5223 * config/tc-mips.c (macro): Pass NULL for expression argument to
macro_build for nori case.
	(SWITCH_TABLE): Define.
	(mips_force_relocation): Force a relocation for a switch table
	entry.
	(md_apply_fix): Write switch table entry value into file.
	(tc_gen_reloc): Use BFD_RELOC_GPREL32 for a switch table entry,
	and set the addend to the difference between the reloc address and
	the subtrahend.
1994-04-07 18:33:09 +00:00
Ian Lance Taylor f3645945cf * config/tc-mips.c (mips_ip): For case 'o', when generating
embedded PIC code, accept the difference between two local symbols
	as being constant.
	(mips_force_relocation): Only force a reloc to be generated for a
	PC relative fixup.
	(md_apply_fix): For BFD_RELOC_32 and BFD_RELOC_LO16, put the fixup
	value into the file if the fixup will not generate a reloc.
1994-04-05 19:57:32 +00:00
Ian Lance Taylor 5b63f465fc * config/tc-mips.c (append_insn): If EMBEDDED_PIC, don't swap a
branch with an instruction that uses $at, in case the branch is
	later expanded.
	(macro): If EMBEDDED_PIC, case M_JAL_A may use $at.
	(md_pcrel_from): If not OBJ_AOUT, return 4 for an undefined symbol
	to make it pcrel_offset.
	(tc_gen_reloc): If not OBJ_AOUT, set the reloc addend to
	reloc->address; another gruesome hack to get gas reloc handling to
	do the right thing.
1994-03-25 22:40:44 +00:00
Ian Lance Taylor 7dfa376e9b Handle .gpword and .cpadd only for SVR4_PIC, not != NO_PIC. Still
covered by last ChangeLog entry.
1994-03-23 00:43:48 +00:00
Ian Lance Taylor d9aba8051e * config/tc-mips.c (enum mips_pic_level): New enum.
(mips_pic): Change from int to enum mips_pic_level.  Change all
	uses (0 becomes NO_PIC, 2 becomes SVR4_PIC).
	(load_address): Handle EMBEDDED_PIC.
	(macro): Handle EMBEDDED_PIC in all PIC cases.
	(md_parse_option): Accept -membedded-pic to use EMBEDDED_PIC.  If
	OBJ_ELF, accept -KPIC and -call_shared to use SVR4_PIC and accept
	-non_shared to use NO_PIC (this is how the Irix 5 assembler
	works).  Do not permit -G with SVR4_PIC.
	(s_abicalls): Warn if -G was used, and force -G 0.
	(tc_gen_reloc): Set reloc->addend to 0 for a PC relative reloc for
	anything but a.out, not just for ELF.  For ECOFF, don't generate a
	BFD_RELOC_16_PCREL_S2 reloc unless using EMBEDDED_PIC.
1994-03-22 20:27:58 +00:00
Ian Lance Taylor 23dc1ae33d * config/tc-mips.c (mips_align): Take new argument, label, and use
it instead of global insn_label.
	(s_align, s_cons, s_float_cons, s_gpword): Save insn_label before
	call to mips_emit_delay and pass it to mips_align.
1994-03-16 22:16:02 +00:00
Ian Lance Taylor be22008b2c * config/tc-mips.c (mips_ip): Accept numbers between 0x8000 and
0xffff for 'j' to be compatible with MIPS assembler.  These
	numbers are actually treated as negative.
1994-03-11 23:00:17 +00:00
Ian Lance Taylor 8ea7f4e854 * config/tc-mips.c (load_address): When calling frag_grow, allow
for the (up to) two nops which may be inserted by append_insn if
	mips_optimize is 0.
	(macro): Likewise.
1994-03-07 21:12:26 +00:00
Ian Lance Taylor 11c0749600 Revert last change. 1994-02-04 03:17:30 +00:00
Ian Lance Taylor fdb3408e12 * config/tc-mips.c (md_apply_fix): If this is an undefined symbol,
subtract the value from fx_addnumber to since
	bfd_perform_relocation is going to add it in.
1994-02-04 02:32:54 +00:00
Ian Lance Taylor 1051c97f63 * config/tc-mips.c (file_mips_isa): New static variable.
(md_begin): Set it.
	(s_mipsset): Add support for .set mipN to set the ISA level.
1994-02-02 17:06:24 +00:00
Ian Lance Taylor 8bbad6fda8 * config/tc-mips.c (mips_ip): Make an unsupported instruction a
warning, not an error.
1994-02-01 23:10:05 +00:00
Ian Lance Taylor 425625680a * tc-mips.c (g_switch_seen): New static variable.
(md_parse_option): Set g_switch_seen for -G option.
	(s_option): If creating PIC code, force the GP size to be 0.  Warn
	if -G switch used with a non-zero value.
1994-01-25 00:24:57 +00:00
Ian Lance Taylor eb8fd0e9b4 * config/tc-mips.c (md_pseudo_table): Add all data allocation
pseudo-ops: .hword, .int, .long, .octa, .quad, .short, .single.
1994-01-20 04:18:14 +00:00
Ian Lance Taylor 04cb3372f3 Comment and whitespace changes. 1994-01-17 20:39:26 +00:00
Ian Lance Taylor 8197b58995 * config/tc-mips.c (macro): Corrected $at warnings in a couple of
spots.
1994-01-11 19:18:45 +00:00