1 /* tc-m68k.c -- Assemble for the m68k family
2 Copyright (C) 1987, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
4 This file is part of GAS, the GNU Assembler.
6 GAS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GAS is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GAS; see the file COPYING. If not, write to the Free
18 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
26 #include "opcode/m68k.h"
27 #include "m68k-parse.h"
29 /* This array holds the chars that always start a comment. If the
30 pre-processor is disabled, these aren't very useful */
31 #if (defined (OBJ_ELF) && ! defined (TE_PSOS) && ! defined (TE_LINUX)) || defined (TE_DELTA)
32 const char comment_chars
[] = "|#";
34 const char comment_chars
[] = "|";
37 /* This array holds the chars that only start a comment at the beginning of
38 a line. If the line seems to have the form '# 123 filename'
39 .line and .file directives will appear in the pre-processed output */
40 /* Note that input_file.c hand checks for '#' at the beginning of the
41 first line of the input file. This is because the compiler outputs
42 #NO_APP at the beginning of its output. */
43 /* Also note that comments like this one will always work. */
44 const char line_comment_chars
[] = "#";
46 const char line_separator_chars
[] = "";
48 /* Chars that can be used to separate mant from exp in floating point nums */
49 CONST
char EXP_CHARS
[] = "eE";
51 /* Chars that mean this number is a floating point constant, as
52 in "0f12.456" or "0d1.2345e12". */
54 CONST
char FLT_CHARS
[] = "rRsSfFdDxXeEpP";
56 /* Also be aware that MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT may have to be
57 changed in read.c . Ideally it shouldn't have to know about it at all,
58 but nothing is ideal around here. */
60 const int md_reloc_size
= 8; /* Size of relocation record */
62 /* Are we trying to generate PIC code? If so, absolute references
63 ought to be made into linkage table references or pc-relative
64 references. Not implemented. For ELF there are other means
65 to denote pic relocations. */
68 static int flag_short_refs
; /* -l option */
69 static int flag_long_jumps
; /* -S option */
71 #ifdef REGISTER_PREFIX_OPTIONAL
72 int flag_reg_prefix_optional
= REGISTER_PREFIX_OPTIONAL
;
74 int flag_reg_prefix_optional
;
77 /* Whether --register-prefix-optional was used on the command line. */
78 static int reg_prefix_optional_seen
;
80 /* The floating point coprocessor to use by default. */
81 static enum m68k_register m68k_float_copnum
= COP1
;
83 /* If this is non-zero, then references to number(%pc) will be taken
84 to refer to number, rather than to %pc + number. */
85 static int m68k_abspcadd
;
87 /* If this is non-zero, then the quick forms of the move, add, and sub
88 instructions are used when possible. */
89 static int m68k_quick
= 1;
91 /* If this is non-zero, then if the size is not specified for a base
92 or outer displacement, the assembler assumes that the size should
94 static int m68k_rel32
= 1;
96 /* Its an arbitrary name: This means I don't approve of it */
97 /* See flames below */
98 static struct obstack robyn
;
100 #define TAB(x,y) (((x)<<2)+(y))
101 #define TABTYPE(xy) ((xy) >> 2)
107 /* Case `g' except when BCC68000 is applicable. */
109 /* Coprocessor branches. */
111 /* Mode 7.2 -- program counter indirect with (16-bit) displacement,
112 supported on all cpus. Widens to 32-bit absolute. */
114 /* For inserting an extra jmp instruction with long offset on 68000,
115 for expanding conditional branches. (Not bsr or bra.) Since the
116 68000 doesn't support 32-bit displacements for conditional
117 branches, we fake it by reversing the condition and branching
118 around a jmp with an absolute long operand. */
120 /* For the DBcc "instructions". If the displacement requires 32 bits,
121 the branch-around-a-jump game is played here too. */
123 /* Not currently used? */
125 /* Mode AINDX (apc-relative) using PC, with variable target, might fit
131 const char *m_operands
;
132 unsigned long m_opcode
;
136 struct m68k_incant
*m_next
;
139 #define getone(x) ((((x)->m_opcode)>>16)&0xffff)
140 #define gettwo(x) (((x)->m_opcode)&0xffff)
142 static const enum m68k_register m68000_control_regs
[] = { 0 };
143 static const enum m68k_register m68010_control_regs
[] = {
147 static const enum m68k_register m68020_control_regs
[] = {
148 SFC
, DFC
, USP
, VBR
, CACR
, CAAR
, MSP
, ISP
,
151 static const enum m68k_register m68040_control_regs
[] = {
152 SFC
, DFC
, CACR
, TC
, ITT0
, ITT1
, DTT0
, DTT1
,
153 USP
, VBR
, MSP
, ISP
, MMUSR
, URP
, SRP
,
156 static const enum m68k_register m68060_control_regs
[] = {
157 SFC
, DFC
, CACR
, TC
, ITT0
, ITT1
, DTT0
, DTT1
, BUSCR
,
158 USP
, VBR
, URP
, SRP
, PCR
,
161 #define cpu32_control_regs m68010_control_regs
163 static const enum m68k_register
*control_regs
;
165 /* internal form of a 68020 instruction */
169 const char *args
; /* list of opcode info */
172 int numo
; /* Number of shorts in opcode */
175 struct m68k_op operands
[6];
177 int nexp
; /* number of exprs in use */
178 struct m68k_exp exprs
[4];
180 int nfrag
; /* Number of frags we have to produce */
183 int fragoff
; /* Where in the current opcode the frag ends */
190 int nrel
; /* Num of reloc strucs in use */
197 /* In a pc relative address the difference between the address
198 of the offset and the address that the offset is relative
199 to. This depends on the addressing mode. Basically this
200 is the value to put in the offset field to address the
201 first byte of the offset, without regarding the special
202 significance of some values (in the branch instruction, for
206 /* Whether this expression needs special pic relocation, and if
208 enum pic_relocation pic_reloc
;
211 reloc
[5]; /* Five is enough??? */
214 #define cpu_of_arch(x) ((x) & m68000up)
215 #define float_of_arch(x) ((x) & mfloat)
216 #define mmu_of_arch(x) ((x) & mmmu)
218 static struct m68k_it the_ins
; /* the instruction being assembled */
220 #define op(ex) ((ex)->exp.X_op)
221 #define adds(ex) ((ex)->exp.X_add_symbol)
222 #define subs(ex) ((ex)->exp.X_op_symbol)
223 #define offs(ex) ((ex)->exp.X_add_number)
225 /* Macros for adding things to the m68k_it struct */
227 #define addword(w) the_ins.opcode[the_ins.numo++]=(w)
229 /* Like addword, but goes BEFORE general operands */
233 struct m68k_incant
*opcode
;
236 for(z
=the_ins
.numo
;z
>opcode
->m_codenum
;--z
)
237 the_ins
.opcode
[z
]=the_ins
.opcode
[z
-1];
238 for(z
=0;z
<the_ins
.nrel
;z
++)
239 the_ins
.reloc
[z
].n
+=2;
240 for (z
= 0; z
< the_ins
.nfrag
; z
++)
241 the_ins
.fragb
[z
].fragoff
++;
242 the_ins
.opcode
[opcode
->m_codenum
]=w
;
246 /* The numo+1 kludge is so we can hit the low order byte of the prev word.
249 add_fix (width
, exp
, pc_rel
, pc_fix
)
251 struct m68k_exp
*exp
;
255 the_ins
.reloc
[the_ins
.nrel
].n
= (((width
)=='B')
259 : (the_ins
.numo
*2)));
260 the_ins
.reloc
[the_ins
.nrel
].exp
= exp
->exp
;
261 the_ins
.reloc
[the_ins
.nrel
].wid
= width
;
262 the_ins
.reloc
[the_ins
.nrel
].pcrel_fix
= pc_fix
;
264 the_ins
.reloc
[the_ins
.nrel
].pic_reloc
= exp
->pic_reloc
;
266 the_ins
.reloc
[the_ins
.nrel
++].pcrel
= pc_rel
;
269 /* Cause an extra frag to be generated here, inserting up to 10 bytes
270 (that value is chosen in the frag_var call in md_assemble). TYPE
271 is the subtype of the frag to be generated; its primary type is
272 rs_machine_dependent.
274 The TYPE parameter is also used by md_convert_frag_1 and
275 md_estimate_size_before_relax. The appropriate type of fixup will
276 be emitted by md_convert_frag_1.
278 ADD becomes the FR_SYMBOL field of the frag, and OFF the FR_OFFSET. */
280 add_frag(add
,off
,type
)
285 the_ins
.fragb
[the_ins
.nfrag
].fragoff
=the_ins
.numo
;
286 the_ins
.fragb
[the_ins
.nfrag
].fadd
=add
;
287 the_ins
.fragb
[the_ins
.nfrag
].foff
=off
;
288 the_ins
.fragb
[the_ins
.nfrag
++].fragty
=type
;
292 (op (ex) != O_constant && op (ex) != O_big)
294 static char *crack_operand
PARAMS ((char *str
, struct m68k_op
*opP
));
295 static int get_num
PARAMS ((struct m68k_exp
*exp
, int ok
));
296 static int reverse_16_bits
PARAMS ((int in
));
297 static int reverse_8_bits
PARAMS ((int in
));
298 static void install_gen_operand
PARAMS ((int mode
, int val
));
299 static void install_operand
PARAMS ((int mode
, int val
));
300 static void s_bss
PARAMS ((int));
301 static void s_data1
PARAMS ((int));
302 static void s_data2
PARAMS ((int));
303 static void s_even
PARAMS ((int));
304 static void s_proc
PARAMS ((int));
305 static void mri_chip
PARAMS ((void));
306 static void s_chip
PARAMS ((int));
307 static void s_fopt
PARAMS ((int));
308 static void s_opt
PARAMS ((int));
309 static void s_reg
PARAMS ((int));
310 static void s_restore
PARAMS ((int));
311 static void s_save
PARAMS ((int));
312 static void s_mri_if
PARAMS ((int));
313 static void s_mri_else
PARAMS ((int));
314 static void s_mri_endi
PARAMS ((int));
315 static void s_mri_break
PARAMS ((int));
316 static void s_mri_next
PARAMS ((int));
317 static void s_mri_for
PARAMS ((int));
318 static void s_mri_endf
PARAMS ((int));
319 static void s_mri_repeat
PARAMS ((int));
320 static void s_mri_until
PARAMS ((int));
321 static void s_mri_while
PARAMS ((int));
322 static void s_mri_endw
PARAMS ((int));
324 static int current_architecture
;
332 static const struct m68k_cpu archs
[] = {
333 { m68000
, "68000", 0 },
334 { m68010
, "68010", 0 },
335 { m68020
, "68020", 0 },
336 { m68030
, "68030", 0 },
337 { m68040
, "68040", 0 },
338 { m68060
, "68060", 0 },
339 { cpu32
, "cpu32", 0 },
340 { m68881
, "68881", 0 },
341 { m68851
, "68851", 0 },
342 /* Aliases (effectively, so far as gas is concerned) for the above
344 { m68020
, "68k", 1 },
345 { m68000
, "68302", 1 },
346 { m68000
, "68008", 1 },
347 { m68000
, "68ec000", 1 },
348 { m68000
, "68hc000", 1 },
349 { m68000
, "68hc001", 1 },
350 { m68020
, "68ec020", 1 },
351 { m68030
, "68ec030", 1 },
352 { m68040
, "68ec040", 1 },
353 { cpu32
, "68330", 1 },
354 { cpu32
, "68331", 1 },
355 { cpu32
, "68332", 1 },
356 { cpu32
, "68333", 1 },
357 { cpu32
, "68340", 1 },
358 { cpu32
, "68360", 1 },
359 { m68881
, "68882", 1 },
362 static const int n_archs
= sizeof (archs
) / sizeof (archs
[0]);
364 /* BCC68000 is for patching in an extra jmp instruction for long offsets
365 on the 68000. The 68000 doesn't support long branches with branchs */
367 /* This table desribes how you change sizes for the various types of variable
368 size expressions. This version only supports two kinds. */
370 /* Note that calls to frag_var need to specify the maximum expansion
371 needed; this is currently 10 bytes for DBCC. */
374 How far Forward this mode will reach:
375 How far Backward this mode will reach:
376 How many bytes this mode will add to the size of the frag
377 Which mode to go to if the offset won't fit in this one
379 relax_typeS md_relax_table
[] =
381 {1, 1, 0, 0}, /* First entries aren't used */
382 {1, 1, 0, 0}, /* For no good reason except */
383 {1, 1, 0, 0}, /* that the VAX doesn't either */
386 {(127), (-128), 0, TAB (ABRANCH
, SHORT
)},
387 {(32767), (-32768), 2, TAB (ABRANCH
, LONG
)},
391 {1, 1, 0, 0}, /* FBRANCH doesn't come BYTE */
392 {(32767), (-32768), 2, TAB (FBRANCH
, LONG
)},
396 {1, 1, 0, 0}, /* PCREL doesn't come BYTE */
397 {(32767), (-32768), 2, TAB (PCREL
, LONG
)},
401 {(127), (-128), 0, TAB (BCC68000
, SHORT
)},
402 {(32767), (-32768), 2, TAB (BCC68000
, LONG
)},
403 {0, 0, 6, 0}, /* jmp long space */
406 {1, 1, 0, 0}, /* DBCC doesn't come BYTE */
407 {(32767), (-32768), 2, TAB (DBCC
, LONG
)},
408 {0, 0, 10, 0}, /* bra/jmp long space */
411 {1, 1, 0, 0}, /* PCLEA doesn't come BYTE */
412 {32767, -32768, 2, TAB (PCLEA
, LONG
)},
416 /* For, e.g., jmp pcrel indexed. */
417 {125, -130, 0, TAB (PCINDEX
, SHORT
)},
418 {32765, -32770, 2, TAB (PCINDEX
, LONG
)},
423 /* These are the machine dependent pseudo-ops. These are included so
424 the assembler can work on the output from the SUN C compiler, which
428 /* This table describes all the machine specific pseudo-ops the assembler
429 has to support. The fields are:
430 pseudo-op name without dot
431 function to call to execute this pseudo-op
432 Integer arg to pass to the function
434 const pseudo_typeS md_pseudo_table
[] =
436 {"data1", s_data1
, 0},
437 {"data2", s_data2
, 0},
440 {"skip", s_space
, 0},
442 #if defined (TE_SUN3) || defined (OBJ_ELF)
443 {"align", s_align_bytes
, 0},
446 {"swbeg", s_ignore
, 0},
448 {"extend", float_cons
, 'x'},
449 {"ldouble", float_cons
, 'x'},
451 /* The following pseudo-ops are supported for MRI compatibility. */
453 {"comline", s_space
, 1},
455 {"mask2", s_ignore
, 0},
458 {"restore", s_restore
, 0},
462 {"if.b", s_mri_if
, 'b'},
463 {"if.w", s_mri_if
, 'w'},
464 {"if.l", s_mri_if
, 'l'},
465 {"else", s_mri_else
, 0},
466 {"else.s", s_mri_else
, 's'},
467 {"else.l", s_mri_else
, 'l'},
468 {"endi", s_mri_endi
, 0},
469 {"break", s_mri_break
, 0},
470 {"break.s", s_mri_break
, 's'},
471 {"break.l", s_mri_break
, 'l'},
472 {"next", s_mri_next
, 0},
473 {"next.s", s_mri_next
, 's'},
474 {"next.l", s_mri_next
, 'l'},
475 {"for", s_mri_for
, 0},
476 {"for.b", s_mri_for
, 'b'},
477 {"for.w", s_mri_for
, 'w'},
478 {"for.l", s_mri_for
, 'l'},
479 {"endf", s_mri_endf
, 0},
480 {"repeat", s_mri_repeat
, 0},
481 {"until", s_mri_until
, 0},
482 {"until.b", s_mri_until
, 'b'},
483 {"until.w", s_mri_until
, 'w'},
484 {"until.l", s_mri_until
, 'l'},
485 {"while", s_mri_while
, 0},
486 {"while.b", s_mri_while
, 'b'},
487 {"while.w", s_mri_while
, 'w'},
488 {"while.l", s_mri_while
, 'l'},
489 {"endw", s_mri_endw
, 0},
495 /* The mote pseudo ops are put into the opcode table, since they
496 don't start with a . they look like opcodes to gas.
498 extern void obj_coff_section ();
500 CONST pseudo_typeS mote_pseudo_table
[] =
513 {"xdef", s_globl
, 0},
515 {"align", s_align_bytes
, 0},
517 {"align", s_align_ptwo
, 0},
520 {"sect", obj_coff_section
, 0},
521 {"section", obj_coff_section
, 0},
526 #define issbyte(x) ((x)>=-128 && (x)<=127)
527 #define isubyte(x) ((x)>=0 && (x)<=255)
528 #define issword(x) ((x)>=-32768 && (x)<=32767)
529 #define isuword(x) ((x)>=0 && (x)<=65535)
531 #define isbyte(x) ((x)>= -255 && (x)<=255)
532 #define isword(x) ((x)>=-65536 && (x)<=65535)
533 #define islong(x) (1)
535 extern char *input_line_pointer
;
537 static char mklower_table
[256];
538 #define mklower(c) (mklower_table[(unsigned char)(c)])
539 static char notend_table
[256];
540 static char alt_notend_table
[256];
542 (! (notend_table[(unsigned char) *s] \
544 && alt_notend_table[(unsigned char) s[1]])))
546 #if defined (M68KCOFF) && !defined (BFD_ASSEMBLER)
548 #ifdef NO_PCREL_RELOCS
551 make_pcrel_absolute(fixP
, add_number
)
555 register unsigned char *opcode
= fixP
->fx_frag
->fr_opcode
;
557 /* rewrite the PC relative instructions to absolute address ones.
558 * these are rumoured to be faster, and the apollo linker refuses
559 * to deal with the PC relative relocations.
561 if (opcode
[0] == 0x60 && opcode
[1] == 0xff) /* BRA -> JMP */
566 else if (opcode
[0] == 0x61 && opcode
[1] == 0xff) /* BSR -> JSR */
572 as_fatal ("Unknown PC relative instruction");
577 #endif /* NO_PCREL_RELOCS */
580 tc_coff_fix2rtype (fixP
)
583 if (fixP
->fx_tcbit
&& fixP
->fx_size
== 4)
584 return R_RELLONG_NEG
;
585 #ifdef NO_PCREL_RELOCS
586 know (fixP
->fx_pcrel
== 0);
587 return (fixP
->fx_size
== 1 ? R_RELBYTE
588 : fixP
->fx_size
== 2 ? R_DIR16
591 return (fixP
->fx_pcrel
?
592 (fixP
->fx_size
== 1 ? R_PCRBYTE
:
593 fixP
->fx_size
== 2 ? R_PCRWORD
:
595 (fixP
->fx_size
== 1 ? R_RELBYTE
:
596 fixP
->fx_size
== 2 ? R_RELWORD
:
605 /* Compute the relocation code for a fixup of SIZE bytes, using pc
606 relative relocation if PCREL is non-zero. PIC says whether a special
607 pic relocation was requested. */
609 static bfd_reloc_code_real_type get_reloc_code
610 PARAMS ((int, int, enum pic_relocation
));
612 static bfd_reloc_code_real_type
613 get_reloc_code (size
, pcrel
, pic
)
616 enum pic_relocation pic
;
624 return BFD_RELOC_8_GOT_PCREL
;
626 return BFD_RELOC_16_GOT_PCREL
;
628 return BFD_RELOC_32_GOT_PCREL
;
636 return BFD_RELOC_8_GOTOFF
;
638 return BFD_RELOC_16_GOTOFF
;
640 return BFD_RELOC_32_GOTOFF
;
648 return BFD_RELOC_8_PLT_PCREL
;
650 return BFD_RELOC_16_PLT_PCREL
;
652 return BFD_RELOC_32_PLT_PCREL
;
660 return BFD_RELOC_8_PLTOFF
;
662 return BFD_RELOC_16_PLTOFF
;
664 return BFD_RELOC_32_PLTOFF
;
674 return BFD_RELOC_8_PCREL
;
676 return BFD_RELOC_16_PCREL
;
678 return BFD_RELOC_32_PCREL
;
695 as_bad ("Can not do %d byte %s%srelocation", size
,
696 pcrel
? "pc-relative " : "",
697 pic
== pic_none
? "" : "pic ");
698 return BFD_RELOC_NONE
;
701 /* Here we decide which fixups can be adjusted to make them relative
702 to the beginning of the section instead of the symbol. Basically
703 we need to make sure that the dynamic relocations are done
704 correctly, so in some cases we force the original symbol to be
707 tc_m68k_fix_adjustable (fixP
)
710 /* Prevent all adjustments to global symbols. */
711 if (S_IS_EXTERNAL (fixP
->fx_addsy
))
714 /* adjust_reloc_syms doesn't know about the GOT */
715 switch (fixP
->fx_r_type
)
717 case BFD_RELOC_8_GOT_PCREL
:
718 case BFD_RELOC_16_GOT_PCREL
:
719 case BFD_RELOC_32_GOT_PCREL
:
720 case BFD_RELOC_8_GOTOFF
:
721 case BFD_RELOC_16_GOTOFF
:
722 case BFD_RELOC_32_GOTOFF
:
723 case BFD_RELOC_8_PLT_PCREL
:
724 case BFD_RELOC_16_PLT_PCREL
:
725 case BFD_RELOC_32_PLT_PCREL
:
726 case BFD_RELOC_8_PLTOFF
:
727 case BFD_RELOC_16_PLTOFF
:
728 case BFD_RELOC_32_PLTOFF
:
738 #define get_reloc_code(SIZE,PCREL,OTHER) NO_RELOC
745 tc_gen_reloc (section
, fixp
)
750 bfd_reloc_code_real_type code
;
755 if (fixp
->fx_r_type
!= BFD_RELOC_NONE
)
756 code
= fixp
->fx_r_type
;
759 #define F(SZ,PCREL) (((SZ) << 1) + (PCREL))
760 switch (F (fixp
->fx_size
, fixp
->fx_pcrel
))
762 #define MAP(SZ,PCREL,TYPE) case F(SZ,PCREL): code = (TYPE); break
763 MAP (1, 0, BFD_RELOC_8
);
764 MAP (2, 0, BFD_RELOC_16
);
765 MAP (4, 0, BFD_RELOC_32
);
766 MAP (1, 1, BFD_RELOC_8_PCREL
);
767 MAP (2, 1, BFD_RELOC_16_PCREL
);
768 MAP (4, 1, BFD_RELOC_32_PCREL
);
776 reloc
= (arelent
*) bfd_alloc_by_size_t (stdoutput
, sizeof (arelent
));
778 reloc
->sym_ptr_ptr
= &fixp
->fx_addsy
->bsym
;
779 reloc
->address
= fixp
->fx_frag
->fr_address
+ fixp
->fx_where
;
782 reloc
->addend
= fixp
->fx_addnumber
;
787 reloc
->addend
= fixp
->fx_addnumber
;
788 else if ((fixp
->fx_addsy
->bsym
->flags
& BSF_SECTION_SYM
) != 0)
789 reloc
->addend
= (section
->vma
790 + (fixp
->fx_pcrel_adjust
== 64
791 ? -1 : fixp
->fx_pcrel_adjust
)
793 + md_pcrel_from (fixp
));
795 reloc
->addend
= (fixp
->fx_offset
796 + (fixp
->fx_pcrel_adjust
== 64
797 ? -1 : fixp
->fx_pcrel_adjust
));
800 reloc
->howto
= bfd_reloc_type_lookup (stdoutput
, code
);
801 assert (reloc
->howto
!= 0);
806 #endif /* BFD_ASSEMBLER */
808 /* Handle of the OPCODE hash table. NULL means any use before
809 m68k_ip_begin() will crash. */
810 static struct hash_control
*op_hash
;
812 /* Assemble an m68k instruction. */
819 register struct m68k_op
*opP
;
820 register struct m68k_incant
*opcode
;
821 register const char *s
;
822 register int tmpreg
= 0, baseo
= 0, outro
= 0, nextword
;
823 char *pdot
, *pdotmove
;
824 enum m68k_size siz1
, siz2
;
828 char *crack_operand ();
829 LITTLENUM_TYPE words
[6];
830 LITTLENUM_TYPE
*wordp
;
831 unsigned long ok_arch
= 0;
833 if (*instring
== ' ')
834 instring
++; /* skip leading whitespace */
836 /* Scan up to end of operation-code, which MUST end in end-of-string
837 or exactly 1 space. */
839 for (p
= instring
; *p
!= '\0'; p
++)
849 the_ins
.error
= "No operator";
853 /* p now points to the end of the opcode name, probably whitespace.
854 Make sure the name is null terminated by clobbering the
855 whitespace, look it up in the hash table, then fix it back.
856 Remove a dot, first, since the opcode tables have none. */
859 for (pdotmove
= pdot
; pdotmove
< p
; pdotmove
++)
860 *pdotmove
= pdotmove
[1];
866 opcode
= (struct m68k_incant
*) hash_find (op_hash
, instring
);
871 for (pdotmove
= p
; pdotmove
> pdot
; pdotmove
--)
872 *pdotmove
= pdotmove
[-1];
879 the_ins
.error
= "Unknown operator";
883 /* found a legitimate opcode, start matching operands */
887 if (opcode
->m_operands
== 0)
889 char *old
= input_line_pointer
;
891 input_line_pointer
= p
;
892 /* Ahh - it's a motorola style psuedo op */
893 mote_pseudo_table
[opcode
->m_opnum
].poc_handler
894 (mote_pseudo_table
[opcode
->m_opnum
].poc_val
);
895 input_line_pointer
= old
;
901 if (flag_mri
&& opcode
->m_opnum
== 0)
903 /* In MRI mode, random garbage is allowed after an instruction
904 which accepts no operands. */
905 the_ins
.args
= opcode
->m_operands
;
906 the_ins
.numargs
= opcode
->m_opnum
;
907 the_ins
.numo
= opcode
->m_codenum
;
908 the_ins
.opcode
[0] = getone (opcode
);
909 the_ins
.opcode
[1] = gettwo (opcode
);
913 for (opP
= &the_ins
.operands
[0]; *p
; opP
++)
915 p
= crack_operand (p
, opP
);
919 the_ins
.error
= opP
->error
;
924 opsfound
= opP
- &the_ins
.operands
[0];
926 /* This ugly hack is to support the floating pt opcodes in their
927 standard form. Essentially, we fake a first enty of type COP#1 */
928 if (opcode
->m_operands
[0] == 'I')
932 for (n
= opsfound
; n
> 0; --n
)
933 the_ins
.operands
[n
] = the_ins
.operands
[n
- 1];
935 memset ((char *) (&the_ins
.operands
[0]), '\0',
936 sizeof (the_ins
.operands
[0]));
937 the_ins
.operands
[0].mode
= CONTROL
;
938 the_ins
.operands
[0].reg
= m68k_float_copnum
;
942 /* We've got the operands. Find an opcode that'll accept them */
945 /* If we didn't get the right number of ops, or we have no
946 common model with this pattern then reject this pattern. */
948 if (opsfound
!= opcode
->m_opnum
949 || ((opcode
->m_arch
& current_architecture
) == 0))
952 ok_arch
|= opcode
->m_arch
;
956 for (s
= opcode
->m_operands
, opP
= &the_ins
.operands
[0];
960 /* Warning: this switch is huge! */
961 /* I've tried to organize the cases into this order:
962 non-alpha first, then alpha by letter. Lower-case
963 goes directly before uppercase counterpart. */
964 /* Code with multiple case ...: gets sorted by the lowest
965 case ... it belongs to. I hope this makes sense. */
1005 if (opP
->mode
!= IMMED
)
1007 else if (s
[1] == 'b'
1008 && ! isvar (&opP
->disp
)
1009 && (opP
->disp
.exp
.X_op
!= O_constant
1010 || ! isbyte (opP
->disp
.exp
.X_add_number
)))
1012 else if (s
[1] == 'w'
1013 && ! isvar (&opP
->disp
)
1014 && (opP
->disp
.exp
.X_op
!= O_constant
1015 || ! isword (opP
->disp
.exp
.X_add_number
)))
1017 else if (s
[1] == 'W'
1018 && ! isvar (&opP
->disp
)
1019 && (opP
->disp
.exp
.X_op
!= O_constant
1020 || ! issword (opP
->disp
.exp
.X_add_number
)))
1026 if (opP
->mode
!= IMMED
)
1031 if (opP
->mode
== AREG
1032 || opP
->mode
== CONTROL
1033 || opP
->mode
== FPREG
1034 || opP
->mode
== IMMED
1035 || opP
->mode
== REGLST
1036 || (opP
->mode
!= ABSL
1038 || opP
->reg
== ZPC
)))
1043 if (opP
->mode
== CONTROL
1044 || opP
->mode
== FPREG
1045 || opP
->mode
== REGLST
1046 || opP
->mode
== IMMED
1047 || (opP
->mode
!= ABSL
1049 || opP
->reg
== ZPC
)))
1077 if (opP
->mode
== CONTROL
1078 || opP
->mode
== FPREG
1079 || opP
->mode
== REGLST
)
1084 if (opP
->mode
!= AINC
)
1089 if (opP
->mode
!= ADEC
)
1139 if (opP
->reg
== PC
|| opP
->reg
== ZPC
)
1160 case '~': /* For now! (JF FOO is this right?) */
1182 if (opP
->mode
!= CONTROL
1183 || (opP
->reg
!= TT0
&& opP
->reg
!= TT1
))
1188 if (opP
->mode
!= AREG
)
1193 if (opP
->mode
!= AINDR
)
1198 if (opP
->mode
!= ABSL
1200 && strncmp (instring
, "jbsr", 4) == 0))
1205 if (opP
->mode
!= CONTROL
|| opP
->reg
!= CCR
)
1210 if (opP
->mode
!= DISP
1212 || opP
->reg
> ADDR7
)
1217 if (opP
->mode
!= DREG
)
1222 if (opP
->mode
!= FPREG
)
1227 if (opP
->mode
!= CONTROL
1234 if (opP
->mode
!= CONTROL
1236 || opP
->reg
> last_movec_reg
)
1240 const enum m68k_register
*rp
;
1241 for (rp
= control_regs
; *rp
; rp
++)
1242 if (*rp
== opP
->reg
)
1250 if (opP
->mode
!= IMMED
)
1256 if (opP
->mode
== DREG
1257 || opP
->mode
== AREG
1258 || opP
->mode
== FPREG
)
1267 opP
->mask
= 1 << (opP
->reg
- DATA0
);
1270 opP
->mask
= 1 << (opP
->reg
- ADDR0
+ 8);
1273 opP
->mask
= 1 << (opP
->reg
- FP0
+ 16);
1281 else if (opP
->mode
== CONTROL
)
1290 opP
->mask
= 1 << 24;
1293 opP
->mask
= 1 << 25;
1296 opP
->mask
= 1 << 26;
1305 else if (opP
->mode
== ABSL
1306 && opP
->disp
.size
== SIZE_UNSPEC
1307 && opP
->disp
.exp
.X_op
== O_constant
)
1309 /* This is what the MRI REG pseudo-op generates. */
1311 opP
->mask
= opP
->disp
.exp
.X_add_number
;
1313 else if (opP
->mode
!= REGLST
)
1315 else if (s
[1] == '8' && (opP
->mask
& 0x0ffffff) != 0)
1317 else if (s
[1] == '3' && (opP
->mask
& 0x7000000) != 0)
1322 if (opP
->mode
!= IMMED
)
1324 else if (opP
->disp
.exp
.X_op
!= O_constant
1325 || ! issbyte (opP
->disp
.exp
.X_add_number
))
1327 else if (! m68k_quick
1328 && instring
[3] != 'q'
1329 && instring
[4] != 'q')
1334 if (opP
->mode
!= DREG
&& opP
->mode
!= IMMED
)
1339 if (opP
->mode
!= IMMED
)
1341 else if (opP
->disp
.exp
.X_op
!= O_constant
1342 || opP
->disp
.exp
.X_add_number
< 1
1343 || opP
->disp
.exp
.X_add_number
> 8)
1345 else if (! m68k_quick
1346 && (strncmp (instring
, "add", 3) == 0
1347 || strncmp (instring
, "sub", 3) == 0)
1348 && instring
[3] != 'q')
1353 if (opP
->mode
!= DREG
&& opP
->mode
!= AREG
)
1358 if (opP
->mode
!= AINDR
1359 && (opP
->mode
!= BASE
1361 && opP
->reg
!= ZADDR0
)
1362 || opP
->disp
.exp
.X_op
!= O_absent
1363 || ((opP
->index
.reg
< DATA0
1364 || opP
->index
.reg
> DATA7
)
1365 && (opP
->index
.reg
< ADDR0
1366 || opP
->index
.reg
> ADDR7
))
1367 || opP
->index
.size
!= SIZE_UNSPEC
1368 || opP
->index
.scale
!= 1))
1373 if (opP
->mode
!= CONTROL
1374 || ! (opP
->reg
== FPI
1376 || opP
->reg
== FPC
))
1381 if (opP
->mode
!= CONTROL
|| opP
->reg
!= SR
)
1386 if (opP
->mode
!= IMMED
)
1388 else if (opP
->disp
.exp
.X_op
!= O_constant
1389 || opP
->disp
.exp
.X_add_number
< 0
1390 || opP
->disp
.exp
.X_add_number
> 7)
1395 if (opP
->mode
!= CONTROL
|| opP
->reg
!= USP
)
1399 /* JF these are out of order. We could put them
1400 in order if we were willing to put up with
1401 bunches of #ifdef m68851s in the code.
1403 Don't forget that you need these operands
1404 to use 68030 MMU instructions. */
1406 /* Memory addressing mode used by pflushr */
1408 if (opP
->mode
== CONTROL
1409 || opP
->mode
== FPREG
1410 || opP
->mode
== DREG
1411 || opP
->mode
== AREG
1412 || opP
->mode
== REGLST
)
1414 /* We should accept immediate operands, but they
1415 supposedly have to be quad word, and we don't
1416 handle that. I would like to see what a Motorola
1417 assembler does before doing something here. */
1418 if (opP
->mode
== IMMED
)
1423 if (opP
->mode
!= CONTROL
1424 || (opP
->reg
!= SFC
&& opP
->reg
!= DFC
))
1429 if (opP
->mode
!= CONTROL
|| opP
->reg
!= TC
)
1434 if (opP
->mode
!= CONTROL
|| opP
->reg
!= AC
)
1439 if (opP
->mode
!= CONTROL
1442 && opP
->reg
!= SCC
))
1447 if (opP
->mode
!= CONTROL
1453 if (opP
->mode
!= CONTROL
1456 && opP
->reg
!= CRP
))
1461 if (opP
->mode
!= CONTROL
1462 || (!(opP
->reg
>= BAD
&& opP
->reg
<= BAD
+ 7)
1463 && !(opP
->reg
>= BAC
&& opP
->reg
<= BAC
+ 7)))
1468 if (opP
->mode
!= CONTROL
|| opP
->reg
!= PSR
)
1473 if (opP
->mode
!= CONTROL
|| opP
->reg
!= PCSR
)
1478 if (opP
->mode
!= CONTROL
1485 } /* not a cache specifier. */
1489 if (opP
->mode
!= ABSL
)
1495 } /* switch on type of operand */
1499 } /* for each operand */
1500 } /* if immediately wrong */
1507 opcode
= opcode
->m_next
;
1512 && !(ok_arch
& current_architecture
))
1517 "invalid instruction for this architecture; needs ");
1518 cp
= buf
+ strlen (buf
);
1522 strcpy (cp
, "fpu (68040, 68060 or 68881/68882)");
1525 strcpy (cp
, "mmu (68030 or 68851)");
1528 strcpy (cp
, "68020 or higher");
1531 strcpy (cp
, "68000 or higher");
1534 strcpy (cp
, "68010 or higher");
1538 int got_one
= 0, idx
;
1539 for (idx
= 0; idx
< sizeof (archs
) / sizeof (archs
[0]);
1542 if ((archs
[idx
].arch
& ok_arch
)
1543 && ! archs
[idx
].alias
)
1547 strcpy (cp
, " or ");
1551 strcpy (cp
, archs
[idx
].name
);
1563 the_ins
.error
= "operands mismatch";
1565 } /* Fell off the end */
1570 /* now assemble it */
1572 the_ins
.args
= opcode
->m_operands
;
1573 the_ins
.numargs
= opcode
->m_opnum
;
1574 the_ins
.numo
= opcode
->m_codenum
;
1575 the_ins
.opcode
[0] = getone (opcode
);
1576 the_ins
.opcode
[1] = gettwo (opcode
);
1578 for (s
= the_ins
.args
, opP
= &the_ins
.operands
[0]; *s
; s
+= 2, opP
++)
1580 /* This switch is a doozy.
1581 Watch the first step; its a big one! */
1602 tmpreg
= 0x3c; /* 7.4 */
1603 if (strchr ("bwl", s
[1]))
1604 nextword
= get_num (&opP
->disp
, 80);
1606 nextword
= get_num (&opP
->disp
, 0);
1607 if (isvar (&opP
->disp
))
1608 add_fix (s
[1], &opP
->disp
, 0, 0);
1612 if (!isbyte (nextword
))
1613 opP
->error
= "operand out of range";
1618 if (!isword (nextword
))
1619 opP
->error
= "operand out of range";
1624 if (!issword (nextword
))
1625 opP
->error
= "operand out of range";
1630 addword (nextword
>> 16);
1657 /* We gotta put out some float */
1658 if (op (&opP
->disp
) != O_big
)
1663 /* Can other cases happen here? */
1664 if (op (&opP
->disp
) != O_constant
)
1667 val
= (valueT
) offs (&opP
->disp
);
1671 generic_bignum
[gencnt
] = (LITTLENUM_TYPE
) val
;
1672 val
>>= LITTLENUM_NUMBER_OF_BITS
;
1676 offs (&opP
->disp
) = gencnt
;
1678 if (offs (&opP
->disp
) > 0)
1680 if (offs (&opP
->disp
) > baseo
)
1682 as_warn ("Bignum too big for %c format; truncated",
1684 offs (&opP
->disp
) = baseo
;
1686 baseo
-= offs (&opP
->disp
);
1689 for (wordp
= generic_bignum
+ offs (&opP
->disp
) - 1;
1690 offs (&opP
->disp
)--;
1695 gen_to_words (words
, baseo
, (long) outro
);
1696 for (wordp
= words
; baseo
--; wordp
++)
1700 tmpreg
= opP
->reg
- DATA
; /* 0.dreg */
1703 tmpreg
= 0x08 + opP
->reg
- ADDR
; /* 1.areg */
1706 tmpreg
= 0x10 + opP
->reg
- ADDR
; /* 2.areg */
1709 tmpreg
= 0x20 + opP
->reg
- ADDR
; /* 4.areg */
1712 tmpreg
= 0x18 + opP
->reg
- ADDR
; /* 3.areg */
1716 nextword
= get_num (&opP
->disp
, 80);
1719 && ! isvar (&opP
->disp
)
1722 opP
->disp
.exp
.X_op
= O_symbol
;
1723 #ifndef BFD_ASSEMBLER
1724 opP
->disp
.exp
.X_add_symbol
= &abs_symbol
;
1726 opP
->disp
.exp
.X_add_symbol
=
1727 section_symbol (absolute_section
);
1731 /* Force into index mode. Hope this works */
1733 /* We do the first bit for 32-bit displacements, and the
1734 second bit for 16 bit ones. It is possible that we
1735 should make the default be WORD instead of LONG, but
1736 I think that'd break GCC, so we put up with a little
1737 inefficiency for the sake of working output. */
1739 if (!issword (nextword
)
1740 || (isvar (&opP
->disp
)
1741 && ((opP
->disp
.size
== SIZE_UNSPEC
1742 && flag_short_refs
== 0
1743 && cpu_of_arch (current_architecture
) >= m68020
)
1744 || opP
->disp
.size
== SIZE_LONG
)))
1746 if (cpu_of_arch (current_architecture
) < m68020
)
1748 "displacement too large for this architecture; needs 68020 or higher";
1750 tmpreg
= 0x3B; /* 7.3 */
1752 tmpreg
= 0x30 + opP
->reg
- ADDR
; /* 6.areg */
1753 if (isvar (&opP
->disp
))
1757 if (opP
->disp
.size
== SIZE_LONG
1759 /* If the displacement needs pic
1760 relocation it cannot be relaxed. */
1761 || opP
->disp
.pic_reloc
!= pic_none
1766 add_fix ('l', &opP
->disp
, 1, 2);
1770 add_frag (adds (&opP
->disp
),
1772 TAB (PCLEA
, SZ_UNDEF
));
1779 add_fix ('l', &opP
->disp
, 0, 0);
1784 addword (nextword
>> 16);
1789 tmpreg
= 0x3A; /* 7.2 */
1791 tmpreg
= 0x28 + opP
->reg
- ADDR
; /* 5.areg */
1793 if (isvar (&opP
->disp
))
1797 add_fix ('w', &opP
->disp
, 1, 0);
1800 add_fix ('w', &opP
->disp
, 0, 0);
1810 baseo
= get_num (&opP
->disp
, 80);
1811 if (opP
->mode
== POST
|| opP
->mode
== PRE
)
1812 outro
= get_num (&opP
->odisp
, 80);
1813 /* Figure out the `addressing mode'.
1814 Also turn on the BASE_DISABLE bit, if needed. */
1815 if (opP
->reg
== PC
|| opP
->reg
== ZPC
)
1817 tmpreg
= 0x3b; /* 7.3 */
1818 if (opP
->reg
== ZPC
)
1821 else if (opP
->reg
== 0)
1824 tmpreg
= 0x30; /* 6.garbage */
1826 else if (opP
->reg
>= ZADDR0
&& opP
->reg
<= ZADDR7
)
1829 tmpreg
= 0x30 + opP
->reg
- ZADDR0
;
1832 tmpreg
= 0x30 + opP
->reg
- ADDR
; /* 6.areg */
1834 siz1
= opP
->disp
.size
;
1835 if (opP
->mode
== POST
|| opP
->mode
== PRE
)
1836 siz2
= opP
->odisp
.size
;
1840 /* Index register stuff */
1841 if (opP
->index
.reg
!= 0
1842 && opP
->index
.reg
>= DATA
1843 && opP
->index
.reg
<= ADDR7
)
1845 nextword
|= (opP
->index
.reg
- DATA
) << 12;
1847 if (opP
->index
.size
== SIZE_UNSPEC
1848 || opP
->index
.size
== SIZE_LONG
)
1851 if (cpu_of_arch (current_architecture
) < m68020
)
1853 if (opP
->index
.scale
!= 1)
1856 "scale factor invalid on this architecture; needs 68020 or higher";
1860 switch (opP
->index
.scale
)
1877 GET US OUT OF HERE! */
1879 /* Must be INDEX, with an index register. Address
1880 register cannot be ZERO-PC, and either :b was
1881 forced, or we know it will fit. For a 68000 or
1882 68010, force this mode anyways, because the
1883 larger modes aren't supported. */
1884 if (opP
->mode
== BASE
1885 && ((opP
->reg
>= ADDR0
1886 && opP
->reg
<= ADDR7
)
1889 if (siz1
== SIZE_BYTE
1890 || cpu_of_arch (current_architecture
) < m68020
1891 || (siz1
== SIZE_UNSPEC
1892 && ! isvar (&opP
->disp
)
1893 && issbyte (baseo
)))
1895 nextword
+= baseo
& 0xff;
1897 if (isvar (&opP
->disp
))
1899 /* Do a byte relocation. If it doesn't
1900 fit (possible on m68000) let the
1901 fixup processing complain later. */
1903 add_fix ('B', &opP
->disp
, 1, 1);
1905 add_fix ('B', &opP
->disp
, 0, 0);
1907 else if (siz1
!= SIZE_BYTE
)
1909 if (siz1
!= SIZE_UNSPEC
)
1910 as_warn ("Forcing byte displacement");
1911 if (! issbyte (baseo
))
1912 opP
->error
= "byte displacement out of range";
1917 else if (siz1
== SIZE_UNSPEC
1919 && isvar (&opP
->disp
)
1920 && subs (&opP
->disp
) == NULL
1922 /* If the displacement needs pic
1923 relocation it cannot be relaxed. */
1924 && opP
->disp
.pic_reloc
== pic_none
1928 nextword
+= baseo
& 0xff;
1930 add_frag (adds (&opP
->disp
), offs (&opP
->disp
),
1931 TAB (PCINDEX
, SZ_UNDEF
));
1939 nextword
|= 0x40; /* No index reg */
1940 if (opP
->index
.reg
>= ZDATA0
1941 && opP
->index
.reg
<= ZDATA7
)
1942 nextword
|= (opP
->index
.reg
- ZDATA0
) << 12;
1943 else if (opP
->index
.reg
>= ZADDR0
1944 || opP
->index
.reg
<= ZADDR7
)
1945 nextword
|= (opP
->index
.reg
- ZADDR0
+ 8) << 12;
1948 /* It isn't simple. */
1950 if (cpu_of_arch (current_architecture
) < m68020
)
1952 "invalid operand mode for this architecture; needs 68020 or higher";
1955 /* If the guy specified a width, we assume that it is
1956 wide enough. Maybe it isn't. If so, we lose. */
1960 if (isvar (&opP
->disp
)
1962 : ! issword (baseo
))
1967 else if (! isvar (&opP
->disp
) && baseo
== 0)
1976 as_warn (":b not permitted; defaulting to :w");
1986 /* Figure out innner displacement stuff */
1987 if (opP
->mode
== POST
|| opP
->mode
== PRE
)
1992 if (isvar (&opP
->odisp
)
1994 : ! issword (outro
))
1999 else if (! isvar (&opP
->odisp
) && outro
== 0)
2008 as_warn (":b not permitted; defaulting to :w");
2017 if (opP
->mode
== POST
2018 && (nextword
& 0x40) == 0)
2023 if (siz1
!= SIZE_UNSPEC
&& isvar (&opP
->disp
))
2025 if (opP
->reg
== PC
|| opP
->reg
== ZPC
)
2026 add_fix (siz1
== SIZE_LONG
? 'l' : 'w', &opP
->disp
, 1, 2);
2028 add_fix (siz1
== SIZE_LONG
? 'l' : 'w', &opP
->disp
, 0, 0);
2030 if (siz1
== SIZE_LONG
)
2031 addword (baseo
>> 16);
2032 if (siz1
!= SIZE_UNSPEC
)
2035 if (siz2
!= SIZE_UNSPEC
&& isvar (&opP
->odisp
))
2036 add_fix (siz2
== SIZE_LONG
? 'l' : 'w', &opP
->odisp
, 0, 0);
2037 if (siz2
== SIZE_LONG
)
2038 addword (outro
>> 16);
2039 if (siz2
!= SIZE_UNSPEC
)
2045 nextword
= get_num (&opP
->disp
, 80);
2046 switch (opP
->disp
.size
)
2051 if (!isvar (&opP
->disp
) && issword (offs (&opP
->disp
)))
2053 tmpreg
= 0x38; /* 7.0 */
2057 /* Don't generate pc relative code on 68010 and
2059 if (isvar (&opP
->disp
)
2060 && !subs (&opP
->disp
)
2061 && adds (&opP
->disp
)
2063 /* If the displacement needs pic relocation it
2064 cannot be relaxed. */
2065 && opP
->disp
.pic_reloc
== pic_none
2067 && S_GET_SEGMENT (adds (&opP
->disp
)) == now_seg
2068 && cpu_of_arch (current_architecture
) >= m68020
2070 && !strchr ("~%&$?", s
[0]))
2072 tmpreg
= 0x3A; /* 7.2 */
2073 add_frag (adds (&opP
->disp
),
2075 TAB (PCREL
, SZ_UNDEF
));
2078 /* Fall through into long */
2080 if (isvar (&opP
->disp
))
2081 add_fix ('l', &opP
->disp
, 0, 0);
2083 tmpreg
= 0x39;/* 7.1 mode */
2084 addword (nextword
>> 16);
2088 case SIZE_WORD
: /* Word */
2089 if (isvar (&opP
->disp
))
2090 add_fix ('w', &opP
->disp
, 0, 0);
2092 tmpreg
= 0x38;/* 7.0 mode */
2100 as_bad ("unknown/incorrect operand");
2103 install_gen_operand (s
[1], tmpreg
);
2109 { /* JF: I hate floating point! */
2124 tmpreg
= get_num (&opP
->disp
, tmpreg
);
2125 if (isvar (&opP
->disp
))
2126 add_fix (s
[1], &opP
->disp
, 0, 0);
2129 case 'b': /* Danger: These do no check for
2130 certain types of overflow.
2132 if (!isbyte (tmpreg
))
2133 opP
->error
= "out of range";
2134 insop (tmpreg
, opcode
);
2135 if (isvar (&opP
->disp
))
2136 the_ins
.reloc
[the_ins
.nrel
- 1].n
=
2137 (opcode
->m_codenum
) * 2 + 1;
2140 if (!isword (tmpreg
))
2141 opP
->error
= "out of range";
2142 insop (tmpreg
, opcode
);
2143 if (isvar (&opP
->disp
))
2144 the_ins
.reloc
[the_ins
.nrel
- 1].n
= (opcode
->m_codenum
) * 2;
2147 if (!issword (tmpreg
))
2148 opP
->error
= "out of range";
2149 insop (tmpreg
, opcode
);
2150 if (isvar (&opP
->disp
))
2151 the_ins
.reloc
[the_ins
.nrel
- 1].n
= (opcode
->m_codenum
) * 2;
2154 /* Because of the way insop works, we put these two out
2156 insop (tmpreg
, opcode
);
2157 insop (tmpreg
>> 16, opcode
);
2158 if (isvar (&opP
->disp
))
2159 the_ins
.reloc
[the_ins
.nrel
- 1].n
= (opcode
->m_codenum
) * 2;
2165 install_operand (s
[1], tmpreg
);
2176 install_operand (s
[1], opP
->reg
- ADDR
);
2180 tmpreg
= get_num (&opP
->disp
, 80);
2184 /* The pc_fix argument winds up in fx_pcrel_adjust,
2185 which is a char, and may therefore be unsigned. We
2186 want to pass -1, but we pass 64 instead, and convert
2187 back in md_pcrel_from. */
2188 add_fix ('B', &opP
->disp
, 1, 64);
2191 add_fix ('w', &opP
->disp
, 1, 0);
2196 if (cpu_of_arch (current_architecture
) < m68020
)
2197 as_warn ("Can't use long branches on 68000/68010");
2198 the_ins
.opcode
[the_ins
.numo
- 1] |= 0xff;
2199 add_fix ('l', &opP
->disp
, 1, 0);
2204 if (subs (&opP
->disp
)) /* We can't relax it */
2208 /* If the displacement needs pic relocation it cannot be
2210 if (opP
->disp
.pic_reloc
!= pic_none
)
2214 /* This could either be a symbol, or an absolute
2215 address. No matter, the frag hacking will finger it
2216 out. Not quite: it can't switch from BRANCH to
2217 BCC68000 for the case where opnd is absolute (it
2218 needs to use the 68000 hack since no conditional abs
2220 if (((cpu_of_arch (current_architecture
) < m68020
)
2221 || (0 == adds (&opP
->disp
)))
2222 && (the_ins
.opcode
[0] >= 0x6200)
2223 && (the_ins
.opcode
[0] <= 0x6f00))
2224 add_frag (adds (&opP
->disp
), offs (&opP
->disp
),
2225 TAB (BCC68000
, SZ_UNDEF
));
2227 add_frag (adds (&opP
->disp
), offs (&opP
->disp
),
2228 TAB (ABRANCH
, SZ_UNDEF
));
2231 if (isvar (&opP
->disp
))
2234 /* check for DBcc instruction */
2235 if ((the_ins
.opcode
[0] & 0xf0f8) == 0x50c8)
2237 /* size varies if patch */
2238 /* needed for long form */
2239 add_frag (adds (&opP
->disp
), offs (&opP
->disp
),
2240 TAB (DBCC
, SZ_UNDEF
));
2244 add_fix ('w', &opP
->disp
, 1, 0);
2248 case 'C': /* Fixed size LONG coproc branches */
2249 add_fix ('l', &opP
->disp
, 1, 0);
2253 case 'c': /* Var size Coprocesssor branches */
2254 if (subs (&opP
->disp
))
2256 add_fix ('l', &opP
->disp
, 1, 0);
2257 add_frag ((symbolS
*) 0, (long) 0, TAB (FBRANCH
, LONG
));
2259 else if (adds (&opP
->disp
))
2260 add_frag (adds (&opP
->disp
), offs (&opP
->disp
),
2261 TAB (FBRANCH
, SZ_UNDEF
));
2264 /* add_frag((symbolS *) 0, offs(&opP->disp),
2265 TAB(FBRANCH,SHORT)); */
2266 the_ins
.opcode
[the_ins
.numo
- 1] |= 0x40;
2267 add_fix ('l', &opP
->disp
, 1, 0);
2277 case 'C': /* Ignore it */
2280 case 'd': /* JF this is a kludge */
2281 install_operand ('s', opP
->reg
- ADDR
);
2282 tmpreg
= get_num (&opP
->disp
, 80);
2283 if (!issword (tmpreg
))
2285 as_warn ("Expression out of range, using 0");
2292 install_operand (s
[1], opP
->reg
- DATA
);
2296 install_operand (s
[1], opP
->reg
- FP0
);
2300 tmpreg
= opP
->reg
- COP0
;
2301 install_operand (s
[1], tmpreg
);
2304 case 'J': /* JF foo */
2365 install_operand (s
[1], tmpreg
);
2369 tmpreg
= get_num (&opP
->disp
, 55);
2370 install_operand (s
[1], tmpreg
& 0x7f);
2377 if (tmpreg
& 0x7FF0000)
2378 as_bad ("Floating point register in register list");
2379 insop (reverse_16_bits (tmpreg
), opcode
);
2383 if (tmpreg
& 0x700FFFF)
2384 as_bad ("Wrong register in floating-point reglist");
2385 install_operand (s
[1], reverse_8_bits (tmpreg
>> 16));
2393 if (tmpreg
& 0x7FF0000)
2394 as_bad ("Floating point register in register list");
2395 insop (tmpreg
, opcode
);
2397 else if (s
[1] == '8')
2399 if (tmpreg
& 0x0FFFFFF)
2400 as_bad ("incorrect register in reglist");
2401 install_operand (s
[1], tmpreg
>> 24);
2405 if (tmpreg
& 0x700FFFF)
2406 as_bad ("wrong register in floating-point reglist");
2408 install_operand (s
[1], tmpreg
>> 16);
2413 install_operand (s
[1], get_num (&opP
->disp
, 60));
2417 tmpreg
= ((opP
->mode
== DREG
)
2418 ? 0x20 + opP
->reg
- DATA
2419 : (get_num (&opP
->disp
, 40) & 0x1F));
2420 install_operand (s
[1], tmpreg
);
2424 tmpreg
= get_num (&opP
->disp
, 10);
2427 install_operand (s
[1], tmpreg
);
2431 /* This depends on the fact that ADDR registers are eight
2432 more than their corresponding DATA regs, so the result
2433 will have the ADDR_REG bit set */
2434 install_operand (s
[1], opP
->reg
- DATA
);
2438 if (opP
->mode
== AINDR
)
2439 install_operand (s
[1], opP
->reg
- DATA
);
2441 install_operand (s
[1], opP
->index
.reg
- DATA
);
2445 if (opP
->reg
== FPI
)
2447 else if (opP
->reg
== FPS
)
2449 else if (opP
->reg
== FPC
)
2453 install_operand (s
[1], tmpreg
);
2456 case 'S': /* Ignore it */
2460 install_operand (s
[1], get_num (&opP
->disp
, 30));
2463 case 'U': /* Ignore it */
2482 as_fatal ("failed sanity check");
2483 } /* switch on cache token */
2484 install_operand (s
[1], tmpreg
);
2487 /* JF: These are out of order, I fear. */
2500 install_operand (s
[1], tmpreg
);
2526 install_operand (s
[1], tmpreg
);
2530 if (opP
->reg
== VAL
)
2549 install_operand (s
[1], tmpreg
);
2563 tmpreg
= (4 << 10) | ((opP
->reg
- BAD
) << 2);
2574 tmpreg
= (5 << 10) | ((opP
->reg
- BAC
) << 2);
2580 install_operand (s
[1], tmpreg
);
2583 know (opP
->reg
== PSR
);
2586 know (opP
->reg
== PCSR
);
2601 install_operand (s
[1], tmpreg
);
2604 tmpreg
= get_num (&opP
->disp
, 20);
2605 install_operand (s
[1], tmpreg
);
2607 case '_': /* used only for move16 absolute 32-bit address */
2608 tmpreg
= get_num (&opP
->disp
, 80);
2609 addword (tmpreg
>> 16);
2610 addword (tmpreg
& 0xFFFF);
2617 /* By the time whe get here (FINALLY) the_ins contains the complete
2618 instruction, ready to be emitted. . . */
2622 reverse_16_bits (in
)
2628 static int mask
[16] =
2630 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
2631 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000, 0x8000
2633 for (n
= 0; n
< 16; n
++)
2636 out
|= mask
[15 - n
];
2639 } /* reverse_16_bits() */
2648 static int mask
[8] =
2650 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080,
2653 for (n
= 0; n
< 8; n
++)
2659 } /* reverse_8_bits() */
2661 /* Cause an extra frag to be generated here, inserting up to 10 bytes
2662 (that value is chosen in the frag_var call in md_assemble). TYPE
2663 is the subtype of the frag to be generated; its primary type is
2664 rs_machine_dependent.
2666 The TYPE parameter is also used by md_convert_frag_1 and
2667 md_estimate_size_before_relax. The appropriate type of fixup will
2668 be emitted by md_convert_frag_1.
2670 ADD becomes the FR_SYMBOL field of the frag, and OFF the FR_OFFSET. */
2672 install_operand (mode
, val
)
2679 the_ins
.opcode
[0] |= val
& 0xFF; /* JF FF is for M kludge */
2682 the_ins
.opcode
[0] |= val
<< 9;
2685 the_ins
.opcode
[1] |= val
<< 12;
2688 the_ins
.opcode
[1] |= val
<< 6;
2691 the_ins
.opcode
[1] |= val
;
2694 the_ins
.opcode
[2] |= val
<< 12;
2697 the_ins
.opcode
[2] |= val
<< 6;
2700 /* DANGER! This is a hack to force cas2l and cas2w cmds to be
2701 three words long! */
2703 the_ins
.opcode
[2] |= val
;
2706 the_ins
.opcode
[1] |= val
<< 7;
2709 the_ins
.opcode
[1] |= val
<< 10;
2713 the_ins
.opcode
[1] |= val
<< 5;
2718 the_ins
.opcode
[1] |= (val
<< 10) | (val
<< 7);
2721 the_ins
.opcode
[1] |= (val
<< 12) | val
;
2724 the_ins
.opcode
[0] |= val
= 0xff;
2727 the_ins
.opcode
[0] |= val
<< 9;
2730 the_ins
.opcode
[1] |= val
;
2733 the_ins
.opcode
[1] |= val
;
2734 the_ins
.numo
++; /* What a hack */
2737 the_ins
.opcode
[1] |= val
<< 4;
2745 the_ins
.opcode
[0] |= (val
<< 6);
2748 the_ins
.opcode
[1] = (val
>> 16);
2749 the_ins
.opcode
[2] = val
& 0xffff;
2753 as_fatal ("failed sanity check.");
2755 } /* install_operand() */
2758 install_gen_operand (mode
, val
)
2765 the_ins
.opcode
[0] |= val
;
2768 /* This is a kludge!!! */
2769 the_ins
.opcode
[0] |= (val
& 0x07) << 9 | (val
& 0x38) << 3;
2778 the_ins
.opcode
[0] |= val
;
2780 /* more stuff goes here */
2782 as_fatal ("failed sanity check.");
2784 } /* install_gen_operand() */
2787 * verify that we have some number of paren pairs, do m68k_ip_op(), and
2788 * then deal with the bitfield hack.
2792 crack_operand (str
, opP
)
2794 register struct m68k_op
*opP
;
2796 register int parens
;
2798 register char *beg_str
;
2806 for (parens
= 0; *str
&& (parens
> 0 || inquote
|| notend (str
)); str
++)
2812 else if (*str
== ')')
2816 opP
->error
= "Extra )";
2822 if (flag_mri
&& *str
== '\'')
2823 inquote
= ! inquote
;
2825 if (!*str
&& parens
)
2827 opP
->error
= "Missing )";
2832 if (m68k_ip_op (beg_str
, opP
) != 0)
2839 c
= *++str
; /* JF bitfield hack */
2844 as_bad ("Missing operand");
2849 /* This is the guts of the machine-dependent assembler. STR points to a
2850 machine dependent instruction. This function is supposed to emit
2851 the frags/bytes it assembles to.
2855 insert_reg (regname
, regnum
)
2862 #ifdef REGISTER_PREFIX
2863 if (!flag_reg_prefix_optional
)
2865 buf
[0] = REGISTER_PREFIX
;
2866 strcpy (buf
+ 1, regname
);
2871 symbol_table_insert (symbol_new (regname
, reg_section
, regnum
,
2872 &zero_address_frag
));
2874 for (i
= 0; regname
[i
]; i
++)
2875 buf
[i
] = islower (regname
[i
]) ? toupper (regname
[i
]) : regname
[i
];
2878 symbol_table_insert (symbol_new (buf
, reg_section
, regnum
,
2879 &zero_address_frag
));
2888 static const struct init_entry init_table
[] =
2998 /* 68ec030 versions of same */
3001 /* 68ec030 access control unit, identical to 030 MMU status reg */
3004 /* Suppressed data and address registers. */
3029 for (i
= 0; init_table
[i
].name
; i
++)
3030 insert_reg (init_table
[i
].name
, init_table
[i
].number
);
3033 static int no_68851
, no_68881
;
3036 /* a.out machine type. Default to 68020. */
3037 int m68k_aout_machtype
= 2;
3049 int shorts_this_frag
;
3052 /* In MRI mode, the instruction and operands are separated by a
3053 space. Anything following the operands is a comment. The label
3054 has already been removed. */
3062 for (s
= str
; *s
!= '\0'; s
++)
3064 if ((*s
== ' ' || *s
== '\t') && ! inquote
)
3082 inquote
= ! inquote
;
3087 memset ((char *) (&the_ins
), '\0', sizeof (the_ins
));
3092 for (n
= 0; n
< the_ins
.numargs
; n
++)
3093 if (the_ins
.operands
[n
].error
)
3095 er
= the_ins
.operands
[n
].error
;
3101 as_bad ("%s -- statement `%s' ignored", er
, str
);
3105 if (the_ins
.nfrag
== 0)
3107 /* No frag hacking involved; just put it out */
3108 toP
= frag_more (2 * the_ins
.numo
);
3109 fromP
= &the_ins
.opcode
[0];
3110 for (m
= the_ins
.numo
; m
; --m
)
3112 md_number_to_chars (toP
, (long) (*fromP
), 2);
3116 /* put out symbol-dependent info */
3117 for (m
= 0; m
< the_ins
.nrel
; m
++)
3119 switch (the_ins
.reloc
[m
].wid
)
3137 as_fatal ("Don't know how to figure width of %c in md_assemble()",
3138 the_ins
.reloc
[m
].wid
);
3141 fixP
= fix_new_exp (frag_now
,
3142 ((toP
- frag_now
->fr_literal
)
3143 - the_ins
.numo
* 2 + the_ins
.reloc
[m
].n
),
3145 &the_ins
.reloc
[m
].exp
,
3146 the_ins
.reloc
[m
].pcrel
,
3147 get_reloc_code (n
, the_ins
.reloc
[m
].pcrel
,
3148 the_ins
.reloc
[m
].pic_reloc
));
3149 fixP
->fx_pcrel_adjust
= the_ins
.reloc
[m
].pcrel_fix
;
3154 /* There's some frag hacking */
3155 for (n
= 0, fromP
= &the_ins
.opcode
[0]; n
< the_ins
.nfrag
; n
++)
3160 wid
= 2 * the_ins
.fragb
[n
].fragoff
;
3162 wid
= 2 * (the_ins
.numo
- the_ins
.fragb
[n
- 1].fragoff
);
3163 toP
= frag_more (wid
);
3165 shorts_this_frag
= 0;
3166 for (m
= wid
/ 2; m
; --m
)
3168 md_number_to_chars (toP
, (long) (*fromP
), 2);
3173 for (m
= 0; m
< the_ins
.nrel
; m
++)
3175 if ((the_ins
.reloc
[m
].n
) >= 2 * shorts_this_frag
)
3177 the_ins
.reloc
[m
].n
-= 2 * shorts_this_frag
;
3180 wid
= the_ins
.reloc
[m
].wid
;
3183 the_ins
.reloc
[m
].wid
= 0;
3184 wid
= (wid
== 'b') ? 1 : (wid
== 'w') ? 2 : (wid
== 'l') ? 4 : 4000;
3186 fixP
= fix_new_exp (frag_now
,
3187 ((toP
- frag_now
->fr_literal
)
3188 - the_ins
.numo
* 2 + the_ins
.reloc
[m
].n
),
3190 &the_ins
.reloc
[m
].exp
,
3191 the_ins
.reloc
[m
].pcrel
,
3192 get_reloc_code (wid
, the_ins
.reloc
[m
].pcrel
,
3193 the_ins
.reloc
[m
].pic_reloc
));
3194 fixP
->fx_pcrel_adjust
= the_ins
.reloc
[m
].pcrel_fix
;
3196 (void) frag_var (rs_machine_dependent
, 10, 0,
3197 (relax_substateT
) (the_ins
.fragb
[n
].fragty
),
3198 the_ins
.fragb
[n
].fadd
, the_ins
.fragb
[n
].foff
, to_beg_P
);
3200 n
= (the_ins
.numo
- the_ins
.fragb
[n
- 1].fragoff
);
3201 shorts_this_frag
= 0;
3204 toP
= frag_more (n
* sizeof (short));
3207 md_number_to_chars (toP
, (long) (*fromP
), 2);
3213 for (m
= 0; m
< the_ins
.nrel
; m
++)
3217 wid
= the_ins
.reloc
[m
].wid
;
3220 the_ins
.reloc
[m
].wid
= 0;
3221 wid
= (wid
== 'b') ? 1 : (wid
== 'w') ? 2 : (wid
== 'l') ? 4 : 4000;
3223 fixP
= fix_new_exp (frag_now
,
3224 ((the_ins
.reloc
[m
].n
+ toP
- frag_now
->fr_literal
)
3225 - shorts_this_frag
* 2),
3227 &the_ins
.reloc
[m
].exp
,
3228 the_ins
.reloc
[m
].pcrel
,
3229 get_reloc_code (wid
, the_ins
.reloc
[m
].pcrel
,
3230 the_ins
.reloc
[m
].pic_reloc
));
3231 fixP
->fx_pcrel_adjust
= the_ins
.reloc
[m
].pcrel_fix
;
3239 * md_begin -- set up hash tables with 68000 instructions.
3240 * similar to what the vax assembler does. ---phr
3242 /* RMS claims the thing to do is take the m68k-opcode.h table, and make
3243 a copy of it at runtime, adding in the information we want but isn't
3244 there. I think it'd be better to have an awk script hack the table
3245 at compile time. Or even just xstr the table and use it as-is. But
3246 my lord ghod hath spoken, so we do it this way. Excuse the ugly var
3249 register const struct m68k_opcode
*ins
;
3250 register struct m68k_incant
*hack
, *slak
;
3251 register const char *retval
= 0; /* empty string, or error msg text */
3252 register unsigned int i
;
3257 flag_reg_prefix_optional
= 1;
3262 op_hash
= hash_new ();
3264 obstack_begin (&robyn
, 4000);
3265 for (i
= 0; i
< m68k_numopcodes
; i
++)
3267 hack
= slak
= (struct m68k_incant
*) obstack_alloc (&robyn
, sizeof (struct m68k_incant
));
3270 ins
= &m68k_opcodes
[i
];
3271 /* We *could* ignore insns that don't match our arch here
3272 but just leaving them out of the hash. */
3273 slak
->m_operands
= ins
->args
;
3274 slak
->m_opnum
= strlen (slak
->m_operands
) / 2;
3275 slak
->m_arch
= ins
->arch
;
3276 slak
->m_opcode
= ins
->opcode
;
3277 /* This is kludgey */
3278 slak
->m_codenum
= ((ins
->match
) & 0xffffL
) ? 2 : 1;
3279 if (i
+ 1 != m68k_numopcodes
3280 && !strcmp (ins
->name
, m68k_opcodes
[i
+ 1].name
))
3282 slak
->m_next
= (struct m68k_incant
*) obstack_alloc (&robyn
, sizeof (struct m68k_incant
));
3287 slak
= slak
->m_next
;
3291 retval
= hash_insert (op_hash
, ins
->name
, (char *) hack
);
3293 as_fatal ("Internal Error: Can't hash %s: %s", ins
->name
, retval
);
3296 for (i
= 0; i
< m68k_numaliases
; i
++)
3298 const char *name
= m68k_opcode_aliases
[i
].primary
;
3299 const char *alias
= m68k_opcode_aliases
[i
].alias
;
3300 PTR val
= hash_find (op_hash
, name
);
3302 as_fatal ("Internal Error: Can't find %s in hash table", name
);
3303 retval
= hash_insert (op_hash
, alias
, val
);
3305 as_fatal ("Internal Error: Can't hash %s: %s", alias
, retval
);
3308 /* In MRI mode, all unsized branches are variable sized. Normally,
3309 they are word sized. */
3312 static struct m68k_opcode_alias mri_aliases
[] =
3332 for (i
= 0; i
< sizeof mri_aliases
/ sizeof mri_aliases
[0]; i
++)
3334 const char *name
= mri_aliases
[i
].primary
;
3335 const char *alias
= mri_aliases
[i
].alias
;
3336 PTR val
= hash_find (op_hash
, name
);
3338 as_fatal ("Internal Error: Can't find %s in hash table", name
);
3339 retval
= hash_jam (op_hash
, alias
, val
);
3341 as_fatal ("Internal Error: Can't hash %s: %s", alias
, retval
);
3345 for (i
= 0; i
< sizeof (mklower_table
); i
++)
3346 mklower_table
[i
] = (isupper (c
= (char) i
)) ? tolower (c
) : c
;
3348 for (i
= 0; i
< sizeof (notend_table
); i
++)
3350 notend_table
[i
] = 0;
3351 alt_notend_table
[i
] = 0;
3353 notend_table
[','] = 1;
3354 notend_table
['{'] = 1;
3355 notend_table
['}'] = 1;
3356 alt_notend_table
['a'] = 1;
3357 alt_notend_table
['A'] = 1;
3358 alt_notend_table
['d'] = 1;
3359 alt_notend_table
['D'] = 1;
3360 alt_notend_table
['#'] = 1;
3361 alt_notend_table
['&'] = 1;
3362 alt_notend_table
['f'] = 1;
3363 alt_notend_table
['F'] = 1;
3364 #ifdef REGISTER_PREFIX
3365 alt_notend_table
[REGISTER_PREFIX
] = 1;
3368 /* We need to put '(' in alt_notend_table to handle
3369 cas2 %d0:%d2,%d3:%d4,(%a0):(%a1)
3371 alt_notend_table
['('] = 1;
3373 /* We need to put '@' in alt_notend_table to handle
3374 cas2 %d0:%d2,%d3:%d4,@(%d0):@(%d1)
3376 alt_notend_table
['@'] = 1;
3378 #ifndef MIT_SYNTAX_ONLY
3379 /* Insert pseudo ops, these have to go into the opcode table since
3380 gas expects pseudo ops to start with a dot */
3383 while (mote_pseudo_table
[n
].poc_name
)
3385 hack
= (struct m68k_incant
*)
3386 obstack_alloc (&robyn
, sizeof (struct m68k_incant
));
3387 hash_insert (op_hash
,
3388 mote_pseudo_table
[n
].poc_name
, (char *) hack
);
3389 hack
->m_operands
= 0;
3399 record_alignment (text_section
, 2);
3400 record_alignment (data_section
, 2);
3401 record_alignment (bss_section
, 2);
3406 m68k_init_after_args ()
3408 if (cpu_of_arch (current_architecture
) == 0)
3411 const char *default_cpu
= TARGET_CPU
;
3413 if (*default_cpu
== 'm')
3415 for (i
= 0; i
< n_archs
; i
++)
3416 if (strcasecmp (default_cpu
, archs
[i
].name
) == 0)
3420 as_bad ("unrecognized default cpu `%s' ???", TARGET_CPU
);
3421 current_architecture
|= m68020
;
3424 current_architecture
|= archs
[i
].arch
;
3426 /* Permit m68881 specification with all cpus; those that can't work
3427 with a coprocessor could be doing emulation. */
3428 if (current_architecture
& m68851
)
3430 if (current_architecture
& m68040
)
3432 as_warn ("68040 and 68851 specified; mmu instructions may assemble incorrectly");
3435 /* What other incompatibilities could we check for? */
3437 /* Toss in some default assumptions about coprocessors. */
3439 && (cpu_of_arch (current_architecture
)
3440 /* Can CPU32 have a 68881 coprocessor?? */
3441 & (m68020
| m68030
| cpu32
)))
3443 current_architecture
|= m68881
;
3446 && (cpu_of_arch (current_architecture
) & m68020up
) != 0
3447 && (cpu_of_arch (current_architecture
) & m68040up
) == 0)
3449 current_architecture
|= m68851
;
3451 if (no_68881
&& (current_architecture
& m68881
))
3452 as_bad ("options for 68881 and no-68881 both given");
3453 if (no_68851
&& (current_architecture
& m68851
))
3454 as_bad ("options for 68851 and no-68851 both given");
3457 /* Work out the magic number. This isn't very general. */
3458 if (current_architecture
& m68000
)
3459 m68k_aout_machtype
= 0;
3460 else if (current_architecture
& m68010
)
3461 m68k_aout_machtype
= 1;
3462 else if (current_architecture
& m68020
)
3463 m68k_aout_machtype
= 2;
3465 m68k_aout_machtype
= 2;
3468 /* Note which set of "movec" control registers is available. */
3469 switch (cpu_of_arch (current_architecture
))
3472 control_regs
= m68000_control_regs
;
3475 control_regs
= m68010_control_regs
;
3479 control_regs
= m68020_control_regs
;
3482 control_regs
= m68040_control_regs
;
3485 control_regs
= m68060_control_regs
;
3488 control_regs
= cpu32_control_regs
;
3494 if (cpu_of_arch (current_architecture
) < m68020
)
3495 md_relax_table
[TAB (PCINDEX
, BYTE
)].rlx_more
= 0;
3498 /* This is called if we go in or out of MRI mode because of the .mri
3502 m68k_mri_mode_change (on
)
3507 if (! flag_reg_prefix_optional
)
3509 flag_reg_prefix_optional
= 1;
3510 #ifdef REGISTER_PREFIX
3519 if (! reg_prefix_optional_seen
)
3521 #ifdef REGISTER_PREFIX_OPTIONAL
3522 flag_reg_prefix_optional
= REGISTER_PREFIX_OPTIONAL
;
3524 flag_reg_prefix_optional
= 0;
3526 #ifdef REGISTER_PREFIX
3535 /* Equal to MAX_PRECISION in atof-ieee.c */
3536 #define MAX_LITTLENUMS 6
3538 /* Turn a string in input_line_pointer into a floating point constant
3539 of type type, and store the appropriate bytes in *litP. The number
3540 of LITTLENUMS emitted is stored in *sizeP . An error message is
3541 returned, or NULL on OK. */
3544 md_atof (type
, litP
, sizeP
)
3550 LITTLENUM_TYPE words
[MAX_LITTLENUMS
];
3551 LITTLENUM_TYPE
*wordP
;
3583 return "Bad call to MD_ATOF()";
3585 t
= atof_ieee (input_line_pointer
, type
, words
);
3587 input_line_pointer
= t
;
3589 *sizeP
= prec
* sizeof (LITTLENUM_TYPE
);
3590 for (wordP
= words
; prec
--;)
3592 md_number_to_chars (litP
, (long) (*wordP
++), sizeof (LITTLENUM_TYPE
));
3593 litP
+= sizeof (LITTLENUM_TYPE
);
3599 md_number_to_chars (buf
, val
, n
)
3604 number_to_chars_bigendian (buf
, val
, n
);
3608 md_apply_fix_2 (fixP
, val
)
3612 addressT upper_limit
;
3613 offsetT lower_limit
;
3615 /* This is unnecessary but it convinces the native rs6000 compiler
3616 to generate the code we want. */
3617 char *buf
= fixP
->fx_frag
->fr_literal
;
3618 buf
+= fixP
->fx_where
;
3619 /* end ibm compiler workaround */
3621 if (val
& 0x80000000)
3622 val
|= ~(addressT
)0x7fffffff;
3629 memset (buf
, 0, fixP
->fx_size
);
3630 fixP
->fx_addnumber
= val
; /* Remember value for emit_reloc */
3635 switch (fixP
->fx_size
)
3637 /* The cast to offsetT below are necessary to make code correct for
3638 machines where ints are smaller than offsetT */
3642 lower_limit
= - (offsetT
) 0x80;
3645 *buf
++ = (val
>> 8);
3647 upper_limit
= 0x7fff;
3648 lower_limit
= - (offsetT
) 0x8000;
3651 *buf
++ = (val
>> 24);
3652 *buf
++ = (val
>> 16);
3653 *buf
++ = (val
>> 8);
3655 upper_limit
= 0x7fffffff;
3656 lower_limit
= - (offsetT
) 0x7fffffff - 1; /* avoid constant overflow */
3659 BAD_CASE (fixP
->fx_size
);
3662 /* Fix up a negative reloc. */
3663 if (fixP
->fx_addsy
== NULL
&& fixP
->fx_subsy
!= NULL
)
3665 fixP
->fx_addsy
= fixP
->fx_subsy
;
3666 fixP
->fx_subsy
= NULL
;
3670 /* For non-pc-relative values, it's conceivable we might get something
3671 like "0xff" for a byte field. So extend the upper part of the range
3672 to accept such numbers. We arbitrarily disallow "-0xff" or "0xff+0xff",
3673 so that we can do any range checking at all. */
3674 if (!fixP
->fx_pcrel
)
3675 upper_limit
= upper_limit
* 2 + 1;
3677 if ((addressT
) val
> upper_limit
3678 && (val
> 0 || val
< lower_limit
))
3679 as_bad_where (fixP
->fx_file
, fixP
->fx_line
, "value out of range");
3681 /* A one byte PC-relative reloc means a short branch. We can't use
3682 a short branch with a value of 0 or -1, because those indicate
3683 different opcodes (branches with longer offsets). */
3685 && fixP
->fx_size
== 1
3686 && (fixP
->fx_addsy
== NULL
3687 || S_IS_DEFINED (fixP
->fx_addsy
))
3688 && (val
== 0 || val
== -1))
3689 as_bad_where (fixP
->fx_file
, fixP
->fx_line
, "invalid byte branch offset");
3692 #ifdef BFD_ASSEMBLER
3694 md_apply_fix (fixP
, valp
)
3698 md_apply_fix_2 (fixP
, (addressT
) *valp
);
3702 void md_apply_fix (fixP
, val
)
3706 md_apply_fix_2 (fixP
, (addressT
) val
);
3710 /* *fragP has been relaxed to its final size, and now needs to have
3711 the bytes inside it modified to conform to the new size There is UGLY
3715 md_convert_frag_1 (fragP
)
3716 register fragS
*fragP
;
3722 /* Address in object code of the displacement. */
3723 register int object_address
= fragP
->fr_fix
+ fragP
->fr_address
;
3725 /* Address in gas core of the place to store the displacement. */
3726 /* This convinces the native rs6000 compiler to generate the code we
3728 register char *buffer_address
= fragP
->fr_literal
;
3729 buffer_address
+= fragP
->fr_fix
;
3730 /* end ibm compiler workaround */
3732 /* The displacement of the address, from current location. */
3733 disp
= fragP
->fr_symbol
? S_GET_VALUE (fragP
->fr_symbol
) : 0;
3734 disp
= (disp
+ fragP
->fr_offset
) - object_address
;
3736 #ifdef BFD_ASSEMBLER
3737 disp
+= fragP
->fr_symbol
->sy_frag
->fr_address
;
3740 switch (fragP
->fr_subtype
)
3742 case TAB (BCC68000
, BYTE
):
3743 case TAB (ABRANCH
, BYTE
):
3744 know (issbyte (disp
));
3746 as_bad ("short branch with zero offset: use :w");
3747 fragP
->fr_opcode
[1] = disp
;
3750 case TAB (DBCC
, SHORT
):
3751 know (issword (disp
));
3754 case TAB (BCC68000
, SHORT
):
3755 case TAB (ABRANCH
, SHORT
):
3756 know (issword (disp
));
3757 fragP
->fr_opcode
[1] = 0x00;
3760 case TAB (ABRANCH
, LONG
):
3761 if (cpu_of_arch (current_architecture
) < m68020
)
3763 if (fragP
->fr_opcode
[0] == 0x61)
3766 fragP
->fr_opcode
[0] = 0x4E;
3767 fragP
->fr_opcode
[1] = (char) 0xB9; /* JBSR with ABSL LONG offset */
3781 else if (fragP
->fr_opcode
[0] == 0x60)
3783 fragP
->fr_opcode
[0] = 0x4E;
3784 fragP
->fr_opcode
[1] = (char) 0xF9; /* JMP with ABSL LONG offset */
3785 fix_new (fragP
, fragP
->fr_fix
, 4, fragP
->fr_symbol
,
3786 fragP
->fr_offset
, 0, NO_RELOC
);
3792 as_bad ("Long branch offset not supported.");
3797 fragP
->fr_opcode
[1] = (char) 0xff;
3801 case TAB (BCC68000
, LONG
):
3802 /* only Bcc 68000 instructions can come here */
3803 /* change bcc into b!cc/jmp absl long */
3804 fragP
->fr_opcode
[0] ^= 0x01; /* invert bcc */
3805 fragP
->fr_opcode
[1] = 0x6;/* branch offset = 6 */
3807 /* JF: these used to be fr_opcode[2,3], but they may be in a
3808 different frag, in which case refering to them is a no-no.
3809 Only fr_opcode[0,1] are guaranteed to work. */
3810 *buffer_address
++ = 0x4e; /* put in jmp long (0x4ef9) */
3811 *buffer_address
++ = (char) 0xf9;
3812 fragP
->fr_fix
+= 2; /* account for jmp instruction */
3813 fix_new (fragP
, fragP
->fr_fix
, 4, fragP
->fr_symbol
,
3814 fragP
->fr_offset
, 0, NO_RELOC
);
3818 case TAB (DBCC
, LONG
):
3819 /* only DBcc 68000 instructions can come here */
3820 /* change dbcc into dbcc/jmp absl long */
3821 /* JF: these used to be fr_opcode[2-7], but that's wrong */
3822 *buffer_address
++ = 0x00; /* branch offset = 4 */
3823 *buffer_address
++ = 0x04;
3824 *buffer_address
++ = 0x60; /* put in bra pc+6 */
3825 *buffer_address
++ = 0x06;
3826 *buffer_address
++ = 0x4e; /* put in jmp long (0x4ef9) */
3827 *buffer_address
++ = (char) 0xf9;
3829 fragP
->fr_fix
+= 6; /* account for bra/jmp instructions */
3830 fix_new (fragP
, fragP
->fr_fix
, 4, fragP
->fr_symbol
,
3831 fragP
->fr_offset
, 0, NO_RELOC
);
3835 case TAB (FBRANCH
, SHORT
):
3836 know ((fragP
->fr_opcode
[1] & 0x40) == 0);
3839 case TAB (FBRANCH
, LONG
):
3840 fragP
->fr_opcode
[1] |= 0x40; /* Turn on LONG bit */
3843 case TAB (PCREL
, SHORT
):
3846 case TAB (PCREL
, LONG
):
3847 /* The thing to do here is force it to ABSOLUTE LONG, since
3848 PCREL is really trying to shorten an ABSOLUTE address anyway */
3849 /* JF FOO This code has not been tested */
3850 fix_new (fragP
, fragP
->fr_fix
, 4, fragP
->fr_symbol
, fragP
->fr_offset
,
3852 if ((fragP
->fr_opcode
[1] & 0x3F) != 0x3A)
3853 as_bad ("Internal error (long PC-relative operand) for insn 0x%04x at 0x%lx",
3854 (unsigned) fragP
->fr_opcode
[0],
3855 (unsigned long) fragP
->fr_address
);
3856 fragP
->fr_opcode
[1] &= ~0x3F;
3857 fragP
->fr_opcode
[1] |= 0x39; /* Mode 7.1 */
3861 case TAB (PCLEA
, SHORT
):
3862 fix_new (fragP
, (int) (fragP
->fr_fix
), 2, fragP
->fr_symbol
,
3863 fragP
->fr_offset
, 1, NO_RELOC
);
3864 fragP
->fr_opcode
[1] &= ~0x3F;
3865 fragP
->fr_opcode
[1] |= 0x3A; /* 072 - mode 7.2 */
3868 case TAB (PCLEA
, LONG
):
3869 fixP
= fix_new (fragP
, (int) (fragP
->fr_fix
) + 2, 4, fragP
->fr_symbol
,
3870 fragP
->fr_offset
, 1, NO_RELOC
);
3871 fixP
->fx_pcrel_adjust
= 2;
3872 /* Already set to mode 7.3; this indicates: PC indirect with
3873 suppressed index, 32-bit displacement. */
3874 *buffer_address
++ = 0x01;
3875 *buffer_address
++ = 0x70;
3880 case TAB (PCINDEX
, BYTE
):
3882 if (!issbyte (disp
))
3884 as_bad ("displacement doesn't fit in one byte");
3887 assert (fragP
->fr_fix
>= 2);
3888 buffer_address
[-2] &= ~1;
3889 buffer_address
[-1] = disp
;
3892 case TAB (PCINDEX
, SHORT
):
3894 assert (issword (disp
));
3895 assert (fragP
->fr_fix
>= 2);
3896 buffer_address
[-2] |= 0x1;
3897 buffer_address
[-1] = 0x20;
3898 fixP
= fix_new (fragP
, (int) (fragP
->fr_fix
), 2, fragP
->fr_symbol
,
3899 fragP
->fr_offset
, (fragP
->fr_opcode
[1] & 077) == 073,
3901 fixP
->fx_pcrel_adjust
= 2;
3904 case TAB (PCINDEX
, LONG
):
3906 fixP
= fix_new (fragP
, (int) (fragP
->fr_fix
), 4, fragP
->fr_symbol
,
3907 fragP
->fr_offset
, (fragP
->fr_opcode
[1] & 077) == 073,
3909 fixP
->fx_pcrel_adjust
= 2;
3910 assert (fragP
->fr_fix
>= 2);
3911 buffer_address
[-2] |= 0x1;
3912 buffer_address
[-1] = 0x30;
3919 md_number_to_chars (buffer_address
, (long) disp
, (int) ext
);
3920 fragP
->fr_fix
+= ext
;
3924 #ifndef BFD_ASSEMBLER
3927 md_convert_frag (headers
, sec
, fragP
)
3928 object_headers
*headers
;
3932 md_convert_frag_1 (fragP
);
3938 md_convert_frag (abfd
, sec
, fragP
)
3943 md_convert_frag_1 (fragP
);
3947 /* Force truly undefined symbols to their maximum size, and generally set up
3948 the frag list to be relaxed
3951 md_estimate_size_before_relax (fragP
, segment
)
3952 register fragS
*fragP
;
3956 register char *buffer_address
= fragP
->fr_fix
+ fragP
->fr_literal
;
3958 old_fix
= fragP
->fr_fix
;
3960 /* handle SZ_UNDEF first, it can be changed to BYTE or SHORT */
3961 switch (fragP
->fr_subtype
)
3964 case TAB (ABRANCH
, SZ_UNDEF
):
3966 if ((fragP
->fr_symbol
!= NULL
) /* Not absolute */
3967 && S_GET_SEGMENT (fragP
->fr_symbol
) == segment
)
3969 fragP
->fr_subtype
= TAB (TABTYPE (fragP
->fr_subtype
), BYTE
);
3972 else if ((fragP
->fr_symbol
== 0) || (cpu_of_arch (current_architecture
) < m68020
))
3974 /* On 68000, or for absolute value, switch to abs long */
3975 /* FIXME, we should check abs val, pick short or long */
3976 if (fragP
->fr_opcode
[0] == 0x61)
3978 fragP
->fr_opcode
[0] = 0x4E;
3979 fragP
->fr_opcode
[1] = (char) 0xB9; /* JBSR with ABSL LONG offset */
3980 fix_new (fragP
, fragP
->fr_fix
, 4,
3981 fragP
->fr_symbol
, fragP
->fr_offset
, 0, NO_RELOC
);
3985 else if (fragP
->fr_opcode
[0] == 0x60)
3987 fragP
->fr_opcode
[0] = 0x4E;
3988 fragP
->fr_opcode
[1] = (char) 0xF9; /* JMP with ABSL LONG offset */
3989 fix_new (fragP
, fragP
->fr_fix
, 4,
3990 fragP
->fr_symbol
, fragP
->fr_offset
, 0, NO_RELOC
);
3996 as_warn ("Long branch offset to extern symbol not supported.");
4000 { /* Symbol is still undefined. Make it simple */
4001 fix_new (fragP
, (int) (fragP
->fr_fix
), 4, fragP
->fr_symbol
,
4002 fragP
->fr_offset
, 1, NO_RELOC
);
4004 fragP
->fr_opcode
[1] = (char) 0xff;
4010 } /* case TAB(ABRANCH,SZ_UNDEF) */
4012 case TAB (FBRANCH
, SZ_UNDEF
):
4014 if (S_GET_SEGMENT (fragP
->fr_symbol
) == segment
|| flag_short_refs
)
4016 fragP
->fr_subtype
= TAB (FBRANCH
, SHORT
);
4021 fix_new (fragP
, (int) fragP
->fr_fix
, 4, fragP
->fr_symbol
,
4022 fragP
->fr_offset
, 1, NO_RELOC
);
4024 fragP
->fr_opcode
[1] |= 0x40; /* Turn on LONG bit */
4028 } /* TAB(FBRANCH,SZ_UNDEF) */
4030 case TAB (PCREL
, SZ_UNDEF
):
4032 if (S_GET_SEGMENT (fragP
->fr_symbol
) == segment
4034 || cpu_of_arch (current_architecture
) < m68020
)
4036 fragP
->fr_subtype
= TAB (PCREL
, SHORT
);
4041 fragP
->fr_subtype
= TAB (PCREL
, LONG
);
4045 } /* TAB(PCREL,SZ_UNDEF) */
4047 case TAB (BCC68000
, SZ_UNDEF
):
4049 if ((fragP
->fr_symbol
!= NULL
)
4050 && S_GET_SEGMENT (fragP
->fr_symbol
) == segment
)
4052 fragP
->fr_subtype
= TAB (BCC68000
, BYTE
);
4055 /* only Bcc 68000 instructions can come here */
4056 /* change bcc into b!cc/jmp absl long */
4057 fragP
->fr_opcode
[0] ^= 0x01; /* invert bcc */
4058 if (flag_short_refs
)
4060 fragP
->fr_opcode
[1] = 0x04; /* branch offset = 6 */
4061 /* JF: these were fr_opcode[2,3] */
4062 buffer_address
[0] = 0x4e; /* put in jmp long (0x4ef9) */
4063 buffer_address
[1] = (char) 0xf8;
4064 fragP
->fr_fix
+= 2; /* account for jmp instruction */
4065 fix_new (fragP
, fragP
->fr_fix
, 2, fragP
->fr_symbol
,
4066 fragP
->fr_offset
, 0, NO_RELOC
);
4071 fragP
->fr_opcode
[1] = 0x06; /* branch offset = 6 */
4072 /* JF: these were fr_opcode[2,3] */
4073 buffer_address
[0] = 0x4e; /* put in jmp long (0x4ef9) */
4074 buffer_address
[1] = (char) 0xf9;
4075 fragP
->fr_fix
+= 2; /* account for jmp instruction */
4076 fix_new (fragP
, fragP
->fr_fix
, 4, fragP
->fr_symbol
,
4077 fragP
->fr_offset
, 0, NO_RELOC
);
4082 } /* case TAB(BCC68000,SZ_UNDEF) */
4084 case TAB (DBCC
, SZ_UNDEF
):
4086 if (fragP
->fr_symbol
!= NULL
&& S_GET_SEGMENT (fragP
->fr_symbol
) == segment
)
4088 fragP
->fr_subtype
= TAB (DBCC
, SHORT
);
4092 /* only DBcc 68000 instructions can come here */
4093 /* change dbcc into dbcc/jmp absl long */
4094 /* JF: these used to be fr_opcode[2-4], which is wrong. */
4095 buffer_address
[0] = 0x00; /* branch offset = 4 */
4096 buffer_address
[1] = 0x04;
4097 buffer_address
[2] = 0x60; /* put in bra pc + ... */
4099 if (flag_short_refs
)
4101 /* JF: these were fr_opcode[5-7] */
4102 buffer_address
[3] = 0x04; /* plus 4 */
4103 buffer_address
[4] = 0x4e; /* Put in Jump Word */
4104 buffer_address
[5] = (char) 0xf8;
4105 fragP
->fr_fix
+= 6; /* account for bra/jmp instruction */
4106 fix_new (fragP
, fragP
->fr_fix
, 2, fragP
->fr_symbol
,
4107 fragP
->fr_offset
, 0, NO_RELOC
);
4112 /* JF: these were fr_opcode[5-7] */
4113 buffer_address
[3] = 0x06; /* Plus 6 */
4114 buffer_address
[4] = 0x4e; /* put in jmp long (0x4ef9) */
4115 buffer_address
[5] = (char) 0xf9;
4116 fragP
->fr_fix
+= 6; /* account for bra/jmp instruction */
4117 fix_new (fragP
, fragP
->fr_fix
, 4, fragP
->fr_symbol
,
4118 fragP
->fr_offset
, 0, NO_RELOC
);
4124 } /* case TAB(DBCC,SZ_UNDEF) */
4126 case TAB (PCLEA
, SZ_UNDEF
):
4128 if ((S_GET_SEGMENT (fragP
->fr_symbol
)) == segment
4130 || cpu_of_arch (current_architecture
) < m68020
)
4132 fragP
->fr_subtype
= TAB (PCLEA
, SHORT
);
4137 fragP
->fr_subtype
= TAB (PCLEA
, LONG
);
4141 } /* TAB(PCLEA,SZ_UNDEF) */
4143 case TAB (PCINDEX
, SZ_UNDEF
):
4144 if (S_GET_SEGMENT (fragP
->fr_symbol
) == segment
4145 || cpu_of_arch (current_architecture
) < m68020
)
4147 fragP
->fr_subtype
= TAB (PCINDEX
, BYTE
);
4151 fragP
->fr_subtype
= TAB (PCINDEX
, LONG
);
4160 /* now that SZ_UNDEF are taken care of, check others */
4161 switch (fragP
->fr_subtype
)
4163 case TAB (BCC68000
, BYTE
):
4164 case TAB (ABRANCH
, BYTE
):
4165 /* We can't do a short jump to the next instruction, so in that
4166 case we force word mode. At this point S_GET_VALUE should
4167 return the offset of the symbol within its frag. If the
4168 symbol is at the start of a frag, and it is the next frag
4169 with any data in it (usually this is just the next frag, but
4170 assembler listings may introduce empty frags), we must use
4172 if (fragP
->fr_symbol
&& S_GET_VALUE (fragP
->fr_symbol
) == 0)
4176 for (l
= fragP
->fr_next
;
4177 l
!= fragP
->fr_symbol
->sy_frag
;
4179 if (l
->fr_fix
+ l
->fr_var
!= 0)
4181 if (l
== fragP
->fr_symbol
->sy_frag
)
4183 fragP
->fr_subtype
= TAB (TABTYPE (fragP
->fr_subtype
), SHORT
);
4191 return fragP
->fr_var
+ fragP
->fr_fix
- old_fix
;
4194 #if defined(OBJ_AOUT) | defined(OBJ_BOUT)
4195 /* the bit-field entries in the relocation_info struct plays hell
4196 with the byte-order problems of cross-assembly. So as a hack,
4197 I added this mach. dependent ri twiddler. Ugly, but it gets
4199 /* on m68k: first 4 bytes are normal unsigned long, next three bytes
4200 are symbolnum, most sig. byte first. Last byte is broken up with
4201 bit 7 as pcrel, bits 6 & 5 as length, bit 4 as pcrel, and the lower
4202 nibble as nuthin. (on Sun 3 at least) */
4203 /* Translate the internal relocation information into target-specific
4207 md_ri_to_chars (the_bytes
, ri
)
4209 struct reloc_info_generic
*ri
;
4212 md_number_to_chars (the_bytes
, ri
->r_address
, 4);
4213 /* now the fun stuff */
4214 the_bytes
[4] = (ri
->r_symbolnum
>> 16) & 0x0ff;
4215 the_bytes
[5] = (ri
->r_symbolnum
>> 8) & 0x0ff;
4216 the_bytes
[6] = ri
->r_symbolnum
& 0x0ff;
4217 the_bytes
[7] = (((ri
->r_pcrel
<< 7) & 0x80) | ((ri
->r_length
<< 5) & 0x60) |
4218 ((ri
->r_extern
<< 4) & 0x10));
4221 #endif /* comment */
4223 #ifndef BFD_ASSEMBLER
4225 tc_aout_fix_to_chars (where
, fixP
, segment_address_in_file
)
4228 relax_addressT segment_address_in_file
;
4231 * In: length of relocation (or of address) in chars: 1, 2 or 4.
4232 * Out: GNU LD relocation length code: 0, 1, or 2.
4235 static CONST
unsigned char nbytes_r_length
[] = {42, 0, 1, 42, 2};
4238 know (fixP
->fx_addsy
!= NULL
);
4240 md_number_to_chars (where
,
4241 fixP
->fx_frag
->fr_address
+ fixP
->fx_where
- segment_address_in_file
,
4244 r_symbolnum
= (S_IS_DEFINED (fixP
->fx_addsy
)
4245 ? S_GET_TYPE (fixP
->fx_addsy
)
4246 : fixP
->fx_addsy
->sy_number
);
4248 where
[4] = (r_symbolnum
>> 16) & 0x0ff;
4249 where
[5] = (r_symbolnum
>> 8) & 0x0ff;
4250 where
[6] = r_symbolnum
& 0x0ff;
4251 where
[7] = (((fixP
->fx_pcrel
<< 7) & 0x80) | ((nbytes_r_length
[fixP
->fx_size
] << 5) & 0x60) |
4252 (((!S_IS_DEFINED (fixP
->fx_addsy
)) << 4) & 0x10));
4256 #endif /* OBJ_AOUT or OBJ_BOUT */
4258 #ifndef WORKING_DOT_WORD
4259 CONST
int md_short_jump_size
= 4;
4260 CONST
int md_long_jump_size
= 6;
4263 md_create_short_jump (ptr
, from_addr
, to_addr
, frag
, to_symbol
)
4265 addressT from_addr
, to_addr
;
4271 offset
= to_addr
- (from_addr
+ 2);
4273 md_number_to_chars (ptr
, (valueT
) 0x6000, 2);
4274 md_number_to_chars (ptr
+ 2, (valueT
) offset
, 2);
4278 md_create_long_jump (ptr
, from_addr
, to_addr
, frag
, to_symbol
)
4280 addressT from_addr
, to_addr
;
4286 if (cpu_of_arch (current_architecture
) < m68020
)
4288 offset
= to_addr
- S_GET_VALUE (to_symbol
);
4289 md_number_to_chars (ptr
, (valueT
) 0x4EF9, 2);
4290 md_number_to_chars (ptr
+ 2, (valueT
) offset
, 4);
4291 fix_new (frag
, (ptr
+ 2) - frag
->fr_literal
, 4, to_symbol
, (offsetT
) 0,
4296 offset
= to_addr
- (from_addr
+ 2);
4297 md_number_to_chars (ptr
, (valueT
) 0x60ff, 2);
4298 md_number_to_chars (ptr
+ 2, (valueT
) offset
, 4);
4304 /* Different values of OK tell what its OK to return. Things that
4305 aren't OK are an error (what a shock, no?)
4308 10: Absolute 1:8 only
4309 20: Absolute 0:7 only
4310 30: absolute 0:15 only
4311 40: Absolute 0:31 only
4312 50: absolute 0:127 only
4313 55: absolute -64:63 only
4314 60: absolute -128:127 only
4315 70: absolute 0:4095 only
4322 struct m68k_exp
*exp
;
4325 if (exp
->exp
.X_op
== O_absent
)
4327 /* Do the same thing the VAX asm does */
4328 op (exp
) = O_constant
;
4334 as_warn ("expression out of range: defaulting to 1");
4338 else if (exp
->exp
.X_op
== O_constant
)
4343 if (offs (exp
) < 1 || offs (exp
) > 8)
4345 as_warn ("expression out of range: defaulting to 1");
4350 if (offs (exp
) < 0 || offs (exp
) > 7)
4354 if (offs (exp
) < 0 || offs (exp
) > 15)
4358 if (offs (exp
) < 0 || offs (exp
) > 32)
4362 if (offs (exp
) < 0 || offs (exp
) > 127)
4366 if (offs (exp
) < -64 || offs (exp
) > 63)
4370 if (offs (exp
) < -128 || offs (exp
) > 127)
4374 if (offs (exp
) < 0 || offs (exp
) > 4095)
4377 as_warn ("expression out of range: defaulting to 0");
4385 else if (exp
->exp
.X_op
== O_big
)
4387 if (offs (exp
) <= 0 /* flonum */
4388 && (ok
== 80 /* no bignums */
4389 || (ok
> 10 /* small-int ranges including 0 ok */
4390 /* If we have a flonum zero, a zero integer should
4391 do as well (e.g., in moveq). */
4392 && generic_floating_point_number
.exponent
== 0
4393 && generic_floating_point_number
.low
[0] == 0)))
4395 /* HACK! Turn it into a long */
4396 LITTLENUM_TYPE words
[6];
4398 gen_to_words (words
, 2, 8L); /* These numbers are magic! */
4399 op (exp
) = O_constant
;
4402 offs (exp
) = words
[1] | (words
[0] << 16);
4406 op (exp
) = O_constant
;
4409 offs (exp
) = (ok
== 10) ? 1 : 0;
4410 as_warn ("Can't deal with expression; defaulting to %ld",
4416 if (ok
>= 10 && ok
<= 70)
4418 op (exp
) = O_constant
;
4421 offs (exp
) = (ok
== 10) ? 1 : 0;
4422 as_warn ("Can't deal with expression; defaulting to %ld",
4427 if (exp
->size
!= SIZE_UNSPEC
)
4435 if (!isbyte (offs (exp
)))
4436 as_warn ("expression doesn't fit in BYTE");
4439 if (!isword (offs (exp
)))
4440 as_warn ("expression doesn't fit in WORD");
4448 /* These are the back-ends for the various machine dependent pseudo-ops. */
4449 void demand_empty_rest_of_line (); /* Hate those extra verbose names */
4455 subseg_set (data_section
, 1);
4456 demand_empty_rest_of_line ();
4463 subseg_set (data_section
, 2);
4464 demand_empty_rest_of_line ();
4471 /* We don't support putting frags in the BSS segment, we fake it
4472 by marking in_bss, then looking at s_skip for clues. */
4474 subseg_set (bss_section
, 0);
4475 demand_empty_rest_of_line ();
4483 register long temp_fill
;
4485 temp
= 1; /* JF should be 2? */
4486 temp_fill
= get_absolute_expression ();
4487 if (!need_pass_2
) /* Never make frag if expect extra pass. */
4488 frag_align (temp
, (int) temp_fill
);
4489 demand_empty_rest_of_line ();
4496 demand_empty_rest_of_line ();
4499 /* Pseudo-ops handled for MRI compatibility. */
4501 /* Handle an MRI style chip specification. */
4510 s
= input_line_pointer
;
4511 c
= get_symbol_end ();
4512 for (i
= 0; i
< n_archs
; i
++)
4513 if (strcasecmp (s
, archs
[i
].name
) == 0)
4517 as_bad ("%s: unrecognized processor name", s
);
4518 *input_line_pointer
= c
;
4519 ignore_rest_of_line ();
4522 *input_line_pointer
= c
;
4524 if (*input_line_pointer
== '/')
4525 current_architecture
= 0;
4527 current_architecture
&= m68881
| m68851
;
4528 current_architecture
|= archs
[i
].arch
;
4530 while (*input_line_pointer
== '/')
4532 ++input_line_pointer
;
4533 s
= input_line_pointer
;
4534 c
= get_symbol_end ();
4535 if (strcmp (s
, "68881") == 0)
4536 current_architecture
|= m68881
;
4537 else if (strcmp (s
, "68851") == 0)
4538 current_architecture
|= m68851
;
4539 *input_line_pointer
= c
;
4543 /* The MRI CHIP pseudo-op. */
4553 stop
= mri_comment_field (&stopc
);
4556 mri_comment_end (stop
, stopc
);
4557 demand_empty_rest_of_line ();
4560 /* The MRI FOPT pseudo-op. */
4568 if (strncasecmp (input_line_pointer
, "ID=", 3) == 0)
4572 input_line_pointer
+= 3;
4573 temp
= get_absolute_expression ();
4574 if (temp
< 0 || temp
> 7)
4575 as_bad ("bad coprocessor id");
4577 m68k_float_copnum
= COP0
+ temp
;
4581 as_bad ("unrecognized fopt option");
4582 ignore_rest_of_line ();
4586 demand_empty_rest_of_line ();
4589 /* The structure used to handle the MRI OPT pseudo-op. */
4593 /* The name of the option. */
4596 /* If this is not NULL, just call this function. The first argument
4597 is the ARG field of this structure, the second argument is
4598 whether the option was negated. */
4599 void (*pfn
) PARAMS ((int arg
, int on
));
4601 /* If this is not NULL, and the PFN field is NULL, set the variable
4602 this points to. Set it to the ARG field if the option was not
4603 negated, and the NOTARG field otherwise. */
4606 /* The value to pass to PFN or to assign to *PVAR. */
4609 /* The value to assign to *PVAR if the option is negated. If PFN is
4610 NULL, and PVAR is not NULL, and ARG and NOTARG are the same, then
4611 the option may not be negated. */
4615 /* The table used to handle the MRI OPT pseudo-op. */
4617 static void skip_to_comma
PARAMS ((int, int));
4618 static void opt_nest
PARAMS ((int, int));
4619 static void opt_chip
PARAMS ((int, int));
4620 static void opt_list
PARAMS ((int, int));
4621 static void opt_list_symbols
PARAMS ((int, int));
4623 static const struct opt_action opt_table
[] =
4625 { "abspcadd", 0, &m68k_abspcadd
, 1, 0 },
4627 /* We do relaxing, so there is little use for these options. */
4628 { "b", 0, 0, 0, 0 },
4629 { "brs", 0, 0, 0, 0 },
4630 { "brb", 0, 0, 0, 0 },
4631 { "brl", 0, 0, 0, 0 },
4632 { "brw", 0, 0, 0, 0 },
4634 { "c", 0, 0, 0, 0 },
4635 { "cex", 0, 0, 0, 0 },
4636 { "case", 0, &symbols_case_sensitive
, 1, 0 },
4637 { "cl", 0, 0, 0, 0 },
4638 { "cre", 0, 0, 0, 0 },
4639 { "d", 0, &flag_keep_locals
, 1, 0 },
4640 { "e", 0, 0, 0, 0 },
4641 { "f", 0, &flag_short_refs
, 1, 0 },
4642 { "frs", 0, &flag_short_refs
, 1, 0 },
4643 { "frl", 0, &flag_short_refs
, 0, 1 },
4644 { "g", 0, 0, 0, 0 },
4645 { "i", 0, 0, 0, 0 },
4646 { "m", 0, 0, 0, 0 },
4647 { "mex", 0, 0, 0, 0 },
4648 { "mc", 0, 0, 0, 0 },
4649 { "md", 0, 0, 0, 0 },
4650 { "nest", opt_nest
, 0, 0, 0 },
4651 { "next", skip_to_comma
, 0, 0, 0 },
4652 { "o", 0, 0, 0, 0 },
4653 { "old", 0, 0, 0, 0 },
4654 { "op", skip_to_comma
, 0, 0, 0 },
4655 { "pco", 0, 0, 0, 0 },
4656 { "p", opt_chip
, 0, 0, 0 },
4657 { "pcr", 0, 0, 0, 0 },
4658 { "pcs", 0, 0, 0, 0 },
4659 { "r", 0, 0, 0, 0 },
4660 { "quick", 0, &m68k_quick
, 1, 0 },
4661 { "rel32", 0, &m68k_rel32
, 1, 0 },
4662 { "s", opt_list
, 0, 0, 0 },
4663 { "t", opt_list_symbols
, 0, 0, 0 },
4664 { "w", 0, &flag_no_warnings
, 0, 1 },
4668 #define OPTCOUNT (sizeof opt_table / sizeof opt_table[0])
4670 /* The MRI OPT pseudo-op. */
4682 const struct opt_action
*o
;
4687 if (*input_line_pointer
== '-')
4689 ++input_line_pointer
;
4692 else if (strncasecmp (input_line_pointer
, "NO", 2) == 0)
4694 input_line_pointer
+= 2;
4698 s
= input_line_pointer
;
4699 c
= get_symbol_end ();
4701 for (i
= 0, o
= opt_table
; i
< OPTCOUNT
; i
++, o
++)
4703 if (strcasecmp (s
, o
->name
) == 0)
4707 /* Restore input_line_pointer now in case the option
4709 *input_line_pointer
= c
;
4710 (*o
->pfn
) (o
->arg
, t
);
4712 else if (o
->pvar
!= NULL
)
4714 if (! t
&& o
->arg
== o
->notarg
)
4715 as_bad ("option `%s' may not be negated", s
);
4716 *input_line_pointer
= c
;
4717 *o
->pvar
= t
? o
->arg
: o
->notarg
;
4720 *input_line_pointer
= c
;
4726 as_bad ("option `%s' not recognized", s
);
4727 *input_line_pointer
= c
;
4730 while (*input_line_pointer
++ == ',');
4732 /* Move back to terminating character. */
4733 --input_line_pointer
;
4734 demand_empty_rest_of_line ();
4737 /* Skip ahead to a comma. This is used for OPT options which we do
4738 not suppor tand which take arguments. */
4741 skip_to_comma (arg
, on
)
4745 while (*input_line_pointer
!= ','
4746 && ! is_end_of_line
[(unsigned char) *input_line_pointer
])
4747 ++input_line_pointer
;
4750 /* Handle the OPT NEST=depth option. */
4757 if (*input_line_pointer
!= '=')
4759 as_bad ("bad format of OPT NEST=depth");
4763 ++input_line_pointer
;
4764 max_macro_nest
= get_absolute_expression ();
4767 /* Handle the OPT P=chip option. */
4774 if (*input_line_pointer
!= '=')
4776 /* This is just OPT P, which we do not support. */
4780 ++input_line_pointer
;
4784 /* Handle the OPT S option. */
4794 /* Handle the OPT T option. */
4797 opt_list_symbols (arg
, on
)
4802 listing
|= LISTING_SYMBOLS
;
4804 listing
&=~ LISTING_SYMBOLS
;
4807 /* Handle the MRI REG pseudo-op. */
4820 if (line_label
== NULL
)
4822 as_bad ("missing label");
4823 ignore_rest_of_line ();
4828 stop
= mri_comment_field (&stopc
);
4832 s
= input_line_pointer
;
4833 while (isalnum ((unsigned char) *input_line_pointer
)
4834 #ifdef REGISTER_PREFIX
4835 || *input_line_pointer
== REGISTER_PREFIX
4837 || *input_line_pointer
== '/'
4838 || *input_line_pointer
== '-')
4839 ++input_line_pointer
;
4840 c
= *input_line_pointer
;
4841 *input_line_pointer
= '\0';
4843 if (m68k_ip_op (s
, &rop
) != 0)
4845 if (rop
.error
== NULL
)
4846 as_bad ("bad register list");
4848 as_bad ("bad register list: %s", rop
.error
);
4849 *input_line_pointer
= c
;
4850 ignore_rest_of_line ();
4854 *input_line_pointer
= c
;
4856 if (rop
.mode
== REGLST
)
4858 else if (rop
.mode
== DREG
)
4859 mask
= 1 << (rop
.reg
- DATA0
);
4860 else if (rop
.mode
== AREG
)
4861 mask
= 1 << (rop
.reg
- ADDR0
+ 8);
4862 else if (rop
.mode
== FPREG
)
4863 mask
= 1 << (rop
.reg
- FP0
+ 16);
4864 else if (rop
.mode
== CONTROL
4867 else if (rop
.mode
== CONTROL
4870 else if (rop
.mode
== CONTROL
4875 as_bad ("bad register list");
4876 ignore_rest_of_line ();
4880 S_SET_SEGMENT (line_label
, absolute_section
);
4881 S_SET_VALUE (line_label
, mask
);
4882 line_label
->sy_frag
= &zero_address_frag
;
4885 mri_comment_end (stop
, stopc
);
4887 demand_empty_rest_of_line ();
4890 /* This structure is used for the MRI SAVE and RESTORE pseudo-ops. */
4894 struct save_opts
*next
;
4896 int symbols_case_sensitive
;
4904 /* FIXME: We don't save OPT S. */
4907 /* This variable holds the stack of saved options. */
4909 static struct save_opts
*save_stack
;
4911 /* The MRI SAVE pseudo-op. */
4917 struct save_opts
*s
;
4919 s
= (struct save_opts
*) xmalloc (sizeof (struct save_opts
));
4920 s
->abspcadd
= m68k_abspcadd
;
4921 s
->symbols_case_sensitive
= symbols_case_sensitive
;
4922 s
->keep_locals
= flag_keep_locals
;
4923 s
->short_refs
= flag_short_refs
;
4924 s
->architecture
= current_architecture
;
4925 s
->quick
= m68k_quick
;
4926 s
->rel32
= m68k_rel32
;
4927 s
->listing
= listing
;
4928 s
->no_warnings
= flag_no_warnings
;
4930 s
->next
= save_stack
;
4933 demand_empty_rest_of_line ();
4936 /* The MRI RESTORE pseudo-op. */
4942 struct save_opts
*s
;
4944 if (save_stack
== NULL
)
4946 as_bad ("restore without save");
4947 ignore_rest_of_line ();
4952 save_stack
= s
->next
;
4954 m68k_abspcadd
= s
->abspcadd
;
4955 symbols_case_sensitive
= s
->symbols_case_sensitive
;
4956 flag_keep_locals
= s
->keep_locals
;
4957 flag_short_refs
= s
->short_refs
;
4958 current_architecture
= s
->architecture
;
4959 m68k_quick
= s
->quick
;
4960 m68k_rel32
= s
->rel32
;
4961 listing
= s
->listing
;
4962 flag_no_warnings
= s
->no_warnings
;
4966 demand_empty_rest_of_line ();
4969 /* Types of MRI structured control directives. */
4971 enum mri_control_type
4979 /* This structure is used to stack the MRI structured control
4982 struct mri_control_info
4984 /* The directive within which this one is enclosed. */
4985 struct mri_control_info
*outer
;
4987 /* The type of directive. */
4988 enum mri_control_type type
;
4990 /* Whether an ELSE has been in an IF. */
4993 /* The add or sub statement at the end of a FOR. */
4996 /* The label of the top of a FOR or REPEAT loop. */
4999 /* The label to jump to for the next iteration, or the else
5000 expression of a conditional. */
5003 /* The label to jump to to break out of the loop, or the label past
5004 the end of a conditional. */
5008 /* The stack of MRI structured control directives. */
5010 static struct mri_control_info
*mri_control_stack
;
5012 /* The current MRI structured control directive index number, used to
5013 generate label names. */
5015 static int mri_control_index
;
5017 /* Some function prototypes. */
5019 static char *mri_control_label
PARAMS ((void));
5020 static struct mri_control_info
*push_mri_control
5021 PARAMS ((enum mri_control_type
));
5022 static void pop_mri_control
PARAMS ((void));
5023 static int parse_mri_condition
PARAMS ((int *));
5024 static int parse_mri_control_operand
5025 PARAMS ((int *, char **, char **, char **, char **));
5026 static int swap_mri_condition
PARAMS ((int));
5027 static int reverse_mri_condition
PARAMS ((int));
5028 static void build_mri_control_operand
5029 PARAMS ((int, int, char *, char *, char *, char *, const char *,
5030 const char *, int));
5031 static void parse_mri_control_expression
5032 PARAMS ((char *, int, const char *, const char *, int));
5034 /* Generate a new MRI label structured control directive label name. */
5037 mri_control_label ()
5041 n
= (char *) xmalloc (20);
5042 sprintf (n
, "%smc%d", FAKE_LABEL_NAME
, mri_control_index
);
5043 ++mri_control_index
;
5047 /* Create a new MRI structured control directive. */
5049 static struct mri_control_info
*
5050 push_mri_control (type
)
5051 enum mri_control_type type
;
5053 struct mri_control_info
*n
;
5055 n
= (struct mri_control_info
*) xmalloc (sizeof (struct mri_control_info
));
5059 if (type
== mri_if
|| type
== mri_while
)
5062 n
->top
= mri_control_label ();
5063 n
->next
= mri_control_label ();
5064 n
->bottom
= mri_control_label ();
5066 n
->outer
= mri_control_stack
;
5067 mri_control_stack
= n
;
5072 /* Pop off the stack of MRI structured control directives. */
5077 struct mri_control_info
*n
;
5079 n
= mri_control_stack
;
5080 mri_control_stack
= n
->outer
;
5088 /* Recognize a condition code in an MRI structured control expression. */
5091 parse_mri_condition (pcc
)
5096 know (*input_line_pointer
== '<');
5098 ++input_line_pointer
;
5099 c1
= *input_line_pointer
++;
5100 c2
= *input_line_pointer
++;
5102 if (*input_line_pointer
!= '>')
5104 as_bad ("syntax error in structured control directive");
5108 ++input_line_pointer
;
5116 *pcc
= (c1
<< 8) | c2
;
5121 /* Parse a single operand in an MRI structured control expression. */
5124 parse_mri_control_operand (pcc
, leftstart
, leftstop
, rightstart
, rightstop
)
5141 if (*input_line_pointer
== '<')
5143 /* It's just a condition code. */
5144 return parse_mri_condition (pcc
);
5147 /* Look ahead for the condition code. */
5148 for (s
= input_line_pointer
; *s
!= '\0'; ++s
)
5150 if (*s
== '<' && s
[1] != '\0' && s
[2] != '\0' && s
[3] == '>')
5155 as_bad ("missing condition code in structured control directive");
5159 *leftstart
= input_line_pointer
;
5161 if (*leftstop
> *leftstart
5162 && ((*leftstop
)[-1] == ' ' || (*leftstop
)[-1] == '\t'))
5165 input_line_pointer
= s
;
5166 if (! parse_mri_condition (pcc
))
5169 /* Look ahead for AND or OR or end of line. */
5170 for (s
= input_line_pointer
; *s
!= '\0'; ++s
)
5172 if ((strncasecmp (s
, "AND", 3) == 0
5173 && (s
[3] == '.' || ! is_part_of_name (s
[3])))
5174 || (strncasecmp (s
, "OR", 2) == 0
5175 && (s
[2] == '.' || ! is_part_of_name (s
[2]))))
5179 *rightstart
= input_line_pointer
;
5181 if (*rightstop
> *rightstart
5182 && ((*rightstop
)[-1] == ' ' || (*rightstop
)[-1] == '\t'))
5185 input_line_pointer
= s
;
5190 #define MCC(b1, b2) (((b1) << 8) | (b2))
5192 /* Swap the sense of a condition. This changes the condition so that
5193 it generates the same result when the operands are swapped. */
5196 swap_mri_condition (cc
)
5201 case MCC ('h', 'i'): return MCC ('c', 's');
5202 case MCC ('l', 's'): return MCC ('c', 'c');
5203 case MCC ('c', 'c'): return MCC ('l', 's');
5204 case MCC ('c', 's'): return MCC ('h', 'i');
5205 case MCC ('p', 'l'): return MCC ('m', 'i');
5206 case MCC ('m', 'i'): return MCC ('p', 'l');
5207 case MCC ('g', 'e'): return MCC ('l', 'e');
5208 case MCC ('l', 't'): return MCC ('g', 't');
5209 case MCC ('g', 't'): return MCC ('l', 't');
5210 case MCC ('l', 'e'): return MCC ('g', 'e');
5215 /* Reverse the sense of a condition. */
5218 reverse_mri_condition (cc
)
5223 case MCC ('h', 'i'): return MCC ('l', 's');
5224 case MCC ('l', 's'): return MCC ('h', 'i');
5225 case MCC ('c', 'c'): return MCC ('c', 's');
5226 case MCC ('c', 's'): return MCC ('c', 'c');
5227 case MCC ('n', 'e'): return MCC ('e', 'q');
5228 case MCC ('e', 'q'): return MCC ('n', 'e');
5229 case MCC ('v', 'c'): return MCC ('v', 's');
5230 case MCC ('v', 's'): return MCC ('v', 'c');
5231 case MCC ('p', 'l'): return MCC ('m', 'i');
5232 case MCC ('m', 'i'): return MCC ('p', 'l');
5233 case MCC ('g', 'e'): return MCC ('l', 't');
5234 case MCC ('l', 't'): return MCC ('g', 'e');
5235 case MCC ('g', 't'): return MCC ('l', 'e');
5236 case MCC ('l', 'e'): return MCC ('g', 't');
5241 /* Build an MRI structured control expression. This generates test
5242 and branch instructions. It goes to TRUELAB if the condition is
5243 true, and to FALSELAB if the condition is false. Exactly one of
5244 TRUELAB and FALSELAB will be NULL, meaning to fall through. QUAL
5245 is the size qualifier for the expression. EXTENT is the size to
5246 use for the branch. */
5249 build_mri_control_operand (qual
, cc
, leftstart
, leftstop
, rightstart
,
5250 rightstop
, truelab
, falselab
, extent
)
5257 const char *truelab
;
5258 const char *falselab
;
5264 if (leftstart
!= NULL
)
5266 struct m68k_op leftop
, rightop
;
5269 /* Swap the compare operands, if necessary, to produce a legal
5270 m68k compare instruction. Comparing a register operand with
5271 a non-register operand requires the register to be on the
5272 right (cmp, cmpa). Comparing an immediate value with
5273 anything requires the immediate value to be on the left
5278 (void) m68k_ip_op (leftstart
, &leftop
);
5283 (void) m68k_ip_op (rightstart
, &rightop
);
5286 if (rightop
.mode
== IMMED
5287 || ((leftop
.mode
== DREG
|| leftop
.mode
== AREG
)
5288 && (rightop
.mode
!= DREG
&& rightop
.mode
!= AREG
)))
5292 cc
= swap_mri_condition (cc
);
5294 leftstart
= rightstart
;
5297 leftstop
= rightstop
;
5302 if (truelab
== NULL
)
5304 cc
= reverse_mri_condition (cc
);
5308 if (leftstart
!= NULL
)
5310 buf
= (char *) xmalloc (20
5311 + (leftstop
- leftstart
)
5312 + (rightstop
- rightstart
));
5320 memcpy (s
, leftstart
, leftstop
- leftstart
);
5321 s
+= leftstop
- leftstart
;
5323 memcpy (s
, rightstart
, rightstop
- rightstart
);
5324 s
+= rightstop
- rightstart
;
5330 buf
= (char *) xmalloc (20 + strlen (truelab
));
5338 strcpy (s
, truelab
);
5343 /* Parse an MRI structured control expression. This generates test
5344 and branch instructions. STOP is where the expression ends. It
5345 goes to TRUELAB if the condition is true, and to FALSELAB if the
5346 condition is false. Exactly one of TRUELAB and FALSELAB will be
5347 NULL, meaning to fall through. QUAL is the size qualifier for the
5348 expression. EXTENT is the size to use for the branch. */
5351 parse_mri_control_expression (stop
, qual
, truelab
, falselab
, extent
)
5354 const char *truelab
;
5355 const char *falselab
;
5368 if (! parse_mri_control_operand (&cc
, &leftstart
, &leftstop
,
5369 &rightstart
, &rightstop
))
5375 if (strncasecmp (input_line_pointer
, "AND", 3) == 0)
5379 if (falselab
!= NULL
)
5382 flab
= mri_control_label ();
5384 build_mri_control_operand (qual
, cc
, leftstart
, leftstop
, rightstart
,
5385 rightstop
, (const char *) NULL
, flab
, extent
);
5387 input_line_pointer
+= 3;
5388 if (*input_line_pointer
!= '.'
5389 || input_line_pointer
[1] == '\0')
5393 qual
= input_line_pointer
[1];
5394 input_line_pointer
+= 2;
5397 if (! parse_mri_control_operand (&cc
, &leftstart
, &leftstop
,
5398 &rightstart
, &rightstop
))
5404 build_mri_control_operand (qual
, cc
, leftstart
, leftstop
, rightstart
,
5405 rightstop
, truelab
, falselab
, extent
);
5407 if (falselab
== NULL
)
5410 else if (strncasecmp (input_line_pointer
, "OR", 2) == 0)
5414 if (truelab
!= NULL
)
5417 tlab
= mri_control_label ();
5419 build_mri_control_operand (qual
, cc
, leftstart
, leftstop
, rightstart
,
5420 rightstop
, tlab
, (const char *) NULL
, extent
);
5422 input_line_pointer
+= 2;
5423 if (*input_line_pointer
!= '.'
5424 || input_line_pointer
[1] == '\0')
5428 qual
= input_line_pointer
[1];
5429 input_line_pointer
+= 2;
5432 if (! parse_mri_control_operand (&cc
, &leftstart
, &leftstop
,
5433 &rightstart
, &rightstop
))
5439 build_mri_control_operand (qual
, cc
, leftstart
, leftstop
, rightstart
,
5440 rightstop
, truelab
, falselab
, extent
);
5442 if (truelab
== NULL
)
5447 build_mri_control_operand (qual
, cc
, leftstart
, leftstop
, rightstart
,
5448 rightstop
, truelab
, falselab
, extent
);
5452 if (input_line_pointer
!= stop
)
5453 as_bad ("syntax error in structured control directive");
5456 /* Handle the MRI IF pseudo-op. This may be a structured control
5457 directive, or it may be a regular assembler conditional, depending
5466 struct mri_control_info
*n
;
5468 /* A structured control directive must end with THEN with an
5469 optional qualifier. */
5470 s
= input_line_pointer
;
5471 while (! is_end_of_line
[(unsigned char) *s
]
5472 && (! flag_mri
|| *s
!= '*'))
5475 while (s
> input_line_pointer
&& (*s
== ' ' || *s
== '\t'))
5478 if (s
- input_line_pointer
> 1
5482 if (s
- input_line_pointer
< 3
5483 || strncasecmp (s
- 3, "THEN", 4) != 0)
5487 as_bad ("missing then");
5488 ignore_rest_of_line ();
5492 /* It's a conditional. */
5497 /* Since this might be a conditional if, this pseudo-op will be
5498 called even if we are supported to be ignoring input. Double
5499 check now. Clobber *input_line_pointer so that ignore_input
5500 thinks that this is not a special pseudo-op. */
5501 c
= *input_line_pointer
;
5502 *input_line_pointer
= 0;
5503 if (ignore_input ())
5505 *input_line_pointer
= c
;
5506 while (! is_end_of_line
[(unsigned char) *input_line_pointer
])
5507 ++input_line_pointer
;
5508 demand_empty_rest_of_line ();
5511 *input_line_pointer
= c
;
5513 n
= push_mri_control (mri_if
);
5515 parse_mri_control_expression (s
- 3, qual
, (const char *) NULL
,
5516 n
->next
, s
[1] == '.' ? s
[2] : '\0');
5519 input_line_pointer
= s
+ 3;
5521 input_line_pointer
= s
+ 1;
5525 while (! is_end_of_line
[(unsigned char) *input_line_pointer
])
5526 ++input_line_pointer
;
5529 demand_empty_rest_of_line ();
5532 /* Handle the MRI else pseudo-op. If we are currently doing an MRI
5533 structured IF, associate the ELSE with the IF. Otherwise, assume
5534 it is a conditional else. */
5545 && (mri_control_stack
== NULL
5546 || mri_control_stack
->type
!= mri_if
5547 || mri_control_stack
->else_seen
))
5553 c
= *input_line_pointer
;
5554 *input_line_pointer
= 0;
5555 if (ignore_input ())
5557 *input_line_pointer
= c
;
5558 while (! is_end_of_line
[(unsigned char) *input_line_pointer
])
5559 ++input_line_pointer
;
5560 demand_empty_rest_of_line ();
5563 *input_line_pointer
= c
;
5565 if (mri_control_stack
== NULL
5566 || mri_control_stack
->type
!= mri_if
5567 || mri_control_stack
->else_seen
)
5569 as_bad ("else without matching if");
5570 ignore_rest_of_line ();
5574 mri_control_stack
->else_seen
= 1;
5576 buf
= (char *) xmalloc (20 + strlen (mri_control_stack
->bottom
));
5579 sprintf (buf
, "bra%s %s", q
, mri_control_stack
->bottom
);
5583 colon (mri_control_stack
->next
);
5587 while (! is_end_of_line
[(unsigned char) *input_line_pointer
])
5588 ++input_line_pointer
;
5591 demand_empty_rest_of_line ();
5594 /* Handle the MRI ENDI pseudo-op. */
5600 if (mri_control_stack
== NULL
5601 || mri_control_stack
->type
!= mri_if
)
5603 as_bad ("endi without matching if");
5604 ignore_rest_of_line ();
5608 /* ignore_input will not return true for ENDI, so we don't need to
5609 worry about checking it again here. */
5611 if (! mri_control_stack
->else_seen
)
5612 colon (mri_control_stack
->next
);
5613 colon (mri_control_stack
->bottom
);
5619 while (! is_end_of_line
[(unsigned char) *input_line_pointer
])
5620 ++input_line_pointer
;
5623 demand_empty_rest_of_line ();
5626 /* Handle the MRI BREAK pseudo-op. */
5629 s_mri_break (extent
)
5632 struct mri_control_info
*n
;
5636 n
= mri_control_stack
;
5638 && n
->type
!= mri_for
5639 && n
->type
!= mri_repeat
5640 && n
->type
!= mri_while
)
5644 as_bad ("break outside of structured loop");
5645 ignore_rest_of_line ();
5649 buf
= (char *) xmalloc (20 + strlen (n
->bottom
));
5652 sprintf (buf
, "bra%s %s", ex
, n
->bottom
);
5658 while (! is_end_of_line
[(unsigned char) *input_line_pointer
])
5659 ++input_line_pointer
;
5662 demand_empty_rest_of_line ();
5665 /* Handle the MRI NEXT pseudo-op. */
5671 struct mri_control_info
*n
;
5675 n
= mri_control_stack
;
5677 && n
->type
!= mri_for
5678 && n
->type
!= mri_repeat
5679 && n
->type
!= mri_while
)
5683 as_bad ("next outside of structured loop");
5684 ignore_rest_of_line ();
5688 buf
= (char *) xmalloc (20 + strlen (n
->next
));
5691 sprintf (buf
, "bra%s %s", ex
, n
->next
);
5697 while (! is_end_of_line
[(unsigned char) *input_line_pointer
])
5698 ++input_line_pointer
;
5701 demand_empty_rest_of_line ();
5704 /* Handle the MRI FOR pseudo-op. */
5710 const char *varstart
, *varstop
;
5711 const char *initstart
, *initstop
;
5712 const char *endstart
, *endstop
;
5713 const char *bystart
, *bystop
;
5717 struct mri_control_info
*n
;
5723 FOR.q var = init { TO | DOWNTO } end [ BY by ] DO.e
5727 varstart
= input_line_pointer
;
5729 /* Look for the '='. */
5730 while (! is_end_of_line
[(unsigned char) *input_line_pointer
]
5731 && *input_line_pointer
!= '=')
5732 ++input_line_pointer
;
5733 if (*input_line_pointer
!= '=')
5735 as_bad ("missing =");
5736 ignore_rest_of_line ();
5740 varstop
= input_line_pointer
;
5741 if (varstop
> varstart
5742 && (varstop
[-1] == ' ' || varstop
[-1] == '\t'))
5745 ++input_line_pointer
;
5747 initstart
= input_line_pointer
;
5749 /* Look for TO or DOWNTO. */
5752 while (! is_end_of_line
[(unsigned char) *input_line_pointer
])
5754 if (strncasecmp (input_line_pointer
, "TO", 2) == 0
5755 && ! is_part_of_name (input_line_pointer
[2]))
5757 initstop
= input_line_pointer
;
5758 input_line_pointer
+= 2;
5761 if (strncasecmp (input_line_pointer
, "DOWNTO", 6) == 0
5762 && ! is_part_of_name (input_line_pointer
[6]))
5764 initstop
= input_line_pointer
;
5766 input_line_pointer
+= 6;
5769 ++input_line_pointer
;
5771 if (initstop
== NULL
)
5773 as_bad ("missing to or downto");
5774 ignore_rest_of_line ();
5777 if (initstop
> initstart
5778 && (initstop
[-1] == ' ' || initstop
[-1] == '\t'))
5782 endstart
= input_line_pointer
;
5784 /* Look for BY or DO. */
5787 while (! is_end_of_line
[(unsigned char) *input_line_pointer
])
5789 if (strncasecmp (input_line_pointer
, "BY", 2) == 0
5790 && ! is_part_of_name (input_line_pointer
[2]))
5792 endstop
= input_line_pointer
;
5794 input_line_pointer
+= 2;
5797 if (strncasecmp (input_line_pointer
, "DO", 2) == 0
5798 && (input_line_pointer
[2] == '.'
5799 || ! is_part_of_name (input_line_pointer
[2])))
5801 endstop
= input_line_pointer
;
5802 input_line_pointer
+= 2;
5805 ++input_line_pointer
;
5807 if (endstop
== NULL
)
5809 as_bad ("missing do");
5810 ignore_rest_of_line ();
5813 if (endstop
> endstart
5814 && (endstop
[-1] == ' ' || endstop
[-1] == '\t'))
5820 bystop
= bystart
+ 2;
5825 bystart
= input_line_pointer
;
5829 while (! is_end_of_line
[(unsigned char) *input_line_pointer
])
5831 if (strncasecmp (input_line_pointer
, "DO", 2) == 0
5832 && (input_line_pointer
[2] == '.'
5833 || ! is_part_of_name (input_line_pointer
[2])))
5835 bystop
= input_line_pointer
;
5836 input_line_pointer
+= 2;
5839 ++input_line_pointer
;
5843 as_bad ("missing do");
5844 ignore_rest_of_line ();
5847 if (bystop
> bystart
5848 && (bystop
[-1] == ' ' || bystop
[-1] == '\t'))
5852 if (*input_line_pointer
!= '.')
5856 extent
= input_line_pointer
[1];
5857 input_line_pointer
+= 2;
5860 /* We have fully parsed the FOR operands. Now build the loop. */
5862 n
= push_mri_control (mri_for
);
5864 buf
= (char *) xmalloc (50 + (input_line_pointer
- varstart
));
5875 memcpy (s
, initstart
, initstop
- initstart
);
5876 s
+= initstop
- initstart
;
5878 memcpy (s
, varstart
, varstop
- varstart
);
5879 s
+= varstop
- varstart
;
5893 memcpy (s
, endstart
, endstop
- endstart
);
5894 s
+= endstop
- endstart
;
5896 memcpy (s
, varstart
, varstop
- varstart
);
5897 s
+= varstop
- varstart
;
5905 sprintf (buf
, "blt%s %s", ex
, n
->bottom
);
5907 sprintf (buf
, "bgt%s %s", ex
, n
->bottom
);
5910 /* Put together the add or sub instruction used by ENDF. */
5920 memcpy (s
, bystart
, bystop
- bystart
);
5921 s
+= bystop
- bystart
;
5923 memcpy (s
, varstart
, varstop
- varstart
);
5924 s
+= varstop
- varstart
;
5930 while (! is_end_of_line
[(unsigned char) *input_line_pointer
])
5931 ++input_line_pointer
;
5934 demand_empty_rest_of_line ();
5937 /* Handle the MRI ENDF pseudo-op. */
5943 if (mri_control_stack
== NULL
5944 || mri_control_stack
->type
!= mri_for
)
5946 as_bad ("endf without for");
5947 ignore_rest_of_line ();
5951 colon (mri_control_stack
->next
);
5953 md_assemble (mri_control_stack
->incr
);
5955 sprintf (mri_control_stack
->incr
, "bra %s", mri_control_stack
->top
);
5956 md_assemble (mri_control_stack
->incr
);
5958 free (mri_control_stack
->incr
);
5960 colon (mri_control_stack
->bottom
);
5966 while (! is_end_of_line
[(unsigned char) *input_line_pointer
])
5967 ++input_line_pointer
;
5970 demand_empty_rest_of_line ();
5973 /* Handle the MRI REPEAT pseudo-op. */
5976 s_mri_repeat (ignore
)
5979 struct mri_control_info
*n
;
5981 n
= push_mri_control (mri_repeat
);
5985 while (! is_end_of_line
[(unsigned char) *input_line_pointer
])
5986 ++input_line_pointer
;
5988 demand_empty_rest_of_line ();
5991 /* Handle the MRI UNTIL pseudo-op. */
5999 if (mri_control_stack
== NULL
6000 || mri_control_stack
->type
!= mri_repeat
)
6002 as_bad ("until without repeat");
6003 ignore_rest_of_line ();
6007 colon (mri_control_stack
->next
);
6009 for (s
= input_line_pointer
; ! is_end_of_line
[(unsigned char) *s
]; s
++)
6012 parse_mri_control_expression (s
, qual
, (const char *) NULL
,
6013 mri_control_stack
->top
, '\0');
6015 colon (mri_control_stack
->bottom
);
6017 input_line_pointer
= s
;
6023 while (! is_end_of_line
[(unsigned char) *input_line_pointer
])
6024 ++input_line_pointer
;
6027 demand_empty_rest_of_line ();
6030 /* Handle the MRI WHILE pseudo-op. */
6038 struct mri_control_info
*n
;
6040 s
= input_line_pointer
;
6041 while (! is_end_of_line
[(unsigned char) *s
]
6042 && (! flag_mri
|| *s
!= '*'))
6045 while (*s
== ' ' || *s
== '\t')
6047 if (s
- input_line_pointer
> 1
6050 if (s
- input_line_pointer
< 2
6051 || strncasecmp (s
- 1, "DO", 2) != 0)
6053 as_bad ("missing do");
6054 ignore_rest_of_line ();
6058 n
= push_mri_control (mri_while
);
6062 parse_mri_control_expression (s
- 1, qual
, (const char *) NULL
, n
->bottom
,
6063 s
[1] == '.' ? s
[2] : '\0');
6065 input_line_pointer
= s
+ 1;
6066 if (*input_line_pointer
== '.')
6067 input_line_pointer
+= 2;
6071 while (! is_end_of_line
[(unsigned char) *input_line_pointer
])
6072 ++input_line_pointer
;
6075 demand_empty_rest_of_line ();
6078 /* Handle the MRI ENDW pseudo-op. */
6086 if (mri_control_stack
== NULL
6087 || mri_control_stack
->type
!= mri_while
)
6089 as_bad ("endw without while");
6090 ignore_rest_of_line ();
6094 buf
= (char *) xmalloc (20 + strlen (mri_control_stack
->next
));
6095 sprintf (buf
, "bra %s", mri_control_stack
->next
);
6099 colon (mri_control_stack
->bottom
);
6105 while (! is_end_of_line
[(unsigned char) *input_line_pointer
])
6106 ++input_line_pointer
;
6109 demand_empty_rest_of_line ();
6114 * Invocation line includes a switch not recognized by the base assembler.
6115 * See if it's a processor-specific option. These are:
6117 * -[A]m[c]68000, -[A]m[c]68008, -[A]m[c]68010, -[A]m[c]68020, -[A]m[c]68030, -[A]m[c]68040
6118 * -[A]m[c]68881, -[A]m[c]68882, -[A]m[c]68851
6119 * Select the architecture. Instructions or features not
6120 * supported by the selected architecture cause fatal
6121 * errors. More than one may be specified. The default is
6122 * -m68020 -m68851 -m68881. Note that -m68008 is a synonym
6123 * for -m68000, and -m68882 is a synonym for -m68881.
6124 * -[A]m[c]no-68851, -[A]m[c]no-68881
6125 * Don't accept 688?1 instructions. (The "c" is kind of silly,
6126 * so don't use or document it, but that's the way the parsing
6129 * -pic Indicates PIC.
6130 * -k Indicates PIC. (Sun 3 only.)
6135 CONST
char *md_shortopts
= "lSA:m:kQ:V";
6137 CONST
char *md_shortopts
= "lSA:m:k";
6140 struct option md_longopts
[] = {
6141 #define OPTION_PIC (OPTION_MD_BASE)
6142 {"pic", no_argument
, NULL
, OPTION_PIC
},
6143 #define OPTION_REGISTER_PREFIX_OPTIONAL (OPTION_MD_BASE + 1)
6144 {"register-prefix-optional", no_argument
, NULL
,
6145 OPTION_REGISTER_PREFIX_OPTIONAL
},
6146 {NULL
, no_argument
, NULL
, 0}
6148 size_t md_longopts_size
= sizeof(md_longopts
);
6151 md_parse_option (c
, arg
)
6157 case 'l': /* -l means keep external to 2 bit offset
6158 rather than 16 bit one */
6159 flag_short_refs
= 1;
6162 case 'S': /* -S means that jbsr's always turn into
6164 flag_long_jumps
= 1;
6170 /* intentional fall-through */
6173 if (arg
[0] == 'n' && arg
[1] == 'o' && arg
[2] == '-')
6177 const char *oarg
= arg
;
6183 if (arg
[0] == 'c' && arg
[1] == '6')
6186 for (i
= 0; i
< n_archs
; i
++)
6187 if (!strcmp (arg
, archs
[i
].name
))
6192 as_bad ("unrecognized option `%s'", oarg
);
6195 arch
= archs
[i
].arch
;
6198 else if (arch
== m68851
)
6207 if (arg
[0] == 'c' && arg
[1] == '6')
6210 for (i
= 0; i
< n_archs
; i
++)
6211 if (!strcmp (arg
, archs
[i
].name
))
6213 unsigned long arch
= archs
[i
].arch
;
6214 if (cpu_of_arch (arch
))
6215 /* It's a cpu spec. */
6217 current_architecture
&= ~m68000up
;
6218 current_architecture
|= arch
;
6220 else if (arch
== m68881
)
6222 current_architecture
|= m68881
;
6225 else if (arch
== m68851
)
6227 current_architecture
|= m68851
;
6237 as_bad ("unrecognized architecture specification `%s'", arg
);
6246 break; /* -pic, Position Independent Code */
6248 case OPTION_REGISTER_PREFIX_OPTIONAL
:
6249 flag_reg_prefix_optional
= 1;
6250 reg_prefix_optional_seen
= 1;
6253 /* -V: SVR4 argument to print version ID. */
6255 print_version_id ();
6258 /* -Qy, -Qn: SVR4 arguments controlling whether a .comment section
6259 should be emitted or not. FIXME: Not implemented. */
6271 md_show_usage (stream
)
6276 -l use 1 word for refs to undefined symbols [default 2]\n\
6277 -m68000 | -m68008 | -m68010 | -m68020 | -m68030 | -m68040 | -m68060\n\
6278 | -m68302 | -m68331 | -m68332 | -m68333 | -m68340 | -m68360\n\
6280 specify variant of 680X0 architecture [default 68020]\n\
6281 -m68881 | -m68882 | -mno-68881 | -mno-68882\n\
6282 target has/lacks floating-point coprocessor\n\
6283 [default yes for 68020, 68030, and cpu32]\n");
6285 -m68851 | -mno-68851\n\
6286 target has/lacks memory-management unit coprocessor\n\
6287 [default yes for 68020 and up]\n\
6288 -pic, -k generate position independent code\n\
6289 -S turn jbsr into jsr\n\
6290 --register-prefix-optional\n\
6291 recognize register names without prefix character\n");
6296 /* TEST2: Test md_assemble() */
6297 /* Warning, this routine probably doesn't work anymore */
6301 struct m68k_it the_ins
;
6309 if (!gets (buf
) || !*buf
)
6311 if (buf
[0] == '|' || buf
[1] == '.')
6313 for (cp
= buf
; *cp
; cp
++)
6318 memset (&the_ins
, '\0', sizeof (the_ins
));
6319 m68k_ip (&the_ins
, buf
);
6322 printf ("Error %s in %s\n", the_ins
.error
, buf
);
6326 printf ("Opcode(%d.%s): ", the_ins
.numo
, the_ins
.args
);
6327 for (n
= 0; n
< the_ins
.numo
; n
++)
6328 printf (" 0x%x", the_ins
.opcode
[n
] & 0xffff);
6330 print_the_insn (&the_ins
.opcode
[0], stdout
);
6331 (void) putchar ('\n');
6333 for (n
= 0; n
< strlen (the_ins
.args
) / 2; n
++)
6335 if (the_ins
.operands
[n
].error
)
6337 printf ("op%d Error %s in %s\n", n
, the_ins
.operands
[n
].error
, buf
);
6340 printf ("mode %d, reg %d, ", the_ins
.operands
[n
].mode
, the_ins
.operands
[n
].reg
);
6341 if (the_ins
.operands
[n
].b_const
)
6342 printf ("Constant: '%.*s', ", 1 + the_ins
.operands
[n
].e_const
- the_ins
.operands
[n
].b_const
, the_ins
.operands
[n
].b_const
);
6343 printf ("ireg %d, isiz %d, imul %d, ", the_ins
.operands
[n
].ireg
, the_ins
.operands
[n
].isiz
, the_ins
.operands
[n
].imul
);
6344 if (the_ins
.operands
[n
].b_iadd
)
6345 printf ("Iadd: '%.*s',", 1 + the_ins
.operands
[n
].e_iadd
- the_ins
.operands
[n
].b_iadd
, the_ins
.operands
[n
].b_iadd
);
6346 (void) putchar ('\n');
6358 while (*str
&& *str
!= ' ')
6360 if (str
[-1] == ':' || str
[1] == '=')
6367 /* Possible states for relaxation:
6369 0 0 branch offset byte (bra, etc)
6373 1 0 indexed offsets byte a0@(32,d4:w:1) etc
6377 2 0 two-offset index word-word a0@(32,d4)@(45) etc
6384 /* We have no need to default values of symbols. */
6388 md_undefined_symbol (name
)
6394 /* Round up a section size to the appropriate boundary. */
6396 md_section_align (segment
, size
)
6400 return size
; /* Byte alignment is fine */
6403 /* Exactly what point is a PC-relative offset relative TO?
6404 On the 68k, it is relative to the address of the first extension
6405 word. The difference between the addresses of the offset and the
6406 first extension word is stored in fx_pcrel_adjust. */
6408 md_pcrel_from (fixP
)
6413 /* Because fx_pcrel_adjust is a char, and may be unsigned, we store
6415 adjust
= fixP
->fx_pcrel_adjust
;
6418 return fixP
->fx_where
+ fixP
->fx_frag
->fr_address
- adjust
;
6421 #ifndef BFD_ASSEMBLER
6424 tc_coff_symbol_emit_hook (ignore
)
6430 tc_coff_sizemachdep (frag
)
6433 switch (frag
->fr_subtype
& 0x3)
6448 /* end of tc-m68k.c */