1 /* tc-h8300.c -- Assemble code for the Renesas H8/300
2 Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
3 2001, 2002, 2003 Free Software Foundation, Inc.
5 This file is part of GAS, the GNU Assembler.
7 GAS is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GAS is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GAS; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 /* Written By Steve Chamberlain <sac@cygnus.com>. */
30 #include "dwarf2dbg.h"
34 #define h8_opcodes ops
35 #include "opcode/h8300.h"
36 #include "safe-ctype.h"
42 const char comment_chars[] = ";";
43 const char line_comment_chars[] = "#";
44 const char line_separator_chars[] = "";
46 void cons PARAMS ((int));
47 void sbranch PARAMS ((int));
48 void h8300hmode PARAMS ((int));
49 void h8300smode PARAMS ((int));
50 void h8300hnmode PARAMS ((int));
51 void h8300snmode PARAMS ((int));
52 void h8300sxmode PARAMS ((int));
53 void h8300sxnmode PARAMS ((int));
54 static void pint PARAMS ((int));
61 #define PSIZE (Hmode && !Nmode ? L_32 : L_16)
63 int bsize = L_8; /* Default branch displacement. */
71 const struct h8_opcode *opcode;
74 struct h8_instruction *h8_instructions;
78 int arg ATTRIBUTE_UNUSED;
83 if (!bfd_set_arch_mach (stdoutput, bfd_arch_h8300, bfd_mach_h8300h))
84 as_warn (_("could not set architecture and machine"));
90 int arg ATTRIBUTE_UNUSED;
95 if (!bfd_set_arch_mach (stdoutput, bfd_arch_h8300, bfd_mach_h8300s))
96 as_warn (_("could not set architecture and machine"));
102 int arg ATTRIBUTE_UNUSED;
108 if (!bfd_set_arch_mach (stdoutput, bfd_arch_h8300, bfd_mach_h8300hn))
109 as_warn (_("could not set architecture and machine"));
115 int arg ATTRIBUTE_UNUSED;
121 if (!bfd_set_arch_mach (stdoutput, bfd_arch_h8300, bfd_mach_h8300sn))
122 as_warn (_("could not set architecture and machine"));
128 int arg ATTRIBUTE_UNUSED;
134 if (!bfd_set_arch_mach (stdoutput, bfd_arch_h8300, bfd_mach_h8300sx))
135 as_warn (_("could not set architecture and machine"));
141 int arg ATTRIBUTE_UNUSED;
148 if (!bfd_set_arch_mach (stdoutput, bfd_arch_h8300, bfd_mach_h8300sxn))
149 as_warn (_("could not set architecture and machine"));
162 int arg ATTRIBUTE_UNUSED;
164 cons (Hmode ? 4 : 2);
167 /* This table describes all the machine specific pseudo-ops the assembler
168 has to support. The fields are:
169 pseudo-op name without dot
170 function to call to execute this pseudo-op
171 Integer arg to pass to the function. */
173 const pseudo_typeS md_pseudo_table[] =
175 {"h8300h", h8300hmode, 0},
176 {"h8300hn", h8300hnmode, 0},
177 {"h8300s", h8300smode, 0},
178 {"h8300sn", h8300snmode, 0},
179 {"h8300sx", h8300sxmode, 0},
180 {"h8300sxn", h8300sxnmode, 0},
181 {"sbranch", sbranch, L_8},
182 {"lbranch", sbranch, L_16},
188 {"form", listing_psize, 0},
189 {"heading", listing_title, 0},
190 {"import", s_ignore, 0},
191 {"page", listing_eject, 0},
192 {"program", s_ignore, 0},
196 const int md_reloc_size;
198 const char EXP_CHARS[] = "eE";
200 /* Chars that mean this number is a floating point constant
203 const char FLT_CHARS[] = "rRsSfFdDxXpP";
205 static struct hash_control *opcode_hash_control; /* Opcode mnemonics. */
207 /* This function is called once, at assembler startup time. This
208 should set up all the tables, etc. that the MD part of the assembler
214 unsigned int nopcodes;
215 struct h8_opcode *p, *p1;
216 struct h8_instruction *pi;
217 char prev_buffer[100];
221 if (!bfd_set_arch_mach (stdoutput, bfd_arch_h8300, bfd_mach_h8300))
222 as_warn (_("could not set architecture and machine"));
225 opcode_hash_control = hash_new ();
228 nopcodes = sizeof (h8_opcodes) / sizeof (struct h8_opcode);
230 h8_instructions = (struct h8_instruction *)
231 xmalloc (nopcodes * sizeof (struct h8_instruction));
233 pi = h8_instructions;
235 /* We do a minimum amount of sorting on the opcode table; this is to
236 make it easy to describe the mova instructions without unnecessary
238 Sorting only takes place inside blocks of instructions of the form
239 X/Y, so for example mova/b, mova/w and mova/l can be intermixed. */
242 struct h8_opcode *first_skipped = 0;
244 char *src = p1->name;
249 /* Strip off any . part when inserting the opcode and only enter
250 unique codes into the hash table. */
251 dst = buffer = malloc (strlen (src) + 1);
260 cmplen = src - p1->name + 1;
267 hash_insert (opcode_hash_control, buffer, (char *) pi);
268 strcpy (prev_buffer, buffer);
271 for (p = p1; p->name; p++)
273 /* A negative TIME is used to indicate that we've added this opcode
277 if (strncmp (p->name, buffer, cmplen) != 0
278 || (p->name[cmplen] != '\0' && p->name[cmplen] != '.'
279 && p->name[cmplen - 1] != '/'))
281 if (first_skipped == 0)
285 if (strncmp (p->name, buffer, len) != 0)
287 if (first_skipped == 0)
293 pi->size = p->name[len] == '.' ? p->name[len + 1] : 0;
296 /* Find the number of operands. */
298 while (pi->noperands < 3 && p->args.nib[pi->noperands] != (op_type) E)
301 /* Find the length of the opcode in bytes. */
303 while (p->data.nib[pi->length * 2] != (op_type) E)
312 /* Add entry for the NULL vector terminator. */
336 static void clever_message PARAMS ((const struct h8_instruction *, struct h8_op *));
337 static void fix_operand_size PARAMS ((struct h8_op *, int));
338 static void build_bytes PARAMS ((const struct h8_instruction *, struct h8_op *));
339 static void do_a_fix_imm PARAMS ((int, int, struct h8_op *, int));
340 static void check_operand PARAMS ((struct h8_op *, unsigned int, char *));
341 static const struct h8_instruction * get_specific PARAMS ((const struct h8_instruction *, struct h8_op *, int));
342 static char *get_operands PARAMS ((unsigned, char *, struct h8_op *));
343 static void get_operand PARAMS ((char **, struct h8_op *, int));
344 static int parse_reg PARAMS ((char *, op_type *, unsigned *, int));
345 static char *skip_colonthing PARAMS ((char *, int *));
346 static char *parse_exp PARAMS ((char *, struct h8_op *));
348 static int constant_fits_width_p PARAMS ((struct h8_op *, unsigned int));
349 static int constant_fits_size_p PARAMS ((struct h8_op *, int, int));
353 WREG r0,r1,r2,r3,r4,r5,r6,r7,fp,sp
362 /* Try to parse a reg name. Return the number of chars consumed. */
365 parse_reg (src, mode, reg, direction)
374 /* Cribbed from get_symbol_end. */
375 if (!is_name_beginner (*src) || *src == '\001')
378 while ((is_part_of_name (*end) && *end != '.') || *end == '\001')
382 if (len == 2 && TOLOWER (src[0]) == 's' && TOLOWER (src[1]) == 'p')
384 *mode = PSIZE | REG | direction;
389 TOLOWER (src[0]) == 'c' &&
390 TOLOWER (src[1]) == 'c' &&
391 TOLOWER (src[2]) == 'r')
398 TOLOWER (src[0]) == 'e' &&
399 TOLOWER (src[1]) == 'x' &&
400 TOLOWER (src[2]) == 'r')
407 TOLOWER (src[0]) == 'v' &&
408 TOLOWER (src[1]) == 'b' &&
409 TOLOWER (src[2]) == 'r')
416 TOLOWER (src[0]) == 's' &&
417 TOLOWER (src[1]) == 'b' &&
418 TOLOWER (src[2]) == 'r')
424 if (len == 2 && TOLOWER (src[0]) == 'f' && TOLOWER (src[1]) == 'p')
426 *mode = PSIZE | REG | direction;
430 if (len == 3 && TOLOWER (src[0]) == 'e' && TOLOWER (src[1]) == 'r' &&
431 src[2] >= '0' && src[2] <= '7')
433 *mode = L_32 | REG | direction;
436 as_warn (_("Reg not valid for H8/300"));
439 if (len == 2 && TOLOWER (src[0]) == 'e' && src[1] >= '0' && src[1] <= '7')
441 *mode = L_16 | REG | direction;
442 *reg = src[1] - '0' + 8;
444 as_warn (_("Reg not valid for H8/300"));
448 if (TOLOWER (src[0]) == 'r')
450 if (src[1] >= '0' && src[1] <= '7')
452 if (len == 3 && TOLOWER (src[2]) == 'l')
454 *mode = L_8 | REG | direction;
455 *reg = (src[1] - '0') + 8;
458 if (len == 3 && TOLOWER (src[2]) == 'h')
460 *mode = L_8 | REG | direction;
461 *reg = (src[1] - '0');
466 *mode = L_16 | REG | direction;
467 *reg = (src[1] - '0');
477 /* Parse an immediate or address-related constant and store it in OP.
478 If the user also specifies the operand's size, store that size
479 in OP->MODE, otherwise leave it for later code to decide. */
488 save = input_line_pointer;
489 input_line_pointer = src;
490 expression (&op->exp);
491 if (op->exp.X_op == O_absent)
492 as_bad (_("missing operand"));
493 src = input_line_pointer;
494 input_line_pointer = save;
496 return skip_colonthing (src, &op->mode);
500 /* If SRC starts with an explicit operand size, skip it and store the size
501 in *MODE. Leave *MODE unchanged otherwise. */
504 skip_colonthing (src, mode)
512 if (src[0] == '8' && !ISDIGIT (src[1]))
514 else if (src[0] == '2' && !ISDIGIT (src[1]))
516 else if (src[0] == '3' && !ISDIGIT (src[1]))
518 else if (src[0] == '4' && !ISDIGIT (src[1]))
520 else if (src[0] == '5' && !ISDIGIT (src[1]))
522 else if (src[0] == '2' && src[1] == '4' && !ISDIGIT (src[2]))
524 else if (src[0] == '3' && src[1] == '2' && !ISDIGIT (src[2]))
526 else if (src[0] == '1' && src[1] == '6' && !ISDIGIT (src[2]))
529 as_bad (_("invalid operand size requested"));
531 while (ISDIGIT (*src))
537 /* The many forms of operand:
540 @Rn Register indirect
541 @(exp[:16], Rn) Register indirect with displacement
545 @aa:16 absolute 16 bit
548 #xx[:size] immediate data
549 @(exp:[8], pc) pc rel
550 @@aa[:8] memory indirect. */
553 constant_fits_width_p (operand, width)
554 struct h8_op *operand;
557 return ((operand->exp.X_add_number & ~width) == 0
558 || (operand->exp.X_add_number | width) == (unsigned)(~0));
562 constant_fits_size_p (operand, size, no_symbols)
563 struct h8_op *operand;
564 int size, no_symbols;
566 offsetT num = operand->exp.X_add_number;
568 && (operand->exp.X_add_symbol != 0 || operand->exp.X_op_symbol != 0))
573 return (num & ~3) == 0;
575 return (num & ~7) == 0;
577 return num >= 1 && num < 8;
579 return (num & ~15) == 0;
581 return num >= 1 && num < 32;
583 return (num & ~0xFF) == 0 || ((unsigned)num | 0x7F) == ~0u;
585 return (num & ~0xFF) == 0;
587 return (num & ~0xFFFF) == 0 || ((unsigned)num | 0x7FFF) == ~0u;
589 return (num & ~0xFFFF) == 0;
598 get_operand (ptr, op, direction)
610 /* Check for '(' and ')' for instructions ldm and stm. */
611 if (src[0] == '(' && src[8] == ')')
614 /* Gross. Gross. ldm and stm have a format not easily handled
615 by get_operand. We deal with it explicitly here. */
616 if (TOLOWER (src[0]) == 'e' && TOLOWER (src[1]) == 'r' &&
617 ISDIGIT (src[2]) && src[3] == '-' &&
618 TOLOWER (src[4]) == 'e' && TOLOWER (src[5]) == 'r' && ISDIGIT (src[6]))
626 as_bad (_("Invalid register list for ldm/stm\n"));
629 as_bad (_("Invalid register list for ldm/stm\n"));
632 as_bad (_("Invalid register list for ldm/stm)\n"));
634 /* Even sicker. We encode two registers into op->reg. One
635 for the low register to save, the other for the high
636 register to save; we also set the high bit in op->reg
637 so we know this is "very special". */
638 op->reg = 0x80000000 | (high << 8) | low;
647 len = parse_reg (src, &op->mode, &op->reg, direction);
653 int size = op->mode & SIZE;
658 as_warn (_("mismatch between register and suffix"));
659 op->mode = (op->mode & ~MODE) | LOWREG;
662 if (size != L_32 && size != L_16)
663 as_warn (_("mismatch between register and suffix"));
664 op->mode = (op->mode & ~MODE) | LOWREG;
665 op->mode = (op->mode & ~SIZE) | L_16;
668 op->mode = (op->mode & ~MODE) | LOWREG;
669 if (size != L_32 && size != L_8)
670 as_warn (_("mismatch between register and suffix"));
671 op->mode = (op->mode & ~MODE) | LOWREG;
672 op->mode = (op->mode & ~SIZE) | L_8;
675 as_warn ("invalid suffix after register.");
689 *ptr = parse_exp (src + 1, op);
690 if (op->exp.X_add_number >= 0x100)
695 /* FIXME : 2? or 4? */
696 if (op->exp.X_add_number >= 0x400)
697 as_bad (_("address too high for vector table jmp/jsr"));
698 else if (op->exp.X_add_number >= 0x200)
703 op->exp.X_add_number = op->exp.X_add_number / divisor - 0x80;
710 if (*src == '-' || *src == '+')
712 len = parse_reg (src + 1, &mode, &num, direction);
715 /* Oops, not a reg after all, must be ordinary exp. */
716 op->mode = ABS | direction;
717 *ptr = parse_exp (src, op);
721 if (((mode & SIZE) != PSIZE)
722 /* For Normal mode accept 16 bit and 32 bit pointer registers. */
723 && (!Nmode || ((mode & SIZE) != L_32)))
724 as_bad (_("Wrong size pointer register for architecture."));
726 op->mode = src[0] == '-' ? RDPREDEC : RDPREINC;
728 *ptr = src + 1 + len;
735 /* See if this is @(ERn.x, PC). */
736 len = parse_reg (src, &mode, &op->reg, direction);
737 if (len != 0 && (mode & MODE) == REG && src[len] == '.')
739 switch (TOLOWER (src[len + 1]))
742 mode = PCIDXB | direction;
745 mode = PCIDXW | direction;
748 mode = PCIDXL | direction;
755 && src[len + 2] == ','
756 && TOLOWER (src[len + 3]) != 'p'
757 && TOLOWER (src[len + 4]) != 'c'
758 && src[len + 5] != ')')
760 *ptr = src + len + 6;
764 /* Fall through into disp case - the grammar is somewhat
765 ambiguous, so we should try whether it's a DISP operand
766 after all ("ER3.L" might be a poorly named label...). */
771 /* Start off assuming a 16 bit offset. */
773 src = parse_exp (src, op);
776 op->mode |= ABS | direction;
783 as_bad (_("expected @(exp, reg16)"));
788 len = parse_reg (src, &mode, &op->reg, direction);
789 if (len == 0 || (mode & MODE) != REG)
791 as_bad (_("expected @(exp, reg16)"));
797 switch (TOLOWER (src[1]))
800 op->mode |= INDEXB | direction;
803 op->mode |= INDEXW | direction;
806 op->mode |= INDEXL | direction;
809 as_bad (_("expected .L, .W or .B for register in indexed addressing mode"));
815 op->mode |= DISP | direction;
816 src = skip_colonthing (src, &op->mode);
818 if (*src != ')' && '(')
820 as_bad (_("expected @(exp, reg16)"));
826 len = parse_reg (src, &mode, &num, direction);
831 if (*src == '+' || *src == '-')
833 if (((mode & SIZE) != PSIZE)
834 /* For Normal mode accept 16 bit and 32 bit pointer registers. */
835 && (!Nmode || ((mode & SIZE) != L_32)))
836 as_bad (_("Wrong size pointer register for architecture."));
837 op->mode = *src == '+' ? RSPOSTINC : RSPOSTDEC;
843 if (((mode & SIZE) != PSIZE)
844 /* For Normal mode accept 16 bit and 32 bit pointer registers. */
845 && (!Nmode || ((mode & SIZE) != L_32)))
846 as_bad (_("Wrong size pointer register for architecture."));
848 op->mode = direction | IND | PSIZE;
856 /* must be a symbol */
858 op->mode = ABS | direction;
859 *ptr = parse_exp (src, op);
867 *ptr = parse_exp (src + 1, op);
870 else if (strncmp (src, "mach", 4) == 0 ||
871 strncmp (src, "macl", 4) == 0 ||
872 strncmp (src, "MACH", 4) == 0 ||
873 strncmp (src, "MACL", 4) == 0)
875 op->reg = TOLOWER (src[3]) == 'l';
883 *ptr = parse_exp (src, op);
888 get_operands (noperands, op_end, operand)
889 unsigned int noperands;
891 struct h8_op *operand;
902 get_operand (&ptr, operand + 0, SRC);
906 get_operand (&ptr, operand + 1, DST);
912 get_operand (&ptr, operand + 0, SRC);
915 get_operand (&ptr, operand + 1, DST);
920 get_operand (&ptr, operand + 0, SRC);
923 get_operand (&ptr, operand + 1, DST);
926 get_operand (&ptr, operand + 2, OP3);
936 /* MOVA has special requirements. Rather than adding twice the amount of
937 addressing modes, we simply special case it a bit. */
939 get_mova_operands (char *op_end, struct h8_op *operand)
943 if (ptr[1] != '@' || ptr[2] != '(')
947 ptr = parse_exp (ptr, &operand[0]);
952 get_operand (&ptr, operand + 1, DST);
960 operand[0].mode = (operand[0].mode & ~MODE) | INDEXB;
963 operand[0].mode = (operand[0].mode & ~MODE) | INDEXW;
966 operand[0].mode = (operand[0].mode & ~MODE) | INDEXL;
972 else if ((operand[1].mode & MODE) == LOWREG)
974 switch (operand[1].mode & SIZE)
977 operand[0].mode = (operand[0].mode & ~MODE) | INDEXB;
980 operand[0].mode = (operand[0].mode & ~MODE) | INDEXW;
983 operand[0].mode = (operand[0].mode & ~MODE) | INDEXL;
992 if (*ptr++ != ')' || *ptr++ != ',')
994 get_operand (&ptr, operand + 2, OP3);
995 /* See if we can use the short form of MOVA. */
996 if (((operand[1].mode & MODE) == REG || (operand[1].mode & MODE) == LOWREG)
997 && (operand[2].mode & MODE) == REG
998 && (operand[1].reg & 7) == (operand[2].reg & 7))
1000 operand[1].mode = operand[2].mode = 0;
1001 operand[0].reg = operand[2].reg & 7;
1006 as_bad (_("expected valid addressing mode for mova: \"@(disp, ea.sz),ERn\""));
1011 get_rtsl_operands (char *ptr, struct h8_op *operand)
1013 int mode, num, num2, len, type = 0;
1021 len = parse_reg (ptr, &mode, &num, SRC);
1022 if (len == 0 || (mode & MODE) != REG)
1024 as_bad (_("expected register"));
1030 len = parse_reg (++ptr, &mode, &num2, SRC);
1031 if (len == 0 || (mode & MODE) != REG)
1033 as_bad (_("expected register"));
1037 /* CONST_xxx are used as placeholders in the opcode table. */
1039 if (num < 0 || num > 3)
1041 as_bad (_("invalid register list"));
1046 num2 = num, num = 0;
1047 if (type == 1 && *ptr++ != ')')
1049 as_bad (_("expected closing paren"));
1052 operand[0].mode = RS32;
1053 operand[1].mode = RD32;
1054 operand[0].reg = num;
1055 operand[1].reg = num2;
1058 /* Passed a pointer to a list of opcodes which use different
1059 addressing modes, return the opcode which matches the opcodes
1062 static const struct h8_instruction *
1063 get_specific (instruction, operands, size)
1064 const struct h8_instruction *instruction;
1065 struct h8_op *operands;
1068 const struct h8_instruction *this_try = instruction;
1069 const struct h8_instruction *found_other = 0, *found_mismatched = 0;
1071 int this_index = instruction->idx;
1074 /* There's only one ldm/stm and it's easier to just
1075 get out quick for them. */
1076 if (OP_KIND (instruction->opcode->how) == O_LDM
1077 || OP_KIND (instruction->opcode->how) == O_STM)
1080 while (noperands < 3 && operands[noperands].mode != 0)
1083 while (this_index == instruction->idx && !found)
1088 this_try = instruction++;
1089 this_size = this_try->opcode->how & SN;
1091 if (this_try->noperands != noperands)
1093 else if (this_try->noperands > 0)
1097 for (i = 0; i < this_try->noperands && found; i++)
1099 op_type op = this_try->opcode->args.nib[i];
1100 int op_mode = op & MODE;
1101 int op_size = op & SIZE;
1102 int x = operands[i].mode;
1103 int x_mode = x & MODE;
1104 int x_size = x & SIZE;
1106 if (op_mode == LOWREG && (x_mode == REG || x_mode == LOWREG))
1108 if ((x_size == L_8 && (operands[i].reg & 8) == 0)
1109 || (x_size == L_16 && (operands[i].reg & 8) == 8))
1110 as_warn (_("can't use high part of register in operand %d"), i);
1112 if (x_size != op_size)
1115 else if (op_mode == REG)
1117 if (x_mode == LOWREG)
1123 x_size = (Hmode ? L_32 : L_16);
1125 op_size = (Hmode ? L_32 : L_16);
1127 /* The size of the reg is v important. */
1128 if (op_size != x_size)
1131 else if (op_mode & CTRL) /* control register */
1133 if (!(x_mode & CTRL))
1139 if (op_mode != CCR &&
1140 op_mode != CCR_EXR &&
1141 op_mode != CC_EX_VB_SB)
1145 if (op_mode != EXR &&
1146 op_mode != CCR_EXR &&
1147 op_mode != CC_EX_VB_SB)
1151 if (op_mode != MACH &&
1156 if (op_mode != MACL &&
1161 if (op_mode != VBR &&
1162 op_mode != VBR_SBR &&
1163 op_mode != CC_EX_VB_SB)
1167 if (op_mode != SBR &&
1168 op_mode != VBR_SBR &&
1169 op_mode != CC_EX_VB_SB)
1174 else if ((op & ABSJMP) && (x_mode == ABS || x_mode == PCREL))
1176 operands[i].mode &= ~MODE;
1177 operands[i].mode |= ABSJMP;
1178 /* But it may not be 24 bits long. */
1179 if (x_mode == ABS && !Hmode)
1181 operands[i].mode &= ~SIZE;
1182 operands[i].mode |= L_16;
1184 if ((operands[i].mode & SIZE) == L_32
1185 && (op_mode & SIZE) != L_32)
1188 else if (x_mode == IMM && op_mode != IMM)
1190 offsetT num = operands[i].exp.X_add_number;
1191 if (op_mode == KBIT || op_mode == DBIT)
1192 /* This is ok if the immediate value is sensible. */;
1193 else if (op_mode == CONST_2)
1195 else if (op_mode == CONST_4)
1197 else if (op_mode == CONST_8)
1199 else if (op_mode == CONST_16)
1204 else if (op_mode == PCREL && op_mode == x_mode)
1206 /* movsd, bsr/bc and bsr/bs only come in PCREL16 flavour:
1207 If x_size is L_8, promote it. */
1208 if (OP_KIND (this_try->opcode->how) == O_MOVSD
1209 || OP_KIND (this_try->opcode->how) == O_BSRBC
1210 || OP_KIND (this_try->opcode->how) == O_BSRBS)
1214 /* The size of the displacement is important. */
1215 if (op_size != x_size)
1218 else if ((op_mode == DISP || op_mode == IMM || op_mode == ABS
1219 || op_mode == INDEXB || op_mode == INDEXW
1220 || op_mode == INDEXL)
1221 && op_mode == x_mode)
1223 /* Promote a L_24 to L_32 if it makes us match. */
1224 if (x_size == L_24 && op_size == L_32)
1231 /* Promote an L8 to L_16 if it makes us match. */
1232 if ((op_mode == ABS || op_mode == DISP) && x_size == L_8)
1234 if (op_size == L_16)
1239 if (((x_size == L_16 && op_size == L_16U)
1240 || (x_size == L_8 && op_size == L_8U)
1241 || (x_size == L_3 && op_size == L_3NZ))
1242 /* We're deliberately more permissive for ABS modes. */
1244 || constant_fits_size_p (operands + i, op_size,
1248 if (x_size != 0 && op_size != x_size)
1250 else if (x_size == 0
1251 && ! constant_fits_size_p (operands + i, op_size,
1255 else if (op_mode != x_mode)
1263 if ((this_try->opcode->available == AV_H8SX && ! SXmode)
1264 || (this_try->opcode->available == AV_H8S && ! Smode)
1265 || (this_try->opcode->available == AV_H8H && ! Hmode))
1266 found = 0, found_other = this_try;
1267 else if (this_size != size && (this_size != SN && size != SN))
1268 found_mismatched = this_try, found = 0;
1276 as_warn (_("Opcode `%s' with these operand types not available in %s mode"),
1277 found_other->opcode->name,
1278 (! Hmode && ! Smode ? "H8/300"
1283 else if (found_mismatched)
1285 as_warn (_("mismatch between opcode size and operand size"));
1286 return found_mismatched;
1292 check_operand (operand, width, string)
1293 struct h8_op *operand;
1297 if (operand->exp.X_add_symbol == 0
1298 && operand->exp.X_op_symbol == 0)
1300 /* No symbol involved, let's look at offset, it's dangerous if
1301 any of the high bits are not 0 or ff's, find out by oring or
1302 anding with the width and seeing if the answer is 0 or all
1305 if (! constant_fits_width_p (operand, width))
1308 && (operand->exp.X_add_number & 0xff00) == 0xff00)
1310 /* Just ignore this one - which happens when trying to
1311 fit a 16 bit address truncated into an 8 bit address
1312 of something like bset. */
1314 else if (strcmp (string, "@") == 0
1316 && (operand->exp.X_add_number & 0xff8000) == 0xff8000)
1318 /* Just ignore this one - which happens when trying to
1319 fit a 24 bit address truncated into a 16 bit address
1320 of something like mov.w. */
1324 as_warn (_("operand %s0x%lx out of range."), string,
1325 (unsigned long) operand->exp.X_add_number);
1331 /* RELAXMODE has one of 3 values:
1333 0 Output a "normal" reloc, no relaxing possible for this insn/reloc
1335 1 Output a relaxable 24bit absolute mov.w address relocation
1336 (may relax into a 16bit absolute address).
1338 2 Output a relaxable 16/24 absolute mov.b address relocation
1339 (may relax into an 8bit absolute address). */
1342 do_a_fix_imm (offset, nibble, operand, relaxmode)
1344 struct h8_op *operand;
1350 char *bytes = frag_now->fr_literal + offset;
1352 char *t = ((operand->mode & MODE) == IMM) ? "#" : "@";
1354 if (operand->exp.X_add_symbol == 0)
1356 switch (operand->mode & SIZE)
1359 check_operand (operand, 0x3, t);
1360 bytes[0] |= (operand->exp.X_add_number & 3) << (nibble ? 0 : 4);
1364 check_operand (operand, 0x7, t);
1365 bytes[0] |= (operand->exp.X_add_number & 7) << (nibble ? 0 : 4);
1368 check_operand (operand, 0xF, t);
1369 bytes[0] |= (operand->exp.X_add_number & 15) << (nibble ? 0 : 4);
1372 check_operand (operand, 0x1F, t);
1373 bytes[0] |= operand->exp.X_add_number & 31;
1377 check_operand (operand, 0xff, t);
1378 bytes[0] |= operand->exp.X_add_number;
1382 check_operand (operand, 0xffff, t);
1383 bytes[0] |= operand->exp.X_add_number >> 8;
1384 bytes[1] |= operand->exp.X_add_number >> 0;
1387 check_operand (operand, 0xffffff, t);
1388 bytes[0] |= operand->exp.X_add_number >> 16;
1389 bytes[1] |= operand->exp.X_add_number >> 8;
1390 bytes[2] |= operand->exp.X_add_number >> 0;
1394 /* This should be done with bfd. */
1395 bytes[0] |= operand->exp.X_add_number >> 24;
1396 bytes[1] |= operand->exp.X_add_number >> 16;
1397 bytes[2] |= operand->exp.X_add_number >> 8;
1398 bytes[3] |= operand->exp.X_add_number >> 0;
1401 idx = (relaxmode == 2) ? R_MOV24B1 : R_MOVL1;
1402 fix_new_exp (frag_now, offset, 4, &operand->exp, 0, idx);
1409 switch (operand->mode & SIZE)
1414 where = (operand->mode & SIZE) == L_24 ? -1 : 0;
1417 else if (relaxmode == 1)
1423 as_bad (_("Can't work out size of operand.\n"));
1432 operand->exp.X_add_number =
1433 ((operand->exp.X_add_number & 0xffff) ^ 0x8000) - 0x8000;
1434 operand->exp.X_add_number |= (bytes[0] << 8) | bytes[1];
1440 operand->exp.X_add_number =
1441 ((operand->exp.X_add_number & 0xff) ^ 0x80) - 0x80;
1442 operand->exp.X_add_number |= bytes[0];
1445 fix_new_exp (frag_now,
1454 /* Now we know what sort of opcodes it is, let's build the bytes. */
1457 build_bytes (this_try, operand)
1458 const struct h8_instruction *this_try;
1459 struct h8_op *operand;
1462 char *output = frag_more (this_try->length);
1463 op_type *nibble_ptr = this_try->opcode->data.nib;
1465 unsigned int nibble_count = 0;
1469 char asnibbles[100];
1470 char *p = asnibbles;
1473 if (!Hmode && this_try->opcode->available != AV_H8)
1474 as_warn (_("Opcode `%s' with these operand types not available in H8/300 mode"),
1475 this_try->opcode->name);
1477 && this_try->opcode->available != AV_H8
1478 && this_try->opcode->available != AV_H8H)
1479 as_warn (_("Opcode `%s' with these operand types not available in H8/300H mode"),
1480 this_try->opcode->name);
1482 && this_try->opcode->available != AV_H8
1483 && this_try->opcode->available != AV_H8H
1484 && this_try->opcode->available != AV_H8S)
1485 as_warn (_("Opcode `%s' with these operand types not available in H8/300S mode"),
1486 this_try->opcode->name);
1488 while (*nibble_ptr != (op_type) E)
1495 d = (c & OP3) == OP3 ? 2 : (c & DST) == DST ? 1 : 0;
1503 if (c2 == REG || c2 == LOWREG
1504 || c2 == IND || c2 == PREINC || c2 == PREDEC
1505 || c2 == POSTINC || c2 == POSTDEC)
1507 nib = operand[d].reg;
1512 else if (c & CTRL) /* Control reg operand. */
1513 nib = operand[d].reg;
1515 else if ((c & DISPREG) == (DISPREG))
1517 nib = operand[d].reg;
1521 operand[d].mode = c;
1522 op_at[d] = nibble_count;
1525 else if (c2 == IMM || c2 == PCREL || c2 == ABS
1526 || (c & ABSJMP) || c2 == DISP)
1528 operand[d].mode = c;
1529 op_at[d] = nibble_count;
1532 else if ((c & IGNORE) || (c & DATA))
1535 else if (c2 == DBIT)
1537 switch (operand[0].exp.X_add_number)
1546 as_bad (_("Need #1 or #2 here"));
1549 else if (c2 == KBIT)
1551 switch (operand[0].exp.X_add_number)
1561 as_warn (_("#4 not valid on H8/300."));
1566 as_bad (_("Need #1 or #2 here"));
1569 /* Stop it making a fix. */
1570 operand[0].mode = 0;
1574 operand[d].mode |= MEMRELAX;
1590 if (operand[0].mode == MACREG)
1591 /* stmac has mac[hl] as the first operand. */
1592 nib = 2 + operand[0].reg;
1594 /* ldmac has mac[hl] as the second operand. */
1595 nib = 2 + operand[1].reg;
1603 /* Disgusting. Why, oh why didn't someone ask us for advice
1604 on the assembler format. */
1605 if (OP_KIND (this_try->opcode->how) == O_LDM)
1607 high = (operand[1].reg >> 8) & 0xf;
1608 low = (operand[1].reg) & 0xf;
1609 asnibbles[2] = high - low;
1610 asnibbles[7] = high;
1612 else if (OP_KIND (this_try->opcode->how) == O_STM)
1614 high = (operand[0].reg >> 8) & 0xf;
1615 low = (operand[0].reg) & 0xf;
1616 asnibbles[2] = high - low;
1620 for (i = 0; i < this_try->length; i++)
1621 output[i] = (asnibbles[i * 2] << 4) | asnibbles[i * 2 + 1];
1623 /* Note if this is a movb instruction -- there's a special relaxation
1624 which only applies to them. */
1625 if (this_try->opcode->how == O (O_MOV, SB))
1628 /* Output any fixes. */
1629 for (i = 0; i < this_try->noperands; i++)
1631 int x = operand[i].mode;
1632 int x_mode = x & MODE;
1634 if (x_mode == IMM || x_mode == DISP)
1635 do_a_fix_imm (output - frag_now->fr_literal + op_at[i] / 2,
1636 op_at[i] & 1, operand + i, (x & MEMRELAX) != 0);
1638 else if (x_mode == ABS)
1639 do_a_fix_imm (output - frag_now->fr_literal + op_at[i] / 2,
1640 op_at[i] & 1, operand + i,
1641 (x & MEMRELAX) ? movb + 1 : 0);
1643 else if (x_mode == PCREL)
1645 int size16 = (x & SIZE) == L_16;
1646 int size = size16 ? 2 : 1;
1647 int type = size16 ? R_PCRWORD : R_PCRBYTE;
1650 check_operand (operand + i, size16 ? 0x7fff : 0x7f, "@");
1652 if (operand[i].exp.X_add_number & 1)
1653 as_warn (_("branch operand has odd offset (%lx)\n"),
1654 (unsigned long) operand->exp.X_add_number);
1656 /* The COFF port has always been off by one, changing it
1657 now would be an incompatible change, so we leave it as-is.
1659 We don't want to do this for ELF as we want to be
1660 compatible with the proposed ELF format from Hitachi. */
1661 operand[i].exp.X_add_number -= 1;
1665 operand[i].exp.X_add_number =
1666 ((operand[i].exp.X_add_number & 0xffff) ^ 0x8000) - 0x8000;
1670 operand[i].exp.X_add_number =
1671 ((operand[i].exp.X_add_number & 0xff) ^ 0x80) - 0x80;
1676 operand[i].exp.X_add_number |= output[op_at[i] / 2];
1678 fixP = fix_new_exp (frag_now,
1679 output - frag_now->fr_literal + op_at[i] / 2,
1684 fixP->fx_signed = 1;
1686 else if (x_mode == MEMIND)
1688 check_operand (operand + i, 0xff, "@@");
1689 fix_new_exp (frag_now,
1690 output - frag_now->fr_literal + 1,
1696 else if (x_mode == VECIND)
1698 check_operand (operand + i, 0x7f, "@@");
1699 /* FIXME: approximating the effect of "B31" here...
1700 This is very hackish, and ought to be done a better way. */
1701 operand[i].exp.X_add_number |= 0x80;
1702 fix_new_exp (frag_now,
1703 output - frag_now->fr_literal + 1,
1709 else if (x & ABSJMP)
1712 bfd_reloc_code_real_type reloc_type = R_JMPL1;
1715 /* To be compatible with the proposed H8 ELF format, we
1716 want the relocation's offset to point to the first byte
1717 that will be modified, not to the start of the instruction. */
1719 if ((operand->mode & SIZE) == L_32)
1722 reloc_type = R_RELLONG;
1728 /* This jmp may be a jump or a branch. */
1730 check_operand (operand + i,
1731 SXmode ? 0xffffffff : Hmode ? 0xffffff : 0xffff,
1734 if (operand[i].exp.X_add_number & 1)
1735 as_warn (_("branch operand has odd offset (%lx)\n"),
1736 (unsigned long) operand->exp.X_add_number);
1739 operand[i].exp.X_add_number =
1740 ((operand[i].exp.X_add_number & 0xffff) ^ 0x8000) - 0x8000;
1741 fix_new_exp (frag_now,
1742 output - frag_now->fr_literal + where,
1751 /* Try to give an intelligent error message for common and simple to
1755 clever_message (instruction, operand)
1756 const struct h8_instruction *instruction;
1757 struct h8_op *operand;
1759 /* Find out if there was more than one possible opcode. */
1761 if ((instruction + 1)->idx != instruction->idx)
1765 /* Only one opcode of this flavour, try to guess which operand
1767 for (argn = 0; argn < instruction->noperands; argn++)
1769 switch (instruction->opcode->args.nib[argn])
1772 if (operand[argn].mode != RD16)
1774 as_bad (_("destination operand must be 16 bit register"));
1781 if (operand[argn].mode != RS8)
1783 as_bad (_("source operand must be 8 bit register"));
1789 if (operand[argn].mode != ABS16DST)
1791 as_bad (_("destination operand must be 16bit absolute address"));
1796 if (operand[argn].mode != RD8)
1798 as_bad (_("destination operand must be 8 bit register"));
1804 if (operand[argn].mode != ABS16SRC)
1806 as_bad (_("source operand must be 16bit absolute address"));
1814 as_bad (_("invalid operands"));
1818 /* If OPERAND is part of an address, adjust its size and value given
1819 that it addresses SIZE bytes.
1821 This function decides how big non-immediate constants are when no
1822 size was explicitly given. It also scales down the assembly-level
1823 displacement in an @(d:2,ERn) operand. */
1826 fix_operand_size (operand, size)
1827 struct h8_op *operand;
1830 if (SXmode && (operand->mode & MODE) == DISP)
1832 /* If the user didn't specify an operand width, see if we
1833 can use @(d:2,ERn). */
1834 if ((operand->mode & SIZE) == 0
1835 && operand->exp.X_add_symbol == 0
1836 && operand->exp.X_op_symbol == 0
1837 && (operand->exp.X_add_number == size
1838 || operand->exp.X_add_number == size * 2
1839 || operand->exp.X_add_number == size * 3))
1840 operand->mode |= L_2;
1842 /* Scale down the displacement in an @(d:2,ERn) operand.
1843 X_add_number then contains the desired field value. */
1844 if ((operand->mode & SIZE) == L_2)
1846 if (operand->exp.X_add_number % size != 0)
1847 as_warn (_("operand/size mis-match"));
1848 operand->exp.X_add_number /= size;
1852 if ((operand->mode & SIZE) == 0)
1853 switch (operand->mode & MODE)
1860 /* Pick a 24-bit address unless we know that a 16-bit address
1861 is safe. get_specific() will relax L_24 into L_32 where
1865 && (operand->exp.X_add_number < -32768
1866 || operand->exp.X_add_number > 32767
1867 || operand->exp.X_add_symbol != 0
1868 || operand->exp.X_op_symbol != 0))
1869 operand->mode |= L_24;
1871 operand->mode |= L_16;
1875 /* This condition is long standing, though somewhat suspect. */
1876 if (operand->exp.X_add_number > -128
1877 && operand->exp.X_add_number < 127)
1878 operand->mode |= L_8;
1880 operand->mode |= L_16;
1886 /* This is the guts of the machine-dependent assembler. STR points to
1887 a machine dependent instruction. This function is supposed to emit
1888 the frags/bytes it assembles. */
1896 struct h8_op operand[3];
1897 const struct h8_instruction *instruction;
1898 const struct h8_instruction *prev_instruction;
1905 /* Drop leading whitespace. */
1909 /* Find the op code end. */
1910 for (op_start = op_end = str;
1911 *op_end != 0 && *op_end != ' ';
1921 else if (*op_end == '/' && ! slash)
1925 if (op_end == op_start)
1927 as_bad (_("can't find opcode "));
1933 /* The assembler stops scanning the opcode at slashes, so it fails
1934 to make characters following them lower case. Fix them. */
1937 *slash = TOLOWER (*slash);
1939 instruction = (const struct h8_instruction *)
1940 hash_find (opcode_hash_control, op_start);
1942 if (instruction == NULL)
1944 as_bad (_("unknown opcode"));
1948 /* We used to set input_line_pointer to the result of get_operands,
1949 but that is wrong. Our caller assumes we don't change it. */
1951 operand[0].mode = 0;
1952 operand[1].mode = 0;
1953 operand[2].mode = 0;
1955 if (OP_KIND (instruction->opcode->how) == O_MOVAB
1956 || OP_KIND (instruction->opcode->how) == O_MOVAW
1957 || OP_KIND (instruction->opcode->how) == O_MOVAL)
1958 get_mova_operands (op_end, operand);
1959 else if (OP_KIND (instruction->opcode->how) == O_RTEL
1960 || OP_KIND (instruction->opcode->how) == O_RTSL)
1961 get_rtsl_operands (op_end, operand);
1963 get_operands (instruction->noperands, op_end, operand);
1966 prev_instruction = instruction;
1971 switch (TOLOWER (*dot))
1986 if (OP_KIND (instruction->opcode->how) == O_MOVAB ||
1987 OP_KIND (instruction->opcode->how) == O_MOVAW ||
1988 OP_KIND (instruction->opcode->how) == O_MOVAL)
1990 switch (operand[0].mode & MODE)
1994 fix_operand_size (&operand[1], 1);
1997 fix_operand_size (&operand[1], 2);
2000 fix_operand_size (&operand[1], 4);
2006 for (i = 0; i < 3 && operand[i].mode != 0; i++)
2012 fix_operand_size (&operand[i], 1);
2015 fix_operand_size (&operand[i], 2);
2018 fix_operand_size (&operand[i], 4);
2023 instruction = get_specific (instruction, operand, size);
2025 if (instruction == 0)
2027 /* Couldn't find an opcode which matched the operands. */
2028 char *where = frag_more (2);
2032 clever_message (prev_instruction, operand);
2037 build_bytes (instruction, operand);
2039 #ifdef BFD_ASSEMBLER
2040 dwarf2_emit_insn (instruction->length);
2044 #ifndef BFD_ASSEMBLER
2046 tc_crawl_symbol_chain (headers)
2047 object_headers *headers ATTRIBUTE_UNUSED;
2049 printf (_("call to tc_crawl_symbol_chain \n"));
2054 md_undefined_symbol (name)
2055 char *name ATTRIBUTE_UNUSED;
2060 #ifndef BFD_ASSEMBLER
2062 tc_headers_hook (headers)
2063 object_headers *headers ATTRIBUTE_UNUSED;
2065 printf (_("call to tc_headers_hook \n"));
2069 /* Various routines to kill one day */
2070 /* Equal to MAX_PRECISION in atof-ieee.c */
2071 #define MAX_LITTLENUMS 6
2073 /* Turn a string in input_line_pointer into a floating point constant
2074 of type TYPE, and store the appropriate bytes in *LITP. The number
2075 of LITTLENUMS emitted is stored in *SIZEP. An error message is
2076 returned, or NULL on OK. */
2079 md_atof (type, litP, sizeP)
2085 LITTLENUM_TYPE words[MAX_LITTLENUMS];
2086 LITTLENUM_TYPE *wordP;
2117 return _("Bad call to MD_ATOF()");
2119 t = atof_ieee (input_line_pointer, type, words);
2121 input_line_pointer = t;
2123 *sizeP = prec * sizeof (LITTLENUM_TYPE);
2124 for (wordP = words; prec--;)
2126 md_number_to_chars (litP, (long) (*wordP++), sizeof (LITTLENUM_TYPE));
2127 litP += sizeof (LITTLENUM_TYPE);
2132 const char *md_shortopts = "";
2133 struct option md_longopts[] = {
2134 {NULL, no_argument, NULL, 0}
2137 size_t md_longopts_size = sizeof (md_longopts);
2140 md_parse_option (c, arg)
2141 int c ATTRIBUTE_UNUSED;
2142 char *arg ATTRIBUTE_UNUSED;
2148 md_show_usage (stream)
2149 FILE *stream ATTRIBUTE_UNUSED;
2153 void tc_aout_fix_to_chars PARAMS ((void));
2156 tc_aout_fix_to_chars ()
2158 printf (_("call to tc_aout_fix_to_chars \n"));
2163 md_convert_frag (headers, seg, fragP)
2164 #ifdef BFD_ASSEMBLER
2165 bfd *headers ATTRIBUTE_UNUSED;
2167 object_headers *headers ATTRIBUTE_UNUSED;
2169 segT seg ATTRIBUTE_UNUSED;
2170 fragS *fragP ATTRIBUTE_UNUSED;
2172 printf (_("call to md_convert_frag \n"));
2176 #ifdef BFD_ASSEMBLER
2178 md_section_align (segment, size)
2182 int align = bfd_get_section_alignment (stdoutput, segment);
2183 return ((size + (1 << align) - 1) & (-1 << align));
2187 md_section_align (seg, size)
2191 return ((size + (1 << section_alignment[(int) seg]) - 1)
2192 & (-1 << section_alignment[(int) seg]));
2198 md_apply_fix3 (fixP, valP, seg)
2201 segT seg ATTRIBUTE_UNUSED;
2203 char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
2206 switch (fixP->fx_size)
2212 *buf++ = (val >> 8);
2216 *buf++ = (val >> 24);
2217 *buf++ = (val >> 16);
2218 *buf++ = (val >> 8);
2225 if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
2230 md_estimate_size_before_relax (fragP, segment_type)
2231 register fragS *fragP ATTRIBUTE_UNUSED;
2232 register segT segment_type ATTRIBUTE_UNUSED;
2234 printf (_("call tomd_estimate_size_before_relax \n"));
2238 /* Put number into target byte order. */
2240 md_number_to_chars (ptr, use, nbytes)
2245 number_to_chars_bigendian (ptr, use, nbytes);
2249 md_pcrel_from (fixP)
2250 fixS *fixP ATTRIBUTE_UNUSED;
2255 #ifndef BFD_ASSEMBLER
2257 tc_reloc_mangle (fix_ptr, intr, base)
2259 struct internal_reloc *intr;
2263 symbolS *symbol_ptr;
2265 symbol_ptr = fix_ptr->fx_addsy;
2267 /* If this relocation is attached to a symbol then it's ok
2269 if (fix_ptr->fx_r_type == TC_CONS_RELOC)
2271 /* cons likes to create reloc32's whatever the size of the reloc..
2273 switch (fix_ptr->fx_size)
2276 intr->r_type = R_RELLONG;
2279 intr->r_type = R_RELWORD;
2282 intr->r_type = R_RELBYTE;
2290 intr->r_type = fix_ptr->fx_r_type;
2293 intr->r_vaddr = fix_ptr->fx_frag->fr_address + fix_ptr->fx_where + base;
2294 intr->r_offset = fix_ptr->fx_offset;
2298 if (symbol_ptr->sy_number != -1)
2299 intr->r_symndx = symbol_ptr->sy_number;
2304 /* This case arises when a reference is made to `.'. */
2305 segsym = seg_info (S_GET_SEGMENT (symbol_ptr))->dot;
2307 intr->r_symndx = -1;
2310 intr->r_symndx = segsym->sy_number;
2311 intr->r_offset += S_GET_VALUE (symbol_ptr);
2316 intr->r_symndx = -1;
2318 #else /* BFD_ASSEMBLER */
2320 tc_gen_reloc (section, fixp)
2321 asection *section ATTRIBUTE_UNUSED;
2325 bfd_reloc_code_real_type r_type;
2327 if (fixp->fx_addsy && fixp->fx_subsy)
2329 if ((S_GET_SEGMENT (fixp->fx_addsy) != S_GET_SEGMENT (fixp->fx_subsy))
2330 || S_GET_SEGMENT (fixp->fx_addsy) == undefined_section)
2332 as_bad_where (fixp->fx_file, fixp->fx_line,
2333 "Difference of symbols in different sections is not supported");
2338 rel = (arelent *) xmalloc (sizeof (arelent));
2339 rel->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
2340 *rel->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
2341 rel->address = fixp->fx_frag->fr_address + fixp->fx_where;
2342 rel->addend = fixp->fx_offset;
2344 r_type = fixp->fx_r_type;
2348 fprintf (stderr, "%s\n", bfd_get_reloc_code_name (r_type));
2351 rel->howto = bfd_reloc_type_lookup (stdoutput, r_type);
2352 if (rel->howto == NULL)
2354 as_bad_where (fixp->fx_file, fixp->fx_line,
2355 _("Cannot represent relocation type %s"),
2356 bfd_get_reloc_code_name (r_type));