1 /* tc-sh.c -- Assemble code for the Hitachi Super-H
2 Copyright (C) 1993, 94, 95, 96, 1997 Free Software Foundation.
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
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
22 Written By Steve Chamberlain
31 #include "opcodes/sh-opc.h"
33 const char comment_chars[] = "!";
34 const char line_separator_chars[] = ";";
35 const char line_comment_chars[] = "!#";
37 static void s_uses PARAMS ((int));
39 static void sh_count_relocs PARAMS ((bfd *, segT, PTR));
40 static void sh_frob_section PARAMS ((bfd *, segT, PTR));
42 /* This table describes all the machine specific pseudo-ops the assembler
43 has to support. The fields are:
44 pseudo-op name without dot
45 function to call to execute this pseudo-op
46 Integer arg to pass to the function
50 void s_align_bytes ();
51 static void s_uacons PARAMS ((int));
60 target_big_endian = 0;
63 const pseudo_typeS md_pseudo_table[] =
67 {"form", listing_psize, 0},
68 {"little", little, 0},
69 {"heading", listing_title, 0},
70 {"import", s_ignore, 0},
71 {"page", listing_eject, 0},
72 {"program", s_ignore, 0},
74 {"uaword", s_uacons, 2},
75 {"ualong", s_uacons, 4},
79 /*int md_reloc_size; */
81 int sh_relax; /* set if -relax seen */
83 const char EXP_CHARS[] = "eE";
85 /* Chars that mean this number is a floating point constant */
88 const char FLT_CHARS[] = "rRsSfFdDxXpP";
90 #define C(a,b) ENCODE_RELAX(a,b)
92 #define JREG 14 /* Register used as a temp when relaxing */
93 #define ENCODE_RELAX(what,length) (((what) << 4) + (length))
94 #define GET_WHAT(x) ((x>>4))
96 /* These are the two types of relaxable instrction */
106 #define UNDEF_WORD_DISP 4
112 /* Branch displacements are from the address of the branch plus
113 four, thus all minimum and maximum values have 4 added to them. */
116 #define COND8_LENGTH 2
118 /* There is one extra instruction before the branch, so we must add
119 two more bytes to account for it. */
120 #define COND12_F 4100
121 #define COND12_M -4090
122 #define COND12_LENGTH 6
124 /* ??? The minimum and maximum values are wrong, but this does not matter
125 since this relocation type is not supported yet. */
126 #define COND32_F (1<<30)
127 #define COND32_M -(1<<30)
128 #define COND32_LENGTH 14
130 #define UNCOND12_F 4098
131 #define UNCOND12_M -4092
132 #define UNCOND12_LENGTH 2
134 /* ??? The minimum and maximum values are wrong, but this does not matter
135 since this relocation type is not supported yet. */
136 #define UNCOND32_F (1<<30)
137 #define UNCOND32_M -(1<<30)
138 #define UNCOND32_LENGTH 14
140 const relax_typeS md_relax_table[C (END, 0)] = {
141 { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
142 { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
145 /* C (COND_JUMP, COND8) */
146 { COND8_F, COND8_M, COND8_LENGTH, C (COND_JUMP, COND12) },
147 /* C (COND_JUMP, COND12) */
148 { COND12_F, COND12_M, COND12_LENGTH, C (COND_JUMP, COND32), },
149 /* C (COND_JUMP, COND32) */
150 { COND32_F, COND32_M, COND32_LENGTH, 0, },
151 { 0 }, { 0 }, { 0 }, { 0 },
152 { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
155 /* C (UNCOND_JUMP, UNCOND12) */
156 { UNCOND12_F, UNCOND12_M, UNCOND12_LENGTH, C (UNCOND_JUMP, UNCOND32), },
157 /* C (UNCOND_JUMP, UNCOND32) */
158 { UNCOND32_F, UNCOND32_M, UNCOND32_LENGTH, 0, },
159 { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
160 { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 },
163 static struct hash_control *opcode_hash_control; /* Opcode mnemonics */
166 This function is called once, at assembler startup time. This should
167 set up all the tables, etc that the MD part of the assembler needs
173 sh_opcode_info *opcode;
174 char *prev_name = "";
177 target_big_endian = 1;
179 opcode_hash_control = hash_new ();
181 /* Insert unique names into hash table */
182 for (opcode = sh_table; opcode->name; opcode++)
184 if (strcmp (prev_name, opcode->name))
186 prev_name = opcode->name;
187 hash_insert (opcode_hash_control, opcode->name, (char *) opcode);
191 /* Make all the opcodes with the same name point to the same
193 opcode->name = prev_name;
202 static expressionS immediate; /* absolute expression */
212 /* try and parse a reg name, returns number of chars consumed */
214 parse_reg (src, mode, reg)
219 /* We use !isalnum for the next character after the register name, to
220 make sure that we won't accidentally recognize a symbol name such as
221 'sram' as being a reference to the register 'sr'. */
225 if (src[1] >= '0' && src[1] <= '7' && strncmp(&src[2], "_bank", 5) == 0
226 && ! isalnum (src[7]))
229 *reg = (src[1] - '0');
238 if (src[2] >= '0' && src[2] <= '5' && ! isalnum (src[3]))
241 *reg = 10 + src[2] - '0';
245 if (src[1] >= '0' && src[1] <= '9' && ! isalnum (src[2]))
248 *reg = (src[1] - '0');
253 if (src[0] == 's' && src[1] == 's' && src[2] == 'r' && ! isalnum (src[3]))
259 if (src[0] == 's' && src[1] == 'p' && src[2] == 'c' && ! isalnum (src[3]))
265 if (src[0] == 's' && src[1] == 'r' && ! isalnum (src[2]))
271 if (src[0] == 's' && src[1] == 'p' && ! isalnum (src[2]))
278 if (src[0] == 'p' && src[1] == 'r' && ! isalnum (src[2]))
283 if (src[0] == 'p' && src[1] == 'c' && ! isalnum (src[2]))
288 if (src[0] == 'g' && src[1] == 'b' && src[2] == 'r' && ! isalnum (src[3]))
293 if (src[0] == 'v' && src[1] == 'b' && src[2] == 'r' && ! isalnum (src[3]))
299 if (src[0] == 'm' && src[1] == 'a' && src[2] == 'c' && ! isalnum (src[4]))
312 if (src[0] == 'f' && src[1] == 'r')
316 if (src[3] >= '0' && src[3] <= '5' && ! isalnum (src[4]))
319 *reg = 10 + src[3] - '0';
323 if (src[2] >= '0' && src[2] <= '9' && ! isalnum (src[3]))
326 *reg = (src[2] - '0');
330 if (src[0] == 'f' && src[1] == 'p' && src[2] == 'u' && src[3] == 'l'
331 && ! isalnum (src[4]))
337 if (src[0] == 'f' && src[1] == 'p' && src[2] == 's' && src[3] == 'c'
338 && src[4] == 'r' && ! isalnum (src[5]))
347 static symbolS *dot()
351 /* JF: '.' is pseudo symbol with value of current location
352 in current segment. */
353 fake = FAKE_LABEL_NAME;
354 return symbol_new (fake,
356 (valueT) frag_now_fix (),
370 save = input_line_pointer;
371 input_line_pointer = s;
372 expression (&immediate);
373 if (immediate.X_op == O_absent)
374 as_bad ("missing operand");
375 new = input_line_pointer;
376 input_line_pointer = save;
381 /* The many forms of operand:
384 @Rn Register indirect
397 pr, gbr, vbr, macl, mach
412 /* Must be predecrement */
415 len = parse_reg (src, &mode, &(op->reg));
417 as_bad ("illegal register after @-");
422 else if (src[0] == '(')
424 /* Could be @(disp, rn), @(disp, gbr), @(disp, pc), @(r0, gbr) or
427 len = parse_reg (src, &mode, &(op->reg));
428 if (len && mode == A_REG_N)
433 as_bad ("must be @(r0,...)");
437 /* Now can be rn or gbr */
438 len = parse_reg (src, &mode, &(op->reg));
443 else if (mode == A_REG_N)
445 op->type = A_IND_R0_REG_N;
449 as_bad ("syntax error in @(r0,...)");
454 /* Must be an @(disp,.. thing) */
455 src = parse_exp (src);
458 /* Now can be rn, gbr or pc */
459 len = parse_reg (src, &mode, &op->reg);
464 op->type = A_DISP_REG_N;
466 else if (mode == A_GBR)
468 op->type = A_DISP_GBR;
470 else if (mode == A_DISP_PC)
472 /* Turn a plain @(4,pc) into @(.+4,pc) */
473 if (immediate.X_op == O_constant) {
474 immediate.X_add_symbol = dot();
475 immediate.X_op = O_symbol;
477 op->type = A_DISP_PC;
481 as_bad ("syntax error in @(disp,[Rn, gbr, pc])");
486 as_bad ("syntax error in @(disp,[Rn, gbr, pc])");
491 as_bad ("expecting )");
497 src += parse_reg (src, &mode, &(op->reg));
500 as_bad ("illegal register after @");
516 get_operand (ptr, op)
527 *ptr = parse_exp (src);
532 else if (src[0] == '@')
534 *ptr = parse_at (src, op);
537 len = parse_reg (src, &mode, &(op->reg));
546 /* Not a reg, the only thing left is a displacement */
547 *ptr = parse_exp (src);
548 op->type = A_DISP_PC;
555 get_operands (info, args, operand)
556 sh_opcode_info *info;
558 sh_operand_info *operand;
566 get_operand (&ptr, operand + 0);
573 get_operand (&ptr, operand + 1);
580 get_operand (&ptr, operand + 2);
602 /* Passed a pointer to a list of opcodes which use different
603 addressing modes, return the opcode which matches the opcodes
609 get_specific (opcode, operands)
610 sh_opcode_info *opcode;
611 sh_operand_info *operands;
613 sh_opcode_info *this_try = opcode;
614 char *name = opcode->name;
619 if (this_try->name != name)
621 /* We've looked so far down the table that we've run out of
622 opcodes with the same name */
625 /* look at both operands needed by the opcodes and provided by
626 the user - since an arg test will often fail on the same arg
627 again and again, we'll try and test the last failing arg the
628 first on each opcode try */
630 for (n = 0; this_try->arg[n]; n++)
632 sh_operand_info *user = operands + n;
633 sh_arg_type arg = this_try->arg[n];
644 if (user->type != arg)
648 /* opcode needs r0 */
649 if (user->type != A_REG_N || user->reg != 0)
653 if (user->type != A_R0_GBR || user->reg != 0)
657 if (user->type != F_REG_N || user->reg != 0)
670 /* Opcode needs rn */
671 if (user->type != arg)
680 if (user->type != arg)
685 if (user->type != arg)
696 /* Opcode needs rn */
697 if (user->type != arg - A_REG_M + A_REG_N)
705 /* Opcode needs rn */
706 if (user->type != arg - F_REG_M + F_REG_N)
712 printf ("unhandled %d\n", arg);
724 check (operand, low, high)
725 expressionS *operand;
729 if (operand->X_op != O_constant
730 || operand->X_add_number < low
731 || operand->X_add_number > high)
733 as_bad ("operand must be absolute in range %d..%d", low, high);
735 return operand->X_add_number;
740 insert (where, how, pcrel)
745 fix_new_exp (frag_now,
746 where - frag_now->fr_literal,
755 sh_opcode_info *opcode;
757 int high_byte = target_big_endian ? 0 : 1;
760 if (opcode->arg[0] == A_BDISP8)
762 p = frag_var (rs_machine_dependent,
763 md_relax_table[C (COND_JUMP, COND32)].rlx_length,
764 md_relax_table[C (COND_JUMP, COND8)].rlx_length,
766 immediate.X_add_symbol,
767 immediate.X_add_number,
769 p[high_byte] = (opcode->nibbles[0] << 4) | (opcode->nibbles[1]);
771 else if (opcode->arg[0] == A_BDISP12)
773 p = frag_var (rs_machine_dependent,
774 md_relax_table[C (UNCOND_JUMP, UNCOND32)].rlx_length,
775 md_relax_table[C (UNCOND_JUMP, UNCOND12)].rlx_length,
777 immediate.X_add_symbol,
778 immediate.X_add_number,
780 p[high_byte] = (opcode->nibbles[0] << 4);
785 /* Now we know what sort of opcodes it is, lets build the bytes -
788 build_Mytes (opcode, operand)
789 sh_opcode_info *opcode;
790 sh_operand_info *operand;
795 char *output = frag_more (2);
796 int low_byte = target_big_endian ? 1 : 0;
802 for (index = 0; index < 4; index++)
804 sh_nibble_type i = opcode->nibbles[index];
820 nbuf[index] = reg_b | 0x08;
823 insert (output + low_byte, BFD_RELOC_SH_IMM4, 0);
826 insert (output + low_byte, BFD_RELOC_SH_IMM4BY4, 0);
829 insert (output + low_byte, BFD_RELOC_SH_IMM4BY2, 0);
832 insert (output + low_byte, BFD_RELOC_SH_IMM4, 0);
835 insert (output + low_byte, BFD_RELOC_SH_IMM8BY4, 0);
838 insert (output + low_byte, BFD_RELOC_SH_IMM8BY2, 0);
841 insert (output + low_byte, BFD_RELOC_SH_IMM8, 0);
844 insert (output, BFD_RELOC_SH_PCRELIMM8BY4, 1);
847 insert (output, BFD_RELOC_SH_PCRELIMM8BY2, 1);
850 printf ("failed for %d\n", i);
854 if (! target_big_endian) {
855 output[1] = (nbuf[0] << 4) | (nbuf[1]);
856 output[0] = (nbuf[2] << 4) | (nbuf[3]);
859 output[0] = (nbuf[0] << 4) | (nbuf[1]);
860 output[1] = (nbuf[2] << 4) | (nbuf[3]);
864 /* This is the guts of the machine-dependent assembler. STR points to a
865 machine dependent instruction. This function is supposed to emit
866 the frags/bytes it assembles to.
873 unsigned char *op_start;
874 unsigned char *op_end;
875 sh_operand_info operand[3];
876 sh_opcode_info *opcode;
879 /* Drop leading whitespace */
883 /* find the op code end */
884 for (op_start = op_end = (unsigned char *) (str);
887 && !is_end_of_line[*op_end] && *op_end != ' ';
890 name[nlen] = op_start[nlen];
897 as_bad ("can't find opcode ");
900 opcode = (sh_opcode_info *) hash_find (opcode_hash_control, name);
904 as_bad ("unknown opcode");
909 && ! seg_info (now_seg)->tc_segment_info_data.in_code)
911 /* Output a CODE reloc to tell the linker that the following
912 bytes are instructions, not data. */
913 fix_new (frag_now, frag_now_fix (), 2, &abs_symbol, 0, 0,
915 seg_info (now_seg)->tc_segment_info_data.in_code = 1;
918 if (opcode->arg[0] == A_BDISP12
919 || opcode->arg[0] == A_BDISP8)
921 parse_exp (op_end + 1);
922 build_relax (opcode);
926 if (opcode->arg[0] != A_END)
928 get_operands (opcode, op_end, operand);
930 opcode = get_specific (opcode, operand);
934 /* Couldn't find an opcode which matched the operands */
935 char *where = frag_more (2);
939 as_bad ("invalid operands for opcode");
943 build_Mytes (opcode, operand);
948 /* This routine is called each time a label definition is seen. It
949 emits a BFD_RELOC_SH_LABEL reloc if necessary. */
954 static fragS *last_label_frag;
955 static int last_label_offset;
958 && seg_info (now_seg)->tc_segment_info_data.in_code)
962 offset = frag_now_fix ();
963 if (frag_now != last_label_frag
964 || offset != last_label_offset)
966 fix_new (frag_now, offset, 2, &abs_symbol, 0, 0, BFD_RELOC_SH_LABEL);
967 last_label_frag = frag_now;
968 last_label_offset = offset;
973 /* This routine is called when the assembler is about to output some
974 data. It emits a BFD_RELOC_SH_DATA reloc if necessary. */
977 sh_flush_pending_output ()
980 && seg_info (now_seg)->tc_segment_info_data.in_code)
982 fix_new (frag_now, frag_now_fix (), 2, &abs_symbol, 0, 0,
984 seg_info (now_seg)->tc_segment_info_data.in_code = 0;
989 DEFUN (md_undefined_symbol, (name),
998 DEFUN (tc_crawl_symbol_chain, (headers),
999 object_headers * headers)
1001 printf ("call to tc_crawl_symbol_chain \n");
1005 DEFUN (tc_headers_hook, (headers),
1006 object_headers * headers)
1008 printf ("call to tc_headers_hook \n");
1013 /* Various routines to kill one day */
1014 /* Equal to MAX_PRECISION in atof-ieee.c */
1015 #define MAX_LITTLENUMS 6
1017 /* Turn a string in input_line_pointer into a floating point constant of type
1018 type, and store the appropriate bytes in *litP. The number of LITTLENUMS
1019 emitted is stored in *sizeP . An error message is returned, or NULL on OK.
1022 md_atof (type, litP, sizeP)
1028 LITTLENUM_TYPE words[4];
1044 return "bad call to md_atof";
1047 t = atof_ieee (input_line_pointer, type, words);
1049 input_line_pointer = t;
1053 if (! target_big_endian)
1055 for (i = prec - 1; i >= 0; i--)
1057 md_number_to_chars (litP, (valueT) words[i], 2);
1063 for (i = 0; i < prec; i++)
1065 md_number_to_chars (litP, (valueT) words[i], 2);
1073 /* Handle the .uses pseudo-op. This pseudo-op is used just before a
1074 call instruction. It refers to a label of the instruction which
1075 loads the register which the call uses. We use it to generate a
1076 special reloc for the linker. */
1085 as_warn (".uses pseudo-op seen when not relaxing");
1089 if (ex.X_op != O_symbol || ex.X_add_number != 0)
1091 as_bad ("bad .uses format");
1092 ignore_rest_of_line ();
1096 fix_new_exp (frag_now, frag_now_fix (), 2, &ex, 1, BFD_RELOC_SH_USES);
1098 demand_empty_rest_of_line ();
1101 CONST char *md_shortopts = "";
1102 struct option md_longopts[] = {
1104 #define OPTION_RELAX (OPTION_MD_BASE)
1105 #define OPTION_LITTLE (OPTION_MD_BASE+1)
1107 {"relax", no_argument, NULL, OPTION_RELAX},
1108 {"little", no_argument, NULL, OPTION_LITTLE},
1109 {NULL, no_argument, NULL, 0}
1111 size_t md_longopts_size = sizeof(md_longopts);
1114 md_parse_option (c, arg)
1125 target_big_endian = 0;
1136 md_show_usage (stream)
1141 -little generate little endian code\n\
1142 -relax alter jump instructions for long displacements\n");
1145 int md_short_jump_size;
1148 tc_Nout_fix_to_chars ()
1150 printf ("call to tc_Nout_fix_to_chars \n");
1155 md_create_short_jump (ptr, from_Nddr, to_Nddr, frag, to_symbol)
1162 as_fatal ("failed sanity check.");
1166 md_create_long_jump (ptr, from_Nddr, to_Nddr, frag, to_symbol)
1168 addressT from_Nddr, to_Nddr;
1172 as_fatal ("failed sanity check.");
1175 /* This struct is used to pass arguments to sh_count_relocs through
1176 bfd_map_over_sections. */
1178 struct sh_count_relocs
1180 /* Symbol we are looking for. */
1182 /* Count of relocs found. */
1186 /* Count the number of fixups in a section which refer to a particular
1187 symbol. When using BFD_ASSEMBLER, this is called via
1188 bfd_map_over_sections. */
1192 sh_count_relocs (abfd, sec, data)
1197 struct sh_count_relocs *info = (struct sh_count_relocs *) data;
1198 segment_info_type *seginfo;
1202 seginfo = seg_info (sec);
1203 if (seginfo == NULL)
1207 for (fix = seginfo->fix_root; fix != NULL; fix = fix->fx_next)
1209 if (fix->fx_addsy == sym)
1217 /* Handle the count relocs for a particular section. When using
1218 BFD_ASSEMBLER, this is called via bfd_map_over_sections. */
1222 sh_frob_section (abfd, sec, ignore)
1227 segment_info_type *seginfo;
1230 seginfo = seg_info (sec);
1231 if (seginfo == NULL)
1234 for (fix = seginfo->fix_root; fix != NULL; fix = fix->fx_next)
1239 struct sh_count_relocs info;
1241 if (fix->fx_r_type != BFD_RELOC_SH_USES)
1244 /* The BFD_RELOC_SH_USES reloc should refer to a defined local
1245 symbol in the same section. */
1246 sym = fix->fx_addsy;
1248 || fix->fx_subsy != NULL
1249 || fix->fx_addnumber != 0
1250 || S_GET_SEGMENT (sym) != sec
1251 #if ! defined (BFD_ASSEMBLER) && defined (OBJ_COFF)
1252 || S_GET_STORAGE_CLASS (sym) == C_EXT
1254 || S_IS_EXTERNAL (sym))
1256 as_warn_where (fix->fx_file, fix->fx_line,
1257 ".uses does not refer to a local symbol in the same section");
1261 /* Look through the fixups again, this time looking for one
1262 at the same location as sym. */
1263 val = S_GET_VALUE (sym);
1264 for (fscan = seginfo->fix_root;
1266 fscan = fscan->fx_next)
1267 if (val == fscan->fx_frag->fr_address + fscan->fx_where
1268 && fscan->fx_r_type != BFD_RELOC_SH_ALIGN
1269 && fscan->fx_r_type != BFD_RELOC_SH_CODE
1270 && fscan->fx_r_type != BFD_RELOC_SH_DATA
1271 && fscan->fx_r_type != BFD_RELOC_SH_LABEL)
1275 as_warn_where (fix->fx_file, fix->fx_line,
1276 "can't find fixup pointed to by .uses");
1280 if (fscan->fx_tcbit)
1282 /* We've already done this one. */
1286 /* fscan should also be a fixup to a local symbol in the same
1288 sym = fscan->fx_addsy;
1290 || fscan->fx_subsy != NULL
1291 || fscan->fx_addnumber != 0
1292 || S_GET_SEGMENT (sym) != sec
1293 #if ! defined (BFD_ASSEMBLER) && defined (OBJ_COFF)
1294 || S_GET_STORAGE_CLASS (sym) == C_EXT
1296 || S_IS_EXTERNAL (sym))
1298 as_warn_where (fix->fx_file, fix->fx_line,
1299 ".uses target does not refer to a local symbol in the same section");
1303 /* Now we look through all the fixups of all the sections,
1304 counting the number of times we find a reference to sym. */
1307 #ifdef BFD_ASSEMBLER
1308 bfd_map_over_sections (stdoutput, sh_count_relocs, (PTR) &info);
1313 for (iscan = SEG_E0; iscan < SEG_UNKNOWN; iscan++)
1314 sh_count_relocs ((bfd *) NULL, iscan, (PTR) &info);
1321 /* Generate a BFD_RELOC_SH_COUNT fixup at the location of sym.
1322 We have already adjusted the value of sym to include the
1323 fragment address, so we undo that adjustment here. */
1324 subseg_change (sec, 0);
1325 fix_new (sym->sy_frag, S_GET_VALUE (sym) - sym->sy_frag->fr_address,
1326 4, &abs_symbol, info.count, 0, BFD_RELOC_SH_COUNT);
1330 /* This function is called after the symbol table has been completed,
1331 but before the relocs or section contents have been written out.
1332 If we have seen any .uses pseudo-ops, they point to an instruction
1333 which loads a register with the address of a function. We look
1334 through the fixups to find where the function address is being
1335 loaded from. We then generate a COUNT reloc giving the number of
1336 times that function address is referred to. The linker uses this
1337 information when doing relaxing, to decide when it can eliminate
1338 the stored function address entirely. */
1346 #ifdef BFD_ASSEMBLER
1347 bfd_map_over_sections (stdoutput, sh_frob_section, (PTR) NULL);
1352 for (iseg = SEG_E0; iseg < SEG_UNKNOWN; iseg++)
1353 sh_frob_section ((bfd *) NULL, iseg, (PTR) NULL);
1358 /* Called after relaxing. Set the correct sizes of the fragments, and
1359 create relocs so that md_apply_fix will fill in the correct values. */
1362 md_convert_frag (headers, seg, fragP)
1363 #ifdef BFD_ASSEMBLER
1366 object_headers *headers;
1373 switch (fragP->fr_subtype)
1375 case C (COND_JUMP, COND8):
1376 subseg_change (seg, 0);
1377 fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol, fragP->fr_offset,
1378 1, BFD_RELOC_SH_PCDISP8BY2);
1383 case C (UNCOND_JUMP, UNCOND12):
1384 subseg_change (seg, 0);
1385 fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol, fragP->fr_offset,
1386 1, BFD_RELOC_SH_PCDISP12BY2);
1391 case C (UNCOND_JUMP, UNCOND32):
1392 case C (UNCOND_JUMP, UNDEF_WORD_DISP):
1393 if (fragP->fr_symbol == NULL)
1394 as_bad ("at 0x%lx, displacement overflows 12-bit field",
1395 (unsigned long) fragP->fr_address);
1397 as_bad ("at 0x%lx, displacement to %sdefined symbol %s overflows 12-bit field",
1398 (unsigned long) fragP->fr_address,
1399 S_IS_DEFINED (fragP->fr_symbol) ? "" : "un",
1400 S_GET_NAME (fragP->fr_symbol));
1402 #if 0 /* This code works, but generates poor code and the compiler
1403 should never produce a sequence that requires it to be used. */
1405 /* A jump wont fit in 12 bits, make code which looks like
1411 int t = buffer[0] & 0x10;
1413 buffer[highbyte] = 0xa0; /* branch over move and disp */
1414 buffer[lowbyte] = 3;
1415 buffer[highbyte+2] = 0xd0 | JREG; /* Build mov insn */
1416 buffer[lowbyte+2] = 0x00;
1418 buffer[highbyte+4] = 0; /* space for 32 bit jump disp */
1419 buffer[lowbyte+4] = 0;
1420 buffer[highbyte+6] = 0;
1421 buffer[lowbyte+6] = 0;
1423 buffer[highbyte+8] = 0x40 | JREG; /* Build jmp @JREG */
1424 buffer[lowbyte+8] = t ? 0xb : 0x2b;
1426 buffer[highbyte+10] = 0x20; /* build nop */
1427 buffer[lowbyte+10] = 0x0b;
1429 /* Make reloc for the long disp */
1437 fragP->fr_fix += UNCOND32_LENGTH;
1444 case C (COND_JUMP, COND12):
1445 /* A bcond won't fit, so turn it into a b!cond; bra disp; nop */
1447 unsigned char *buffer =
1448 (unsigned char *) (fragP->fr_fix + fragP->fr_literal);
1449 int highbyte = target_big_endian ? 0 : 1;
1450 int lowbyte = target_big_endian ? 1 : 0;
1452 /* Toggle the true/false bit of the bcond. */
1453 buffer[highbyte] ^= 0x2;
1455 /* Build a relocation to six bytes farther on. */
1456 subseg_change (seg, 0);
1457 fix_new (fragP, fragP->fr_fix, 2,
1458 #ifdef BFD_ASSEMBLER
1459 section_symbol (seg),
1461 seg_info (seg)->dot,
1463 fragP->fr_address + fragP->fr_fix + 6,
1464 1, BFD_RELOC_SH_PCDISP8BY2);
1466 /* Set up a jump instruction. */
1467 buffer[highbyte + 2] = 0xa0;
1468 buffer[lowbyte + 2] = 0;
1469 fix_new (fragP, fragP->fr_fix + 2, 2, fragP->fr_symbol,
1470 fragP->fr_offset, 1, BFD_RELOC_SH_PCDISP12BY2);
1472 /* Fill in a NOP instruction. */
1473 buffer[highbyte + 4] = 0x0;
1474 buffer[lowbyte + 4] = 0x9;
1482 case C (COND_JUMP, COND32):
1483 case C (COND_JUMP, UNDEF_WORD_DISP):
1484 if (fragP->fr_symbol == NULL)
1485 as_bad ("at 0x%lx, displacement overflows 8-bit field",
1486 (unsigned long) fragP->fr_address);
1488 as_bad ("at 0x%lx, displacement to %sdefined symbol %s overflows 8-bit field ",
1489 (unsigned long) fragP->fr_address,
1490 S_IS_DEFINED (fragP->fr_symbol) ? "" : "un",
1491 S_GET_NAME (fragP->fr_symbol));
1493 #if 0 /* This code works, but generates poor code, and the compiler
1494 should never produce a sequence that requires it to be used. */
1496 /* A bcond won't fit and it won't go into a 12 bit
1497 displacement either, the code sequence looks like:
1506 buffer[0] ^= 0x2; /* Toggle T/F bit */
1508 buffer[1] = 5; /* branch over mov, jump, nop and ptr */
1509 buffer[2] = 0xd0 | JREG; /* Build mov insn */
1511 buffer[4] = 0x40 | JREG; /* Build jmp @JREG */
1513 buffer[6] = 0x20; /* build nop */
1515 buffer[8] = 0; /* space for 32 bit jump disp */
1521 /* Make reloc for the long disp */
1529 fragP->fr_fix += COND32_LENGTH;
1540 if (donerelax && !sh_relax)
1541 as_warn_where (fragP->fr_file, fragP->fr_line,
1542 "overflow in branch to %s; converted into longer instruction sequence",
1543 (fragP->fr_symbol != NULL
1544 ? S_GET_NAME (fragP->fr_symbol)
1549 DEFUN (md_section_align, (seg, size),
1553 #ifdef BFD_ASSEMBLER
1556 #else /* ! OBJ_ELF */
1557 return ((size + (1 << bfd_get_section_alignment (stdoutput, seg)) - 1)
1558 & (-1 << bfd_get_section_alignment (stdoutput, seg)));
1559 #endif /* ! OBJ_ELF */
1560 #else /* ! BFD_ASSEMBLER */
1561 return ((size + (1 << section_alignment[(int) seg]) - 1)
1562 & (-1 << section_alignment[(int) seg]));
1563 #endif /* ! BFD_ASSEMBLER */
1566 /* This static variable is set by s_uacons to tell sh_cons_align that
1567 the expession does not need to be aligned. */
1569 static int sh_no_align_cons = 0;
1571 /* This handles the unaligned space allocation pseudo-ops, such as
1572 .uaword. .uaword is just like .word, but the value does not need
1579 /* Tell sh_cons_align not to align this value. */
1580 sh_no_align_cons = 1;
1584 /* If a .word, et. al., pseud-op is seen, warn if the value is not
1585 aligned correctly. Note that this can cause warnings to be issued
1586 when assembling initialized structured which were declared with the
1587 packed attribute. FIXME: Perhaps we should require an option to
1588 enable this warning? */
1591 sh_cons_align (nbytes)
1597 if (sh_no_align_cons)
1599 /* This is an unaligned pseudo-op. */
1600 sh_no_align_cons = 0;
1605 while ((nbytes & 1) == 0)
1614 if (now_seg == absolute_section)
1616 if ((abs_section_offset & ((1 << nalign) - 1)) != 0)
1617 as_warn ("misaligned data");
1621 p = frag_var (rs_align_code, 1, 1, (relax_substateT) 0,
1622 (symbolS *) NULL, (offsetT) nalign, (char *) NULL);
1624 record_alignment (now_seg, nalign);
1627 /* When relaxing, we need to output a reloc for any .align directive
1628 that requests alignment to a four byte boundary or larger. This is
1629 also where we check for misaligned data. */
1632 sh_handle_align (frag)
1636 && frag->fr_type == rs_align
1637 && frag->fr_address + frag->fr_fix > 0
1638 && frag->fr_offset > 1
1639 && now_seg != bss_section)
1640 fix_new (frag, frag->fr_fix, 2, &abs_symbol, frag->fr_offset, 0,
1641 BFD_RELOC_SH_ALIGN);
1643 if (frag->fr_type == rs_align_code
1644 && frag->fr_next->fr_address - frag->fr_address - frag->fr_fix != 0)
1645 as_warn_where (frag->fr_file, frag->fr_line, "misaligned data");
1648 /* This macro decides whether a particular reloc is an entry in a
1649 switch table. It is used when relaxing, because the linker needs
1650 to know about all such entries so that it can adjust them if
1653 #ifdef BFD_ASSEMBLER
1654 #define SWITCH_TABLE_CONS(fix) (0)
1656 #define SWITCH_TABLE_CONS(fix) \
1657 ((fix)->fx_r_type == 0 \
1658 && ((fix)->fx_size == 2 \
1659 || (fix)->fx_size == 4))
1662 #define SWITCH_TABLE(fix) \
1663 ((fix)->fx_addsy != NULL \
1664 && (fix)->fx_subsy != NULL \
1665 && S_GET_SEGMENT ((fix)->fx_addsy) == text_section \
1666 && S_GET_SEGMENT ((fix)->fx_subsy) == text_section \
1667 && ((fix)->fx_r_type == BFD_RELOC_32 \
1668 || (fix)->fx_r_type == BFD_RELOC_16 \
1669 || SWITCH_TABLE_CONS (fix)))
1671 /* See whether we need to force a relocation into the output file.
1672 This is used to force out switch and PC relative relocations when
1676 sh_force_relocation (fix)
1682 return (fix->fx_pcrel
1683 || SWITCH_TABLE (fix)
1684 || fix->fx_r_type == BFD_RELOC_SH_COUNT
1685 || fix->fx_r_type == BFD_RELOC_SH_ALIGN
1686 || fix->fx_r_type == BFD_RELOC_SH_CODE
1687 || fix->fx_r_type == BFD_RELOC_SH_DATA
1688 || fix->fx_r_type == BFD_RELOC_SH_LABEL);
1691 /* Apply a fixup to the object file. */
1693 #ifdef BFD_ASSEMBLER
1695 md_apply_fix (fixP, valp)
1700 md_apply_fix (fixP, val)
1705 char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
1706 int lowbyte = target_big_endian ? 1 : 0;
1707 int highbyte = target_big_endian ? 0 : 1;
1708 #ifdef BFD_ASSEMBLER
1712 #ifndef BFD_ASSEMBLER
1713 if (fixP->fx_r_type == 0)
1715 if (fixP->fx_size == 2)
1716 fixP->fx_r_type = BFD_RELOC_16;
1717 else if (fixP->fx_size == 4)
1718 fixP->fx_r_type = BFD_RELOC_32;
1719 else if (fixP->fx_size == 1)
1720 fixP->fx_r_type = BFD_RELOC_SH_IMM8;
1726 switch (fixP->fx_r_type)
1728 case BFD_RELOC_SH_IMM4:
1729 *buf = (*buf & 0xf0) | (val & 0xf);
1732 case BFD_RELOC_SH_IMM4BY2:
1733 *buf = (*buf & 0xf0) | ((val >> 1) & 0xf);
1736 case BFD_RELOC_SH_IMM4BY4:
1737 *buf = (*buf & 0xf0) | ((val >> 2) & 0xf);
1740 case BFD_RELOC_SH_IMM8BY2:
1744 case BFD_RELOC_SH_IMM8BY4:
1749 case BFD_RELOC_SH_IMM8:
1753 case BFD_RELOC_SH_PCRELIMM8BY4:
1754 /* The lower two bits of the PC are cleared before the
1755 displacement is added in. We can assume that the destination
1756 is on a 4 byte bounday. If this instruction is also on a 4
1757 byte boundary, then we want
1759 and target - here is a multiple of 4.
1760 Otherwise, we are on a 2 byte boundary, and we want
1761 (target - (here - 2)) / 4
1762 and target - here is not a multiple of 4. Computing
1763 (target - (here - 2)) / 4 == (target - here + 2) / 4
1764 works for both cases, since in the first case the addition of
1765 2 will be removed by the division. target - here is in the
1767 val = (val + 2) / 4;
1769 as_bad_where (fixP->fx_file, fixP->fx_line, "pcrel too far");
1773 case BFD_RELOC_SH_PCRELIMM8BY2:
1776 as_bad_where (fixP->fx_file, fixP->fx_line, "pcrel too far");
1780 case BFD_RELOC_SH_PCDISP8BY2:
1782 if (val < -0x80 || val > 0x7f)
1783 as_bad_where (fixP->fx_file, fixP->fx_line, "pcrel too far");
1787 case BFD_RELOC_SH_PCDISP12BY2:
1789 if (val < -0x800 || val >= 0x7ff)
1790 as_bad_where (fixP->fx_file, fixP->fx_line, "pcrel too far");
1791 buf[lowbyte] = val & 0xff;
1792 buf[highbyte] |= (val >> 8) & 0xf;
1796 if (! target_big_endian)
1813 if (! target_big_endian)
1825 case BFD_RELOC_SH_USES:
1826 /* Pass the value into sh_coff_reloc_mangle. */
1827 fixP->fx_addnumber = val;
1830 case BFD_RELOC_SH_COUNT:
1831 case BFD_RELOC_SH_ALIGN:
1832 case BFD_RELOC_SH_CODE:
1833 case BFD_RELOC_SH_DATA:
1834 case BFD_RELOC_SH_LABEL:
1835 /* Nothing to do here. */
1842 #ifdef BFD_ASSEMBLER
1847 int md_long_jump_size;
1849 /* Called just before address relaxation. Return the length
1850 by which a fragment must grow to reach it's destination. */
1853 md_estimate_size_before_relax (fragP, segment_type)
1854 register fragS *fragP;
1855 register segT segment_type;
1857 switch (fragP->fr_subtype)
1859 case C (UNCOND_JUMP, UNDEF_DISP):
1860 /* used to be a branch to somewhere which was unknown */
1861 if (!fragP->fr_symbol)
1863 fragP->fr_subtype = C (UNCOND_JUMP, UNCOND12);
1864 fragP->fr_var = md_relax_table[C (UNCOND_JUMP, UNCOND12)].rlx_length;
1866 else if (S_GET_SEGMENT (fragP->fr_symbol) == segment_type)
1868 fragP->fr_subtype = C (UNCOND_JUMP, UNCOND12);
1869 fragP->fr_var = md_relax_table[C (UNCOND_JUMP, UNCOND12)].rlx_length;
1873 fragP->fr_subtype = C (UNCOND_JUMP, UNDEF_WORD_DISP);
1874 fragP->fr_var = md_relax_table[C (UNCOND_JUMP, UNCOND32)].rlx_length;
1875 return md_relax_table[C (UNCOND_JUMP, UNCOND32)].rlx_length;
1881 case C (COND_JUMP, UNDEF_DISP):
1882 /* used to be a branch to somewhere which was unknown */
1883 if (fragP->fr_symbol
1884 && S_GET_SEGMENT (fragP->fr_symbol) == segment_type)
1886 /* Got a symbol and it's defined in this segment, become byte
1887 sized - maybe it will fix up */
1888 fragP->fr_subtype = C (COND_JUMP, COND8);
1889 fragP->fr_var = md_relax_table[C (COND_JUMP, COND8)].rlx_length;
1891 else if (fragP->fr_symbol)
1893 /* Its got a segment, but its not ours, so it will always be long */
1894 fragP->fr_subtype = C (COND_JUMP, UNDEF_WORD_DISP);
1895 fragP->fr_var = md_relax_table[C (COND_JUMP, COND32)].rlx_length;
1896 return md_relax_table[C (COND_JUMP, COND32)].rlx_length;
1900 /* We know the abs value */
1901 fragP->fr_subtype = C (COND_JUMP, COND8);
1902 fragP->fr_var = md_relax_table[C (COND_JUMP, COND8)].rlx_length;
1907 return fragP->fr_var;
1910 /* Put number into target byte order */
1913 md_number_to_chars (ptr, use, nbytes)
1918 if (! target_big_endian)
1919 number_to_chars_littleendian (ptr, use, nbytes);
1921 number_to_chars_bigendian (ptr, use, nbytes);
1925 md_pcrel_from (fixP)
1928 return fixP->fx_size + fixP->fx_where + fixP->fx_frag->fr_address + 2;
1934 tc_coff_sizemachdep (frag)
1937 return md_relax_table[frag->fr_subtype].rlx_length;
1940 #endif /* OBJ_COFF */
1942 /* When we align the .text section, insert the correct NOP pattern. */
1945 sh_do_align (n, fill, len, max)
1952 #ifdef BFD_ASSEMBLER
1953 && (now_seg->flags & SEC_CODE) != 0
1955 && now_seg != data_section
1956 && now_seg != bss_section
1960 static const unsigned char big_nop_pattern[] = { 0x00, 0x09 };
1961 static const unsigned char little_nop_pattern[] = { 0x09, 0x00 };
1963 /* First align to a 2 byte boundary, in case there is an odd
1965 frag_align (1, 0, 0);
1966 if (target_big_endian)
1967 frag_align_pattern (n, big_nop_pattern, sizeof big_nop_pattern, max);
1969 frag_align_pattern (n, little_nop_pattern, sizeof little_nop_pattern,
1977 #ifndef BFD_ASSEMBLER
1980 /* Map BFD relocs to SH COFF relocs. */
1984 bfd_reloc_code_real_type bfd_reloc;
1988 static const struct reloc_map coff_reloc_map[] =
1990 { BFD_RELOC_32, R_SH_IMM32 },
1991 { BFD_RELOC_16, R_SH_IMM16 },
1992 { BFD_RELOC_8, R_SH_IMM8 },
1993 { BFD_RELOC_SH_PCDISP8BY2, R_SH_PCDISP8BY2 },
1994 { BFD_RELOC_SH_PCDISP12BY2, R_SH_PCDISP },
1995 { BFD_RELOC_SH_IMM4, R_SH_IMM4 },
1996 { BFD_RELOC_SH_IMM4BY2, R_SH_IMM4BY2 },
1997 { BFD_RELOC_SH_IMM4BY4, R_SH_IMM4BY4 },
1998 { BFD_RELOC_SH_IMM8, R_SH_IMM8 },
1999 { BFD_RELOC_SH_IMM8BY2, R_SH_IMM8BY2 },
2000 { BFD_RELOC_SH_IMM8BY4, R_SH_IMM8BY4 },
2001 { BFD_RELOC_SH_PCRELIMM8BY2, R_SH_PCRELIMM8BY2 },
2002 { BFD_RELOC_SH_PCRELIMM8BY4, R_SH_PCRELIMM8BY4 },
2003 { BFD_RELOC_SH_SWITCH16, R_SH_SWITCH16 },
2004 { BFD_RELOC_SH_SWITCH32, R_SH_SWITCH32 },
2005 { BFD_RELOC_SH_USES, R_SH_USES },
2006 { BFD_RELOC_SH_COUNT, R_SH_COUNT },
2007 { BFD_RELOC_SH_ALIGN, R_SH_ALIGN },
2008 { BFD_RELOC_SH_CODE, R_SH_CODE },
2009 { BFD_RELOC_SH_DATA, R_SH_DATA },
2010 { BFD_RELOC_SH_LABEL, R_SH_LABEL },
2011 { BFD_RELOC_UNUSED, 0 }
2014 /* Adjust a reloc for the SH. This is similar to the generic code,
2015 but does some minor tweaking. */
2018 sh_coff_reloc_mangle (seg, fix, intr, paddr)
2019 segment_info_type *seg;
2021 struct internal_reloc *intr;
2024 symbolS *symbol_ptr = fix->fx_addsy;
2027 intr->r_vaddr = paddr + fix->fx_frag->fr_address + fix->fx_where;
2029 if (! SWITCH_TABLE (fix))
2031 const struct reloc_map *rm;
2033 for (rm = coff_reloc_map; rm->bfd_reloc != BFD_RELOC_UNUSED; rm++)
2034 if (rm->bfd_reloc == (bfd_reloc_code_real_type) fix->fx_r_type)
2036 if (rm->bfd_reloc == BFD_RELOC_UNUSED)
2037 as_bad_where (fix->fx_file, fix->fx_line,
2038 "Can not represent %s relocation in this object file format",
2039 bfd_get_reloc_code_name (fix->fx_r_type));
2040 intr->r_type = rm->sh_reloc;
2047 if (fix->fx_r_type == BFD_RELOC_16)
2048 intr->r_type = R_SH_SWITCH16;
2049 else if (fix->fx_r_type == BFD_RELOC_32)
2050 intr->r_type = R_SH_SWITCH32;
2054 /* For a switch reloc, we set r_offset to the difference between
2055 the reloc address and the subtrahend. When the linker is
2056 doing relaxing, it can use the determine the starting and
2057 ending points of the switch difference expression. */
2058 intr->r_offset = intr->r_vaddr - S_GET_VALUE (fix->fx_subsy);
2061 /* PC relative relocs are always against the current section. */
2062 if (symbol_ptr == NULL)
2064 switch (fix->fx_r_type)
2066 case BFD_RELOC_SH_PCRELIMM8BY2:
2067 case BFD_RELOC_SH_PCRELIMM8BY4:
2068 case BFD_RELOC_SH_PCDISP8BY2:
2069 case BFD_RELOC_SH_PCDISP12BY2:
2070 case BFD_RELOC_SH_USES:
2071 symbol_ptr = seg->dot;
2078 if (fix->fx_r_type == BFD_RELOC_SH_USES)
2080 /* We can't store the offset in the object file, since this
2081 reloc does not take up any space, so we store it in r_offset.
2082 The fx_addnumber field was set in md_apply_fix. */
2083 intr->r_offset = fix->fx_addnumber;
2085 else if (fix->fx_r_type == BFD_RELOC_SH_COUNT)
2087 /* We can't store the count in the object file, since this reloc
2088 does not take up any space, so we store it in r_offset. The
2089 fx_offset field was set when the fixup was created in
2090 sh_coff_frob_file. */
2091 intr->r_offset = fix->fx_offset;
2092 /* This reloc is always absolute. */
2095 else if (fix->fx_r_type == BFD_RELOC_SH_ALIGN)
2097 /* Store the alignment in the r_offset field. */
2098 intr->r_offset = fix->fx_offset;
2099 /* This reloc is always absolute. */
2102 else if (fix->fx_r_type == BFD_RELOC_SH_CODE
2103 || fix->fx_r_type == BFD_RELOC_SH_DATA
2104 || fix->fx_r_type == BFD_RELOC_SH_LABEL)
2106 /* These relocs are always absolute. */
2110 /* Turn the segment of the symbol into an offset. */
2111 if (symbol_ptr != NULL)
2113 dot = segment_info[S_GET_SEGMENT (symbol_ptr)].dot;
2115 intr->r_symndx = dot->sy_number;
2117 intr->r_symndx = symbol_ptr->sy_number;
2120 intr->r_symndx = -1;
2123 #endif /* OBJ_COFF */
2124 #endif /* ! BFD_ASSEMBLER */
2126 #ifdef BFD_ASSEMBLER
2128 /* Create a reloc. */
2131 tc_gen_reloc (section, fixp)
2136 bfd_reloc_code_real_type r_type;
2138 rel = (arelent *) xmalloc (sizeof (arelent));
2139 rel->sym_ptr_ptr = &fixp->fx_addsy->bsym;
2140 rel->address = fixp->fx_frag->fr_address + fixp->fx_where;
2142 r_type = fixp->fx_r_type;
2144 if (SWITCH_TABLE (fixp))
2146 rel->addend = rel->address - S_GET_VALUE (fixp->fx_subsy);
2147 if (r_type == BFD_RELOC_16)
2148 r_type = BFD_RELOC_SH_SWITCH16;
2149 else if (r_type == BFD_RELOC_32)
2150 r_type = BFD_RELOC_SH_SWITCH32;
2154 else if (r_type == BFD_RELOC_SH_USES)
2155 rel->addend = fixp->fx_addnumber;
2156 else if (r_type == BFD_RELOC_SH_COUNT)
2157 rel->addend = fixp->fx_offset;
2158 else if (r_type == BFD_RELOC_SH_ALIGN)
2159 rel->addend = fixp->fx_offset;
2160 else if (fixp->fx_pcrel)
2161 rel->addend = fixp->fx_addnumber;
2165 rel->howto = bfd_reloc_type_lookup (stdoutput, r_type);
2166 if (rel->howto == NULL)
2168 as_bad_where (fixp->fx_file, fixp->fx_line,
2169 "Cannot represent relocation type %s",
2170 bfd_get_reloc_code_name (r_type));
2171 /* Set howto to a garbage value so that we can keep going. */
2172 rel->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_32);
2173 assert (rel->howto != NULL);
2179 #endif /* BFD_ASSEMBLER */