* elf32-ppc.c (LWZU_0_X_11): Delete.
[binutils.git] / gas / config / tc-m88k.c
blob37d1bbbb8bb77d165a17afc7b84fc23875d76bc1
1 /* m88k.c -- Assembler for the Motorola 88000
2 Contributed by Devon Bowen of Buffalo University
3 and Torbjorn Granlund of the Swedish Institute of Computer Science.
4 Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999,
5 2000, 2001, 2002, 2003, 2005
6 Free Software Foundation, Inc.
8 This file is part of GAS, the GNU Assembler.
10 GAS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2, or (at your option)
13 any later version.
15 GAS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with GAS; see the file COPYING. If not, write to the Free
22 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
23 02110-1301, USA. */
25 #include "as.h"
26 #include "safe-ctype.h"
27 #include "subsegs.h"
28 #include "m88k-opcode.h"
30 struct field_val_assoc
32 char *name;
33 unsigned val;
36 struct field_val_assoc cr_regs[] =
38 {"PID", 0},
39 {"PSR", 1},
40 {"EPSR", 2},
41 {"SSBR", 3},
42 {"SXIP", 4},
43 {"SNIP", 5},
44 {"SFIP", 6},
45 {"VBR", 7},
46 {"DMT0", 8},
47 {"DMD0", 9},
48 {"DMA0", 10},
49 {"DMT1", 11},
50 {"DMD1", 12},
51 {"DMA1", 13},
52 {"DMT2", 14},
53 {"DMD2", 15},
54 {"DMA2", 16},
55 {"SR0", 17},
56 {"SR1", 18},
57 {"SR2", 19},
58 {"SR3", 20},
60 {NULL, 0},
63 struct field_val_assoc fcr_regs[] =
65 {"FPECR", 0},
66 {"FPHS1", 1},
67 {"FPLS1", 2},
68 {"FPHS2", 3},
69 {"FPLS2", 4},
70 {"FPPT", 5},
71 {"FPRH", 6},
72 {"FPRL", 7},
73 {"FPIT", 8},
75 {"FPSR", 62},
76 {"FPCR", 63},
78 {NULL, 0},
81 struct field_val_assoc cmpslot[] =
83 /* Integer Floating point. */
84 {"nc", 0},
85 {"cp", 1},
86 {"eq", 2},
87 {"ne", 3},
88 {"gt", 4},
89 {"le", 5},
90 {"lt", 6},
91 {"ge", 7},
92 {"hi", 8}, {"ou", 8},
93 {"ls", 9}, {"ib", 9},
94 {"lo", 10}, {"in", 10},
95 {"hs", 11}, {"ob", 11},
96 {"be", 12}, {"ue", 12},
97 {"nb", 13}, {"lg", 13},
98 {"he", 14}, {"ug", 14},
99 {"nh", 15}, {"ule", 15},
100 {"ul", 16},
101 {"uge", 17},
103 {NULL, 0},
106 struct field_val_assoc cndmsk[] =
108 {"gt0", 1},
109 {"eq0", 2},
110 {"ge0", 3},
111 {"lt0", 12},
112 {"ne0", 13},
113 {"le0", 14},
115 {NULL, 0},
118 struct m88k_insn
120 unsigned long opcode;
121 expressionS exp;
122 enum reloc_type reloc;
125 extern char *myname;
126 static struct hash_control *op_hash = NULL;
128 /* These bits should be turned off in the first address of every segment. */
129 int md_seg_align = 7;
131 /* These chars start a comment anywhere in a source file (except inside
132 another comment. */
133 const char comment_chars[] = ";";
135 /* These chars only start a comment at the beginning of a line. */
136 const char line_comment_chars[] = "#";
138 const char line_separator_chars[] = "";
140 /* Chars that can be used to separate mant from exp in floating point nums. */
141 const char EXP_CHARS[] = "eE";
143 /* Chars that mean this number is a floating point constant.
144 as in 0f123.456
145 or 0H1.234E-12 (see exp chars above). */
146 const char FLT_CHARS[] = "dDfF";
148 void
149 md_begin (void)
151 const char *retval = NULL;
152 unsigned int i = 0;
154 /* Initialize hash table. */
155 op_hash = hash_new ();
157 while (*m88k_opcodes[i].name)
159 char *name = m88k_opcodes[i].name;
161 /* Hash each mnemonic and record its position. */
162 retval = hash_insert (op_hash, name, &m88k_opcodes[i]);
164 if (retval != NULL)
165 as_fatal (_("Can't hash instruction '%s':%s"),
166 m88k_opcodes[i].name, retval);
168 /* Skip to next unique mnemonic or end of list. */
169 for (i++; !strcmp (m88k_opcodes[i].name, name); i++)
174 const char *md_shortopts = "";
175 struct option md_longopts[] =
177 {NULL, no_argument, NULL, 0}
179 size_t md_longopts_size = sizeof (md_longopts);
182 md_parse_option (int c ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED)
184 return 0;
187 void
188 md_show_usage (FILE *stream ATTRIBUTE_UNUSED)
192 static char *
193 get_o6 (char *param, unsigned *valp)
195 unsigned val;
196 char *save_ptr;
198 save_ptr = input_line_pointer;
199 input_line_pointer = param;
200 val = get_absolute_expression ();
201 param = input_line_pointer;
202 input_line_pointer = save_ptr;
204 if (val & 0x3)
205 as_warn (_("Removed lower 2 bits of expression"));
207 *valp = val;
209 return (param);
212 static char *
213 get_vec9 (char *param, unsigned *valp)
215 unsigned val;
216 char *save_ptr;
218 save_ptr = input_line_pointer;
219 input_line_pointer = param;
220 val = get_absolute_expression ();
221 param = input_line_pointer;
222 input_line_pointer = save_ptr;
224 if (val >= 1 << 9)
225 as_warn (_("Expression truncated to 9 bits"));
227 *valp = val % (1 << 9);
229 return param;
232 static char *
233 get_bf2 (char *param, int bc)
235 int depth = 0;
236 int c;
238 for (;;)
240 c = *param;
241 if (c == 0)
242 return param;
243 else if (c == '(')
244 depth++;
245 else if (c == ')')
246 depth--;
247 else if (c == bc && depth <= 0)
248 return param;
249 param++;
253 static char *
254 match_name (char *param,
255 struct field_val_assoc *assoc_tab,
256 unsigned *valp)
258 int i;
259 char *name;
260 int name_len;
262 for (i = 0;; i++)
264 name = assoc_tab[i].name;
265 if (name == NULL)
266 return NULL;
267 name_len = strlen (name);
268 if (!strncmp (param, name, name_len))
270 *valp = assoc_tab[i].val;
271 return param + name_len;
276 static char *
277 get_bf_offset_expression (char *param, unsigned *offsetp)
279 unsigned offset;
281 if (ISALPHA (param[0]))
283 param[0] = TOLOWER (param[0]);
284 param[1] = TOLOWER (param[1]);
286 param = match_name (param, cmpslot, offsetp);
288 return param;
290 else
292 input_line_pointer = param;
293 offset = get_absolute_expression ();
294 param = input_line_pointer;
297 *offsetp = offset;
298 return param;
301 static char *
302 get_bf (char *param, unsigned *valp)
304 unsigned offset = 0;
305 unsigned width = 0;
306 char *xp;
307 char *save_ptr;
309 xp = get_bf2 (param, '<');
311 save_ptr = input_line_pointer;
312 input_line_pointer = param;
313 if (*xp == 0)
315 /* We did not find '<'. We have an offset (width implicitly 32). */
316 param = get_bf_offset_expression (param, &offset);
317 input_line_pointer = save_ptr;
318 if (param == NULL)
319 return NULL;
321 else
323 *xp++ = 0; /* Overwrite the '<'. */
324 param = get_bf2 (xp, '>');
325 if (*param == 0)
326 return NULL;
327 *param++ = 0; /* Overwrite the '>'. */
329 width = get_absolute_expression ();
330 xp = get_bf_offset_expression (xp, &offset);
331 input_line_pointer = save_ptr;
333 if (xp + 1 != param)
334 return NULL;
337 *valp = ((width % 32) << 5) | (offset % 32);
339 return param;
342 static char *
343 get_cr (char *param, unsigned *regnop)
345 unsigned regno;
346 unsigned c;
348 if (!strncmp (param, "cr", 2))
350 param += 2;
352 regno = *param++ - '0';
353 if (regno < 10)
355 if (regno == 0)
357 *regnop = 0;
358 return param;
360 c = *param - '0';
361 if (c < 10)
363 regno = regno * 10 + c;
364 if (c < 64)
366 *regnop = regno;
367 return param + 1;
370 else
372 *regnop = regno;
373 return param;
376 return NULL;
379 param = match_name (param, cr_regs, regnop);
381 return param;
384 static char *
385 get_fcr (char *param, unsigned *regnop)
387 unsigned regno;
388 unsigned c;
390 if (!strncmp (param, "fcr", 3))
392 param += 3;
394 regno = *param++ - '0';
395 if (regno < 10)
397 if (regno == 0)
399 *regnop = 0;
400 return param;
402 c = *param - '0';
403 if (c < 10)
405 regno = regno * 10 + c;
406 if (c < 64)
408 *regnop = regno;
409 return param + 1;
412 else
414 *regnop = regno;
415 return param;
418 return NULL;
421 param = match_name (param, fcr_regs, regnop);
423 return param;
426 #define hexval(z) \
427 (ISDIGIT (z) ? (z) - '0' : \
428 ISLOWER (z) ? (z) - 'a' + 10 : \
429 ISUPPER (z) ? (z) - 'A' + 10 : (unsigned) -1)
431 static char *
432 getval (char *param, unsigned int *valp)
434 unsigned int val = 0;
435 unsigned int c;
437 c = *param++;
438 if (c == '0')
440 c = *param++;
441 if (c == 'x' || c == 'X')
443 c = *param++;
444 c = hexval (c);
445 while (c < 16)
447 val = val * 16 + c;
448 c = *param++;
449 c = hexval (c);
452 else
454 c -= '0';
455 while (c < 8)
457 val = val * 8 + c;
458 c = *param++ - '0';
462 else
464 c -= '0';
465 while (c < 10)
467 val = val * 10 + c;
468 c = *param++ - '0';
472 *valp = val;
473 return param - 1;
476 static char *
477 get_cnd (char *param, unsigned *valp)
479 unsigned int val;
481 if (ISDIGIT (*param))
483 param = getval (param, &val);
485 if (val >= 32)
487 as_warn (_("Expression truncated to 5 bits"));
488 val %= 32;
491 else
493 param[0] = TOLOWER (param[0]);
494 param[1] = TOLOWER (param[1]);
496 param = match_name (param, cndmsk, valp);
498 if (param == NULL)
499 return NULL;
501 val = *valp;
504 *valp = val << 21;
505 return param;
508 static char *
509 get_reg (char *param, unsigned *regnop, unsigned int reg_prefix)
511 unsigned c;
512 unsigned regno;
514 c = *param++;
515 if (c == reg_prefix)
517 regno = *param++ - '0';
518 if (regno < 10)
520 if (regno == 0)
522 *regnop = 0;
523 return param;
525 c = *param - '0';
526 if (c < 10)
528 regno = regno * 10 + c;
529 if (c < 32)
531 *regnop = regno;
532 return param + 1;
535 else
537 *regnop = regno;
538 return param;
541 return NULL;
543 else if (c == 's' && param[0] == 'p')
545 *regnop = 31;
546 return param + 1;
549 return 0;
552 static char *
553 get_imm16 (char *param, struct m88k_insn *insn)
555 enum reloc_type reloc = NO_RELOC;
556 unsigned int val;
557 char *save_ptr;
559 if (!strncmp (param, "hi16", 4) && !ISALNUM (param[4]))
561 reloc = RELOC_HI16;
562 param += 4;
564 else if (!strncmp (param, "lo16", 4) && !ISALNUM (param[4]))
566 reloc = RELOC_LO16;
567 param += 4;
569 else if (!strncmp (param, "iw16", 4) && !ISALNUM (param[4]))
571 reloc = RELOC_IW16;
572 param += 4;
575 save_ptr = input_line_pointer;
576 input_line_pointer = param;
577 expression (&insn->exp);
578 param = input_line_pointer;
579 input_line_pointer = save_ptr;
581 val = insn->exp.X_add_number;
583 if (insn->exp.X_op == O_constant)
585 /* Insert the value now, and reset reloc to NO_RELOC. */
586 if (reloc == NO_RELOC)
588 /* Warn about too big expressions if not surrounded by xx16. */
589 if (val > 0xffff)
590 as_warn (_("Expression truncated to 16 bits"));
593 if (reloc == RELOC_HI16)
594 val >>= 16;
596 insn->opcode |= val & 0xffff;
597 reloc = NO_RELOC;
599 else if (reloc == NO_RELOC)
600 /* We accept a symbol even without lo16, hi16, etc, and assume
601 lo16 was intended. */
602 reloc = RELOC_LO16;
604 insn->reloc = reloc;
606 return param;
609 static char *
610 get_pcr (char *param, struct m88k_insn *insn, enum reloc_type reloc)
612 char *saveptr, *saveparam;
614 saveptr = input_line_pointer;
615 input_line_pointer = param;
617 expression (&insn->exp);
619 saveparam = input_line_pointer;
620 input_line_pointer = saveptr;
622 /* Botch: We should relocate now if O_constant. */
623 insn->reloc = reloc;
625 return saveparam;
628 static char *
629 get_cmp (char *param, unsigned *valp)
631 unsigned int val;
632 char *save_ptr;
634 save_ptr = param;
636 param = match_name (param, cmpslot, valp);
637 val = *valp;
639 if (param == NULL)
641 param = save_ptr;
643 save_ptr = input_line_pointer;
644 input_line_pointer = param;
645 val = get_absolute_expression ();
646 param = input_line_pointer;
647 input_line_pointer = save_ptr;
649 if (val >= 32)
651 as_warn (_("Expression truncated to 5 bits"));
652 val %= 32;
656 *valp = val << 21;
657 return param;
660 static int
661 calcop (struct m88k_opcode *format,
662 char *param,
663 struct m88k_insn *insn)
665 char *fmt = format->op_spec;
666 int f;
667 unsigned val;
668 unsigned opcode;
669 unsigned int reg_prefix = 'r';
671 insn->opcode = format->opcode;
672 opcode = 0;
674 for (;;)
676 if (param == 0)
677 return 0;
678 f = *fmt++;
679 switch (f)
681 case 0:
682 insn->opcode |= opcode;
683 return (*param == 0 || *param == '\n');
685 default:
686 if (f != *param++)
687 return 0;
688 break;
690 case 'd':
691 param = get_reg (param, &val, reg_prefix);
692 reg_prefix = 'r';
693 opcode |= val << 21;
694 break;
696 case 'o':
697 param = get_o6 (param, &val);
698 opcode |= ((val >> 2) << 7);
699 break;
701 case 'x':
702 reg_prefix = 'x';
703 break;
705 case '1':
706 param = get_reg (param, &val, reg_prefix);
707 reg_prefix = 'r';
708 opcode |= val << 16;
709 break;
711 case '2':
712 param = get_reg (param, &val, reg_prefix);
713 reg_prefix = 'r';
714 opcode |= val;
715 break;
717 case '3':
718 param = get_reg (param, &val, 'r');
719 opcode |= (val << 16) | val;
720 break;
722 case 'I':
723 param = get_imm16 (param, insn);
724 break;
726 case 'b':
727 param = get_bf (param, &val);
728 opcode |= val;
729 break;
731 case 'p':
732 param = get_pcr (param, insn, RELOC_PC16);
733 break;
735 case 'P':
736 param = get_pcr (param, insn, RELOC_PC26);
737 break;
739 case 'B':
740 param = get_cmp (param, &val);
741 opcode |= val;
742 break;
744 case 'M':
745 param = get_cnd (param, &val);
746 opcode |= val;
747 break;
749 case 'c':
750 param = get_cr (param, &val);
751 opcode |= val << 5;
752 break;
754 case 'f':
755 param = get_fcr (param, &val);
756 opcode |= val << 5;
757 break;
759 case 'V':
760 param = get_vec9 (param, &val);
761 opcode |= val;
762 break;
764 case '?':
765 /* Having this here repeats the warning somtimes.
766 But can't we stand that? */
767 as_warn (_("Use of obsolete instruction"));
768 break;
773 void
774 md_assemble (char *op)
776 char *param, *thisfrag;
777 char c;
778 struct m88k_opcode *format;
779 struct m88k_insn insn;
781 assert (op);
783 /* Skip over instruction to find parameters. */
784 for (param = op; *param != 0 && !ISSPACE (*param); param++)
786 c = *param;
787 *param++ = '\0';
789 /* Try to find the instruction in the hash table. */
790 if ((format = (struct m88k_opcode *) hash_find (op_hash, op)) == NULL)
792 as_bad (_("Invalid mnemonic '%s'"), op);
793 return;
796 /* Try parsing this instruction into insn. */
797 insn.exp.X_add_symbol = 0;
798 insn.exp.X_op_symbol = 0;
799 insn.exp.X_add_number = 0;
800 insn.exp.X_op = O_illegal;
801 insn.reloc = NO_RELOC;
803 while (!calcop (format, param, &insn))
805 /* If it doesn't parse try the next instruction. */
806 if (!strcmp (format[0].name, format[1].name))
807 format++;
808 else
810 as_fatal (_("Parameter syntax error"));
811 return;
815 /* Grow the current frag and plop in the opcode. */
816 thisfrag = frag_more (4);
817 md_number_to_chars (thisfrag, insn.opcode, 4);
819 /* If this instruction requires labels mark it for later. */
820 switch (insn.reloc)
822 case NO_RELOC:
823 break;
825 case RELOC_LO16:
826 case RELOC_HI16:
827 fix_new_exp (frag_now,
828 thisfrag - frag_now->fr_literal + 2,
830 &insn.exp,
832 insn.reloc);
833 break;
835 case RELOC_IW16:
836 fix_new_exp (frag_now,
837 thisfrag - frag_now->fr_literal,
839 &insn.exp,
841 insn.reloc);
842 break;
844 case RELOC_PC16:
845 fix_new_exp (frag_now,
846 thisfrag - frag_now->fr_literal + 2,
848 &insn.exp,
850 insn.reloc);
851 break;
853 case RELOC_PC26:
854 fix_new_exp (frag_now,
855 thisfrag - frag_now->fr_literal,
857 &insn.exp,
859 insn.reloc);
860 break;
862 default:
863 as_fatal (_("Unknown relocation type"));
864 break;
868 void
869 md_number_to_chars (char *buf, valueT val, int nbytes)
871 number_to_chars_bigendian (buf, val, nbytes);
874 #define MAX_LITTLENUMS 6
876 /* Turn a string in input_line_pointer into a floating point constant of type
877 type, and store the appropriate bytes in *litP. The number of LITTLENUMS
878 emitted is stored in *sizeP . An error message is returned, or NULL on OK. */
880 char *
881 md_atof (int type, char *litP, int *sizeP)
883 int prec;
884 LITTLENUM_TYPE words[MAX_LITTLENUMS];
885 LITTLENUM_TYPE *wordP;
886 char *t;
888 switch (type)
890 case 'f':
891 case 'F':
892 case 's':
893 case 'S':
894 prec = 2;
895 break;
897 case 'd':
898 case 'D':
899 case 'r':
900 case 'R':
901 prec = 4;
902 break;
904 case 'x':
905 case 'X':
906 prec = 6;
907 break;
909 case 'p':
910 case 'P':
911 prec = 6;
912 break;
914 default:
915 *sizeP = 0;
916 return _("Bad call to MD_ATOF()");
918 t = atof_ieee (input_line_pointer, type, words);
919 if (t)
920 input_line_pointer = t;
922 *sizeP = prec * sizeof (LITTLENUM_TYPE);
923 for (wordP = words; prec--;)
925 md_number_to_chars (litP, (long) (*wordP++), sizeof (LITTLENUM_TYPE));
926 litP += sizeof (LITTLENUM_TYPE);
928 return 0;
931 int md_short_jump_size = 4;
933 void
934 md_create_short_jump (char *ptr,
935 addressT from_addr ATTRIBUTE_UNUSED,
936 addressT to_addr ATTRIBUTE_UNUSED,
937 fragS *frag,
938 symbolS *to_symbol)
940 ptr[0] = (char) 0xc0;
941 ptr[1] = 0x00;
942 ptr[2] = 0x00;
943 ptr[3] = 0x00;
944 fix_new (frag,
945 ptr - frag->fr_literal,
947 to_symbol,
948 (offsetT) 0,
950 RELOC_PC26); /* Botch: Shouldn't this be RELOC_PC16? */
953 int md_long_jump_size = 4;
955 void
956 md_create_long_jump (char *ptr,
957 addressT from_addr ATTRIBUTE_UNUSED,
958 addressT to_addr ATTRIBUTE_UNUSED,
959 fragS *frag,
960 symbolS *to_symbol)
962 ptr[0] = (char) 0xc0;
963 ptr[1] = 0x00;
964 ptr[2] = 0x00;
965 ptr[3] = 0x00;
966 fix_new (frag,
967 ptr - frag->fr_literal,
969 to_symbol,
970 (offsetT) 0,
972 RELOC_PC26);
976 md_estimate_size_before_relax (fragS *fragP ATTRIBUTE_UNUSED,
977 segT segment_type ATTRIBUTE_UNUSED)
979 as_fatal (_("Relaxation should never occur"));
980 return -1;
983 #ifdef M88KCOFF
985 /* These functions are needed if we are linking with obj-coffbfd.c.
986 That file may be replaced by a more BFD oriented version at some
987 point. If that happens, these functions should be reexamined.
989 Ian Lance Taylor, Cygnus Support, 13 July 1993. */
991 /* Given a fixS structure (created by a call to fix_new, above),
992 return the BFD relocation type to use for it. */
994 short
995 tc_coff_fix2rtype (fixS *fixp)
997 switch (fixp->fx_r_type)
999 case RELOC_LO16:
1000 return R_LVRT16;
1001 case RELOC_HI16:
1002 return R_HVRT16;
1003 case RELOC_PC16:
1004 return R_PCR16L;
1005 case RELOC_PC26:
1006 return R_PCR26L;
1007 case RELOC_32:
1008 return R_VRT32;
1009 case RELOC_IW16:
1010 return R_VRT16;
1011 default:
1012 abort ();
1016 /* Apply a fixS to the object file. Since COFF does not use addends
1017 in relocs, the addend is actually stored directly in the object
1018 file itself. */
1020 void
1021 md_apply_fix3 (fixS *fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED)
1023 long val = * (long *) valP;
1024 char *buf;
1026 buf = fixP->fx_frag->fr_literal + fixP->fx_where;
1027 fixP->fx_offset = 0;
1029 switch (fixP->fx_r_type)
1031 case RELOC_IW16:
1032 fixP->fx_offset = val >> 16;
1033 buf[2] = val >> 8;
1034 buf[3] = val;
1035 break;
1037 case RELOC_LO16:
1038 fixP->fx_offset = val >> 16;
1039 buf[0] = val >> 8;
1040 buf[1] = val;
1041 break;
1043 case RELOC_HI16:
1044 fixP->fx_offset = val >> 16;
1045 buf[0] = val >> 8;
1046 buf[1] = val;
1047 break;
1049 case RELOC_PC16:
1050 buf[0] = val >> 10;
1051 buf[1] = val >> 2;
1052 break;
1054 case RELOC_PC26:
1055 buf[0] |= (val >> 26) & 0x03;
1056 buf[1] = val >> 18;
1057 buf[2] = val >> 10;
1058 buf[3] = val >> 2;
1059 break;
1061 case RELOC_32:
1062 buf[0] = val >> 24;
1063 buf[1] = val >> 16;
1064 buf[2] = val >> 8;
1065 buf[3] = val;
1066 break;
1068 default:
1069 abort ();
1072 if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
1073 fixP->fx_done = 1;
1076 /* Where a PC relative offset is calculated from. On the m88k they
1077 are calculated from just after the instruction. */
1079 long
1080 md_pcrel_from (fixS *fixp)
1082 switch (fixp->fx_r_type)
1084 case RELOC_PC16:
1085 return fixp->fx_frag->fr_address + fixp->fx_where - 2;
1086 case RELOC_PC26:
1087 return fixp->fx_frag->fr_address + fixp->fx_where;
1088 default:
1089 abort ();
1093 /* Fill in rs_align_code fragments. */
1095 void
1096 m88k_handle_align (fragS *fragp)
1098 static const unsigned char nop_pattern[] = { 0xf4, 0x00, 0x58, 0x00 };
1100 int bytes;
1101 char *p;
1103 if (fragp->fr_type != rs_align_code)
1104 return;
1106 bytes = fragp->fr_next->fr_address - fragp->fr_address - fragp->fr_fix;
1107 p = fragp->fr_literal + fragp->fr_fix;
1109 if (bytes & 3)
1111 int fix = bytes & 3;
1112 memset (p, 0, fix);
1113 p += fix;
1114 bytes -= fix;
1115 fragp->fr_fix += fix;
1118 memcpy (p, nop_pattern, 4);
1119 fragp->fr_var = 4;
1122 #endif /* M88KCOFF */
1124 const pseudo_typeS md_pseudo_table[] =
1126 {"align", s_align_bytes, 4},
1127 {"def", s_set, 0},
1128 {"dfloat", float_cons, 'd'},
1129 {"ffloat", float_cons, 'f'},
1130 {"half", cons, 2},
1131 {"bss", s_lcomm, 1},
1132 {"string", stringer, 0},
1133 {"word", cons, 4},
1134 /* Force set to be treated as an instruction. */
1135 {"set", NULL, 0},
1136 {".set", s_set, 0},
1137 {NULL, NULL, 0}