1 /* tc-rx.c -- Assembler for the Renesas RX
2 Copyright (C) 2008-2015 Free Software Foundation, Inc.
4 This file is part of GAS, the GNU Assembler.
6 GAS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
11 GAS is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GAS; see the file COPYING. If not, write to the Free
18 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
22 #include "struc-symbol.h"
23 #include "safe-ctype.h"
24 #include "dwarf2dbg.h"
26 #include "elf/common.h"
29 #include "filenames.h"
34 #define RX_OPCODE_BIG_ENDIAN 0
36 const char comment_chars[] = ";";
37 /* Note that input_file.c hand checks for '#' at the beginning of the
38 first line of the input file. This is because the compiler outputs
39 #NO_APP at the beginning of its output. */
40 const char line_comment_chars[] = "#";
41 const char line_separator_chars[] = "!";
43 const char EXP_CHARS[] = "eE";
44 const char FLT_CHARS[] = "dD";
46 /* ELF flags to set in the output file header. */
47 static int elf_flags = E_FLAG_RX_ABI;
49 bfd_boolean rx_use_conventional_section_names = FALSE;
50 static bfd_boolean rx_use_small_data_limit = FALSE;
52 static bfd_boolean rx_pid_mode = FALSE;
53 static int rx_num_int_regs = 0;
57 enum rx_cpu_types rx_cpu = RX600;
59 static void rx_fetchalign (int ignore ATTRIBUTE_UNUSED);
63 OPTION_BIG = OPTION_MD_BASE,
67 OPTION_CONVENTIONAL_SECTION_NAMES,
68 OPTION_RENESAS_SECTION_NAMES,
69 OPTION_SMALL_DATA_LIMIT,
76 OPTION_DISALLOW_STRING_INSNS,
79 #define RX_SHORTOPTS ""
80 const char * md_shortopts = RX_SHORTOPTS;
82 /* Assembler options. */
83 struct option md_longopts[] =
85 {"mbig-endian-data", no_argument, NULL, OPTION_BIG},
86 {"mlittle-endian-data", no_argument, NULL, OPTION_LITTLE},
87 /* The next two switches are here because the
88 generic parts of the linker testsuite uses them. */
89 {"EB", no_argument, NULL, OPTION_BIG},
90 {"EL", no_argument, NULL, OPTION_LITTLE},
91 {"m32bit-doubles", no_argument, NULL, OPTION_32BIT_DOUBLES},
92 {"m64bit-doubles", no_argument, NULL, OPTION_64BIT_DOUBLES},
93 /* This option is here mainly for the binutils testsuites,
94 as many of their tests assume conventional section naming. */
95 {"muse-conventional-section-names", no_argument, NULL, OPTION_CONVENTIONAL_SECTION_NAMES},
96 {"muse-renesas-section-names", no_argument, NULL, OPTION_RENESAS_SECTION_NAMES},
97 {"msmall-data-limit", no_argument, NULL, OPTION_SMALL_DATA_LIMIT},
98 {"relax", no_argument, NULL, OPTION_RELAX},
99 {"mpid", no_argument, NULL, OPTION_PID},
100 {"mint-register", required_argument, NULL, OPTION_INT_REGS},
101 {"mgcc-abi", no_argument, NULL, OPTION_USES_GCC_ABI},
102 {"mrx-abi", no_argument, NULL, OPTION_USES_RX_ABI},
103 {"mcpu", required_argument, NULL, OPTION_CPU},
104 {"mno-allow-string-insns", no_argument, NULL, OPTION_DISALLOW_STRING_INSNS},
105 {NULL, no_argument, NULL, 0}
107 size_t md_longopts_size = sizeof (md_longopts);
110 md_parse_option (int c ATTRIBUTE_UNUSED, char * arg ATTRIBUTE_UNUSED)
115 target_big_endian = 1;
119 target_big_endian = 0;
122 case OPTION_32BIT_DOUBLES:
123 elf_flags &= ~ E_FLAG_RX_64BIT_DOUBLES;
126 case OPTION_64BIT_DOUBLES:
127 elf_flags |= E_FLAG_RX_64BIT_DOUBLES;
130 case OPTION_CONVENTIONAL_SECTION_NAMES:
131 rx_use_conventional_section_names = TRUE;
134 case OPTION_RENESAS_SECTION_NAMES:
135 rx_use_conventional_section_names = FALSE;
138 case OPTION_SMALL_DATA_LIMIT:
139 rx_use_small_data_limit = TRUE;
148 elf_flags |= E_FLAG_RX_PID;
151 case OPTION_INT_REGS:
152 rx_num_int_regs = atoi (optarg);
155 case OPTION_USES_GCC_ABI:
156 elf_flags &= ~ E_FLAG_RX_ABI;
159 case OPTION_USES_RX_ABI:
160 elf_flags |= E_FLAG_RX_ABI;
164 if (strcasecmp (arg, "rx100") == 0)
166 else if (strcasecmp (arg, "rx200") == 0)
168 else if (strcasecmp (arg, "rx600") == 0)
170 else if (strcasecmp (arg, "rx610") == 0)
174 as_warn (_("unrecognised RX CPU type %s"), arg);
179 case OPTION_DISALLOW_STRING_INSNS:
180 elf_flags |= E_FLAG_RX_SINSNS_SET | E_FLAG_RX_SINSNS_NO;
187 md_show_usage (FILE * stream)
189 fprintf (stream, _(" RX specific command line options:\n"));
190 fprintf (stream, _(" --mbig-endian-data\n"));
191 fprintf (stream, _(" --mlittle-endian-data [default]\n"));
192 fprintf (stream, _(" --m32bit-doubles [default]\n"));
193 fprintf (stream, _(" --m64bit-doubles\n"));
194 fprintf (stream, _(" --muse-conventional-section-names\n"));
195 fprintf (stream, _(" --muse-renesas-section-names [default]\n"));
196 fprintf (stream, _(" --msmall-data-limit\n"));
197 fprintf (stream, _(" --mrelax\n"));
198 fprintf (stream, _(" --mpid\n"));
199 fprintf (stream, _(" --mint-register=<value>\n"));
200 fprintf (stream, _(" --mcpu=<rx100|rx200|rx600|rx610>\n"));
201 fprintf (stream, _(" --mno-allow-string-insns"));
205 s_bss (int ignore ATTRIBUTE_UNUSED)
209 temp = get_absolute_expression ();
210 subseg_set (bss_section, (subsegT) temp);
211 demand_empty_rest_of_line ();
215 rx_float_cons (int ignore ATTRIBUTE_UNUSED)
217 if (elf_flags & E_FLAG_RX_64BIT_DOUBLES)
218 return float_cons ('d');
219 return float_cons ('f');
223 rx_strcasestr (const char *string, const char *sub)
229 return (char *)string;
232 strl = strlen (string);
236 /* strncasecmp is in libiberty. */
237 if (strncasecmp (string, sub, subl) == 0)
238 return (char *)string;
247 rx_include (int ignore)
252 char * current_filename;
260 /* The RX version of the .INCLUDE pseudo-op does not
261 have to have the filename inside double quotes. */
263 if (*input_line_pointer == '"')
265 /* Treat as the normal GAS .include pseudo-op. */
270 /* Get the filename. Spaces are allowed, NUL characters are not. */
271 filename = input_line_pointer;
272 last_char = find_end_of_line (filename, FALSE);
273 input_line_pointer = last_char;
275 while (last_char >= filename && (* last_char == ' ' || * last_char == '\n'))
277 end_char = *(++ last_char);
279 if (last_char == filename)
281 as_bad (_("no filename following .INCLUDE pseudo-op"));
282 * last_char = end_char;
286 as_where (& current_filename, NULL);
287 f = (char *) xmalloc (strlen (current_filename) + strlen (filename) + 1);
289 /* Check the filename. If [@]..FILE[@] is found then replace
290 this with the current assembler source filename, stripped
291 of any directory prefixes or extensions. */
292 if ((p = rx_strcasestr (filename, "..file")) != NULL)
296 len = 6; /* strlen ("..file"); */
298 if (p > filename && p[-1] == '@')
304 for (d = c = current_filename; *c; c++)
305 if (IS_DIR_SEPARATOR (* c))
311 sprintf (f, "%.*s%.*s%.*s", (int) (p - filename), filename,
313 (int) (strlen (filename) - ((p + len) - filename)),
317 strcpy (f, filename);
319 /* RX .INCLUDE semantics say that 'filename' is located by:
321 1. If filename is absolute, just try that. Otherwise...
323 2. If the current source file includes a directory component
324 then prepend that to the filename and try. Otherwise...
326 3. Try any directories specified by the -I command line
329 4 .Try a directory specifed by the INC100 environment variable. */
331 if (IS_ABSOLUTE_PATH (f))
332 try = fopen (path = f, FOPEN_RT);
335 char * env = getenv ("INC100");
339 len = strlen (current_filename);
340 if ((size_t) include_dir_maxlen > len)
341 len = include_dir_maxlen;
342 if (env && strlen (env) > len)
345 path = (char *) xmalloc (strlen (f) + len + 5);
347 if (current_filename != NULL)
349 for (d = NULL, p = current_filename; *p; p++)
350 if (IS_DIR_SEPARATOR (* p))
355 sprintf (path, "%.*s/%s", (int) (d - current_filename), current_filename,
357 try = fopen (path, FOPEN_RT);
365 for (i = 0; i < include_dir_count; i++)
367 sprintf (path, "%s/%s", include_dirs[i], f);
368 if ((try = fopen (path, FOPEN_RT)) != NULL)
373 if (try == NULL && env != NULL)
375 sprintf (path, "%s/%s", env, f);
376 try = fopen (path, FOPEN_RT);
384 as_bad (_("unable to locate include file: %s"), filename);
390 register_dependency (path);
391 input_scrub_insert_file (path);
394 * last_char = end_char;
398 parse_rx_section (char * name)
402 int attr = SHF_ALLOC | SHF_EXECINSTR;
411 for (p = input_line_pointer; *p && strchr ("\n\t, =", *p) == NULL; p++)
416 if (strcasecmp (input_line_pointer, "ALIGN") == 0)
431 case '2': align = 1; break;
432 case '4': align = 2; break;
433 case '8': align = 3; break;
435 as_bad (_("unrecognised alignment value in .SECTION directive: %s"), p);
436 ignore_rest_of_line ();
444 else if (strcasecmp (input_line_pointer, "CODE") == 0)
445 attr = SHF_ALLOC | SHF_EXECINSTR;
446 else if (strcasecmp (input_line_pointer, "DATA") == 0)
447 attr = SHF_ALLOC | SHF_WRITE;
448 else if (strcasecmp (input_line_pointer, "ROMDATA") == 0)
452 as_bad (_("unknown parameter following .SECTION directive: %s"),
456 input_line_pointer = p + 1;
457 ignore_rest_of_line ();
462 input_line_pointer = p + 1;
464 while (end_char != '\n' && end_char != 0);
466 if ((sec = bfd_get_section_by_name (stdoutput, name)) == NULL)
468 if (strcmp (name, "B") && strcmp (name, "B_1") && strcmp (name, "B_2"))
473 obj_elf_change_section (name, type, attr, 0, NULL, FALSE, FALSE);
475 else /* Try not to redefine a section, especially B_1. */
477 int flags = sec->flags;
479 type = elf_section_type (sec);
481 attr = ((flags & SEC_READONLY) ? 0 : SHF_WRITE)
482 | ((flags & SEC_ALLOC) ? SHF_ALLOC : 0)
483 | ((flags & SEC_CODE) ? SHF_EXECINSTR : 0)
484 | ((flags & SEC_MERGE) ? SHF_MERGE : 0)
485 | ((flags & SEC_STRINGS) ? SHF_STRINGS : 0)
486 | ((flags & SEC_THREAD_LOCAL) ? SHF_TLS : 0);
488 obj_elf_change_section (name, type, attr, 0, NULL, FALSE, FALSE);
491 bfd_set_section_alignment (stdoutput, now_seg, align);
495 rx_section (int ignore)
499 /* The as100 assembler supports a different syntax for the .section
500 pseudo-op. So check for it and handle it here if necessary. */
503 /* Peek past the section name to see if arguments follow. */
504 for (p = input_line_pointer; *p; p++)
505 if (*p == ',' || *p == '\n')
510 int len = p - input_line_pointer;
512 while (ISSPACE (*++p))
515 if (*p != '"' && *p != '#')
517 char * name = (char *) xmalloc (len + 1);
519 strncpy (name, input_line_pointer, len);
522 input_line_pointer = p;
523 parse_rx_section (name);
528 obj_elf_section (ignore);
532 rx_list (int ignore ATTRIBUTE_UNUSED)
536 if (strncasecmp (input_line_pointer, "OFF", 3))
538 else if (strncasecmp (input_line_pointer, "ON", 2))
541 as_warn (_("expecting either ON or OFF after .list"));
544 /* Like the .rept pseudo op, but supports the
545 use of ..MACREP inside the repeated region. */
548 rx_rept (int ignore ATTRIBUTE_UNUSED)
550 int count = get_absolute_expression ();
552 do_repeat_with_expander (count, "MREPEAT", "ENDR", "..MACREP");
555 /* Like cons() accept that strings are allowed. */
562 if (* input_line_pointer == '"')
569 rx_nop (int ignore ATTRIBUTE_UNUSED)
571 ignore_rest_of_line ();
577 as_warn (_("The \".%s\" pseudo-op is not implemented\n"),
578 md_pseudo_table[idx].poc_name);
579 ignore_rest_of_line ();
582 /* The target specific pseudo-ops which we support. */
583 const pseudo_typeS md_pseudo_table[] =
585 /* These are unimplemented. They're listed first so that we can use
586 the poc_value as the index into this array, to get the name of
587 the pseudo. So, keep these (1) first, and (2) in order, with (3)
588 the poc_value's in sequence. */
589 { "btglb", rx_unimp, 0 },
590 { "call", rx_unimp, 1 },
591 { "einsf", rx_unimp, 2 },
592 { "fb", rx_unimp, 3 },
593 { "fbsym", rx_unimp, 4 },
594 { "id", rx_unimp, 5 },
595 { "initsct", rx_unimp, 6 },
596 { "insf", rx_unimp, 7 },
597 { "instr", rx_unimp, 8 },
598 { "lbba", rx_unimp, 9 },
599 { "len", rx_unimp, 10 },
600 { "optj", rx_unimp, 11 },
601 { "rvector", rx_unimp, 12 },
602 { "sb", rx_unimp, 13 },
603 { "sbbit", rx_unimp, 14 },
604 { "sbsym", rx_unimp, 15 },
605 { "sbsym16", rx_unimp, 16 },
607 /* These are the do-nothing pseudos. */
608 { "stk", rx_nop, 0 },
609 /* The manual documents ".stk" but the compiler emits ".stack". */
610 { "stack", rx_nop, 0 },
612 /* These are Renesas as100 assembler pseudo-ops that we do support. */
613 { "addr", rx_cons, 3 },
614 { "align", s_align_bytes, 2 },
615 { "byte", rx_cons, 1 },
616 { "fixed", float_cons, 'f' },
617 { "form", listing_psize, 0 },
618 { "glb", s_globl, 0 },
619 { "include", rx_include, 0 },
620 { "list", rx_list, 0 },
621 { "lword", rx_cons, 4 },
622 { "mrepeat", rx_rept, 0 },
623 { "section", rx_section, 0 },
625 /* FIXME: The following pseudo-ops place their values (and associated
626 label if present) in the data section, regardless of whatever
627 section we are currently in. At the moment this code does not
628 implement that part of the semantics. */
629 { "blka", s_space, 3 },
630 { "blkb", s_space, 1 },
631 { "blkd", s_space, 8 },
632 { "blkf", s_space, 4 },
633 { "blkl", s_space, 4 },
634 { "blkw", s_space, 2 },
636 /* Our "standard" pseudos. */
637 { "double", rx_float_cons, 0 },
639 { "3byte", cons, 3 },
643 { "fetchalign", rx_fetchalign, 0 },
645 /* End of list marker. */
649 static asymbol * gp_symbol;
650 static asymbol * rx_pid_symbol;
652 static symbolS * rx_pidreg_symbol;
653 static symbolS * rx_gpreg_symbol;
658 /* Make the __gp and __pid_base symbols now rather
659 than after the symbol table is frozen. We only do this
660 when supporting small data limits because otherwise we
661 pollute the symbol table. */
663 /* The meta-registers %pidreg and %gpreg depend on what other
664 options are specified. The __rx_*_defined symbols exist so we
665 can .ifdef asm code based on what options were passed to gas,
666 without needing a preprocessor */
670 rx_pid_register = 13 - rx_num_int_regs;
671 rx_pid_symbol = symbol_get_bfdsym (symbol_find_or_make ("__pid_base"));
672 rx_pidreg_symbol = symbol_find_or_make ("__rx_pidreg_defined");
673 S_SET_VALUE (rx_pidreg_symbol, rx_pid_register);
674 S_SET_SEGMENT (rx_pidreg_symbol, absolute_section);
677 if (rx_use_small_data_limit)
680 rx_gp_register = rx_pid_register - 1;
682 rx_gp_register = 13 - rx_num_int_regs;
683 gp_symbol = symbol_get_bfdsym (symbol_find_or_make ("__gp"));
684 rx_gpreg_symbol = symbol_find_or_make ("__rx_gpreg_defined");
685 S_SET_VALUE (rx_gpreg_symbol, rx_gp_register);
686 S_SET_SEGMENT (rx_gpreg_symbol, absolute_section);
693 /* These negative numbers are found in rx_bytesT.n_base for non-opcode
695 #define RX_NBASE_FETCHALIGN -1
697 typedef struct rx_bytesT
700 /* If this is negative, it's a special-purpose frag as per the defines above. */
709 char type; /* RXREL_*. */
722 fixS *link_relax_fixP;
727 static rx_bytesT rx_bytes;
728 /* We set n_ops to be "size of next opcode" if the next opcode doesn't relax. */
729 static rx_bytesT *fetchalign_bytes = NULL;
732 rx_fetchalign (int ignore ATTRIBUTE_UNUSED)
737 memset (& rx_bytes, 0, sizeof (rx_bytes));
738 rx_bytes.n_base = RX_NBASE_FETCHALIGN;
740 bytes = frag_more (8);
741 frag_then = frag_now;
742 frag_variant (rs_machine_dependent,
749 frag_then->fr_opcode = bytes;
750 frag_then->fr_subtype = 0;
751 fetchalign_bytes = frag_then->tc_frag_data;
755 rx_relax (int type, int pos)
757 rx_bytes.relax[rx_bytes.n_relax].type = type;
758 rx_bytes.relax[rx_bytes.n_relax].field_pos = pos;
759 rx_bytes.relax[rx_bytes.n_relax].val_ofs = rx_bytes.n_base + rx_bytes.n_ops;
764 rx_linkrelax_dsp (int pos)
769 rx_bytes.link_relax |= RX_RELAXA_DSP4;
772 rx_bytes.link_relax |= RX_RELAXA_DSP6;
775 rx_bytes.link_relax |= RX_RELAXA_DSP14;
781 rx_linkrelax_imm (int pos)
786 rx_bytes.link_relax |= RX_RELAXA_IMM6;
789 rx_bytes.link_relax |= RX_RELAXA_IMM12;
795 rx_linkrelax_branch (void)
797 rx_bytes.link_relax |= RX_RELAXA_BRA;
801 rx_fixup (expressionS exp, int offsetbits, int nbits, int type)
803 rx_bytes.fixups[rx_bytes.n_fixups].exp = exp;
804 rx_bytes.fixups[rx_bytes.n_fixups].offset = offsetbits;
805 rx_bytes.fixups[rx_bytes.n_fixups].nbits = nbits;
806 rx_bytes.fixups[rx_bytes.n_fixups].type = type;
807 rx_bytes.fixups[rx_bytes.n_fixups].reloc = exp.X_md;
808 rx_bytes.n_fixups ++;
811 #define rx_field_fixup(exp, offset, nbits, type) \
812 rx_fixup (exp, offset, nbits, type)
814 #define rx_op_fixup(exp, offset, nbits, type) \
815 rx_fixup (exp, offset + 8 * rx_bytes.n_base, nbits, type)
820 rx_bytes.base[0] = b1;
825 rx_base2 (int b1, int b2)
827 rx_bytes.base[0] = b1;
828 rx_bytes.base[1] = b2;
833 rx_base3 (int b1, int b2, int b3)
835 rx_bytes.base[0] = b1;
836 rx_bytes.base[1] = b2;
837 rx_bytes.base[2] = b3;
842 rx_base4 (int b1, int b2, int b3, int b4)
844 rx_bytes.base[0] = b1;
845 rx_bytes.base[1] = b2;
846 rx_bytes.base[2] = b3;
847 rx_bytes.base[3] = b4;
851 /* This gets complicated when the field spans bytes, because fields
852 are numbered from the MSB of the first byte as zero, and bits are
853 stored LSB towards the LSB of the byte. Thus, a simple four-bit
854 insertion of 12 at position 4 of 0x00 yields: 0x0b. A three-bit
855 insertion of b'MXL at position 7 is like this:
857 - - - - - - - - - - - - - - - -
861 rx_field (int val, int pos, int sz)
868 if (val < 0 || val >= (1 << sz))
869 as_bad (_("Value %d doesn't fit in unsigned %d-bit field"), val, sz);
874 if (val < -(1 << (sz - 1)) || val >= (1 << (sz - 1)))
875 as_bad (_("Value %d doesn't fit in signed %d-bit field"), val, sz);
878 /* This code points at 'M' in the above example. */
882 while (bitp + sz > 8)
887 svalm = val >> (sz - ssz);
888 svalm = svalm & ((1 << ssz) - 1);
889 svalm = svalm << (8 - bitp - ssz);
890 gas_assert (bytep < rx_bytes.n_base);
891 rx_bytes.base[bytep] |= svalm;
897 valm = val & ((1 << sz) - 1);
898 valm = valm << (8 - bitp - sz);
899 gas_assert (bytep < rx_bytes.n_base);
900 rx_bytes.base[bytep] |= valm;
903 /* Special case of the above, for 3-bit displacements of 2..9. */
906 rx_disp3 (expressionS exp, int pos)
908 rx_field_fixup (exp, pos, 3, RXREL_PCREL);
911 /* Special case of the above, for split 5-bit displacements. Assumes
912 the displacement has been checked with rx_disp5op. */
913 /* ---- -432 1--- 0--- */
916 rx_field5s (expressionS exp)
920 val = exp.X_add_number;
921 rx_bytes.base[0] |= val >> 2;
922 rx_bytes.base[1] |= (val << 6) & 0x80;
923 rx_bytes.base[1] |= (val << 3) & 0x08;
926 /* ---- ---- 4--- 3210 */
929 rx_field5s2 (expressionS exp)
933 val = exp.X_add_number;
934 rx_bytes.base[1] |= (val << 3) & 0x80;
935 rx_bytes.base[1] |= (val ) & 0x0f;
938 #define OP(x) rx_bytes.ops[rx_bytes.n_ops++] = (x)
940 #define F_PRECISION 2
943 rx_op (expressionS exp, int nbytes, int type)
947 if ((exp.X_op == O_constant || exp.X_op == O_big)
948 && type != RXREL_PCREL)
950 if (exp.X_op == O_big)
952 if (exp.X_add_number == -1)
955 char * ip = rx_bytes.ops + rx_bytes.n_ops;
957 gen_to_words (w, F_PRECISION, 8);
958 #if RX_OPCODE_BIG_ENDIAN
973 v = ((generic_bignum[1] & LITTLENUM_MASK) << LITTLENUM_NUMBER_OF_BITS)
974 | (generic_bignum[0] & LITTLENUM_MASK);
978 v = exp.X_add_number;
982 #if RX_OPCODE_BIG_ENDIAN
983 OP ((v >> (8 * (nbytes - 1))) & 0xff);
993 rx_op_fixup (exp, rx_bytes.n_ops * 8, nbytes * 8, type);
994 memset (rx_bytes.ops + rx_bytes.n_ops, 0, nbytes);
995 rx_bytes.n_ops += nbytes;
1005 #define APPEND(B, N_B) \
1008 memcpy (bytes + idx, rx_bytes.B, rx_bytes.N_B); \
1009 idx += rx_bytes.N_B; \
1013 rx_frag_init (fragS * fragP)
1015 if (rx_bytes.n_relax || rx_bytes.link_relax || rx_bytes.n_base < 0)
1017 fragP->tc_frag_data = malloc (sizeof (rx_bytesT));
1018 memcpy (fragP->tc_frag_data, & rx_bytes, sizeof (rx_bytesT));
1021 fragP->tc_frag_data = 0;
1024 /* Handle the as100's version of the .equ pseudo-op. It has the syntax:
1025 <symbol_name> .equ <expression> */
1028 rx_equ (char * name, char * expression)
1030 char saved_name_end_char;
1034 while (ISSPACE (* name))
1037 for (name_end = name + 1; *name_end; name_end ++)
1038 if (! ISALNUM (* name_end))
1041 saved_name_end_char = * name_end;
1044 saved_ilp = input_line_pointer;
1045 input_line_pointer = expression;
1049 input_line_pointer = saved_ilp;
1050 * name_end = saved_name_end_char;
1053 /* Look for Renesas as100 pseudo-ops that occur after a symbol name
1054 rather than at the start of a line. (eg .EQU or .DEFINE). If one
1055 is found, process it and return TRUE otherwise return FALSE. */
1058 scan_for_infix_rx_pseudo_ops (char * str)
1062 char * dot = strchr (str, '.');
1064 if (dot == NULL || dot == str)
1067 /* A real pseudo-op must be preceeded by whitespace. */
1068 if (dot[-1] != ' ' && dot[-1] != '\t')
1071 pseudo_op = dot + 1;
1073 if (!ISALNUM (* pseudo_op))
1076 for (p = pseudo_op + 1; ISALNUM (* p); p++)
1079 if (strncasecmp ("EQU", pseudo_op, p - pseudo_op) == 0)
1081 else if (strncasecmp ("DEFINE", pseudo_op, p - pseudo_op) == 0)
1082 as_warn (_("The .DEFINE pseudo-op is not implemented"));
1083 else if (strncasecmp ("MACRO", pseudo_op, p - pseudo_op) == 0)
1084 as_warn (_("The .MACRO pseudo-op is not implemented"));
1085 else if (strncasecmp ("BTEQU", pseudo_op, p - pseudo_op) == 0)
1086 as_warn (_("The .BTEQU pseudo-op is not implemented."));
1094 md_assemble (char * str)
1099 fragS * frag_then = frag_now;
1102 memset (& rx_bytes, 0, sizeof (rx_bytes));
1104 rx_lex_init (str, str + strlen (str));
1105 if (scan_for_infix_rx_pseudo_ops (str))
1109 /* This simplifies the relaxation code. */
1110 if (rx_bytes.n_relax || rx_bytes.link_relax)
1112 /* We do it this way because we want the frag to have the
1113 rx_bytes in it, which we initialize above. */
1114 bytes = frag_more (12);
1115 frag_then = frag_now;
1116 frag_variant (rs_machine_dependent,
1123 frag_then->fr_opcode = bytes;
1124 frag_then->fr_fix += rx_bytes.n_base + rx_bytes.n_ops;
1125 frag_then->fr_subtype = rx_bytes.n_base + rx_bytes.n_ops;
1129 bytes = frag_more (rx_bytes.n_base + rx_bytes.n_ops);
1130 frag_then = frag_now;
1131 if (fetchalign_bytes)
1132 fetchalign_bytes->n_ops = rx_bytes.n_base + rx_bytes.n_ops;
1135 fetchalign_bytes = NULL;
1137 APPEND (base, n_base);
1138 APPEND (ops, n_ops);
1140 if (rx_bytes.link_relax && rx_bytes.n_fixups)
1144 f = fix_new (frag_then,
1145 (char *) bytes - frag_then->fr_literal,
1148 rx_bytes.link_relax | rx_bytes.n_fixups,
1150 BFD_RELOC_RX_RELAX);
1151 frag_then->tc_frag_data->link_relax_fixP = f;
1154 for (i = 0; i < rx_bytes.n_fixups; i ++)
1156 /* index: [nbytes][type] */
1157 static int reloc_map[5][4] =
1159 { 0, 0, 0, BFD_RELOC_RX_DIR3U_PCREL },
1160 { BFD_RELOC_8, BFD_RELOC_RX_8U, BFD_RELOC_RX_NEG8, BFD_RELOC_8_PCREL },
1161 { BFD_RELOC_RX_16_OP, BFD_RELOC_RX_16U, BFD_RELOC_RX_NEG16, BFD_RELOC_16_PCREL },
1162 { BFD_RELOC_RX_24_OP, BFD_RELOC_RX_24U, BFD_RELOC_RX_NEG24, BFD_RELOC_24_PCREL },
1163 { BFD_RELOC_RX_32_OP, BFD_RELOC_32, BFD_RELOC_RX_NEG32, BFD_RELOC_32_PCREL },
1167 idx = rx_bytes.fixups[i].offset / 8;
1168 rel = reloc_map [rx_bytes.fixups[i].nbits / 8][(int) rx_bytes.fixups[i].type];
1170 if (rx_bytes.fixups[i].reloc)
1171 rel = rx_bytes.fixups[i].reloc;
1173 if (frag_then->tc_frag_data)
1174 exp = & frag_then->tc_frag_data->fixups[i].exp;
1176 exp = & rx_bytes.fixups[i].exp;
1178 f = fix_new_exp (frag_then,
1179 (char *) bytes + idx - frag_then->fr_literal,
1180 rx_bytes.fixups[i].nbits / 8,
1182 rx_bytes.fixups[i].type == RXREL_PCREL ? 1 : 0,
1184 if (frag_then->tc_frag_data)
1185 frag_then->tc_frag_data->fixups[i].fixP = f;
1188 dwarf2_emit_insn (idx);
1196 /* Write a value out to the object file, using the appropriate endianness. */
1199 md_number_to_chars (char * buf, valueT val, int n)
1201 if (target_big_endian)
1202 number_to_chars_bigendian (buf, val, n);
1204 number_to_chars_littleendian (buf, val, n);
1214 { "gp", BFD_RELOC_GPREL16 },
1219 md_operand (expressionS * exp ATTRIBUTE_UNUSED)
1224 for (i = 0; reloc_functions[i].fname; i++)
1226 int flen = strlen (reloc_functions[i].fname);
1228 if (input_line_pointer[0] == '%'
1229 && strncasecmp (input_line_pointer + 1, reloc_functions[i].fname, flen) == 0
1230 && input_line_pointer[flen + 1] == '(')
1232 reloc = reloc_functions[i].reloc;
1233 input_line_pointer += flen + 2;
1241 if (* input_line_pointer == ')')
1242 input_line_pointer ++;
1248 md_section_align (segT segment, valueT size)
1250 int align = bfd_get_section_alignment (stdoutput, segment);
1251 return ((size + (1 << align) - 1) & -(1 << align));
1255 static unsigned char nop_1[] = { 0x03};
1256 /* MOV.L R0,R0 - 1 cycle */
1257 static unsigned char nop_2[] = { 0xef, 0x00};
1258 /* MAX R0,R0 - 1 cycle */
1259 static unsigned char nop_3[] = { 0xfc, 0x13, 0x00 };
1260 /* MUL #1,R0 - 1 cycle */
1261 static unsigned char nop_4[] = { 0x76, 0x10, 0x01, 0x00 };
1262 /* MUL #1,R0 - 1 cycle */
1263 static unsigned char nop_5[] = { 0x77, 0x10, 0x01, 0x00, 0x00 };
1264 /* MUL #1,R0 - 1 cycle */
1265 static unsigned char nop_6[] = { 0x74, 0x10, 0x01, 0x00, 0x00, 0x00 };
1266 /* MAX 0x80000000,R0 - 1 cycle */
1267 static unsigned char nop_7[] = { 0xFD, 0x70, 0x40, 0x00, 0x00, 0x00, 0x80 };
1269 static unsigned char *nops[] = { NULL, nop_1, nop_2, nop_3, nop_4, nop_5, nop_6, nop_7 };
1270 #define BIGGEST_NOP 7
1272 /* When relaxing, we need to output a reloc for any .align directive
1273 so that we can retain this alignment as we adjust opcode sizes. */
1275 rx_handle_align (fragS * frag)
1277 /* If handling an alignment frag, use an optimal NOP pattern.
1278 Only do this if a fill value has not already been provided.
1279 FIXME: This test fails if the provided fill value is zero. */
1280 if ((frag->fr_type == rs_align
1281 || frag->fr_type == rs_align_code)
1282 && subseg_text_p (now_seg))
1284 int count = (frag->fr_next->fr_address
1287 unsigned char *base = (unsigned char *)frag->fr_literal + frag->fr_fix;
1291 if (count > BIGGEST_NOP)
1299 memcpy (base, nops[count], count);
1300 frag->fr_var = count;
1306 && (frag->fr_type == rs_align
1307 || frag->fr_type == rs_align_code)
1308 && frag->fr_address + frag->fr_fix > 0
1309 && frag->fr_offset > 0
1310 && now_seg != bss_section)
1312 fix_new (frag, frag->fr_fix, 0,
1313 &abs_symbol, RX_RELAXA_ALIGN + frag->fr_offset,
1314 0, BFD_RELOC_RX_RELAX);
1315 /* For the purposes of relaxation, this relocation is attached
1316 to the byte *after* the alignment - i.e. the byte that must
1318 fix_new (frag->fr_next, 0, 0,
1319 &abs_symbol, RX_RELAXA_ELIGN + frag->fr_offset,
1320 0, BFD_RELOC_RX_RELAX);
1325 md_atof (int type, char * litP, int * sizeP)
1327 return ieee_md_atof (type, litP, sizeP, target_big_endian);
1331 md_undefined_symbol (char * name ATTRIBUTE_UNUSED)
1336 /*----------------------------------------------------------------------*/
1337 /* To recap: we estimate everything based on md_estimate_size, then
1338 adjust based on rx_relax_frag. When it all settles, we call
1339 md_convert frag to update the bytes. The relaxation types and
1340 relocations are in fragP->tc_frag_data, which is a copy of that
1343 Our scheme is as follows: fr_fix has the size of the smallest
1344 opcode (like BRA.S). We store the number of total bytes we need in
1345 fr_subtype. When we're done relaxing, we use fr_subtype and the
1346 existing opcode bytes to figure out what actual opcode we need to
1347 put in there. If the fixup isn't resolvable now, we use the
1350 #define TRACE_RELAX 0
1351 #define tprintf if (TRACE_RELAX) printf
1363 /* We're looking for these types of relaxations:
1366 BRA.B 00101110 dspppppp
1367 BRA.W 00111000 dspppppp pppppppp
1368 BRA.A 00000100 dspppppp pppppppp pppppppp
1371 BEQ.B 00100000 dspppppp
1372 BEQ.W 00111010 dspppppp pppppppp
1375 BNE.B 00100001 dspppppp
1376 BNE.W 00111011 dspppppp pppppppp
1378 BSR.W 00111001 dspppppp pppppppp
1379 BSR.A 00000101 dspppppp pppppppp pppppppp
1381 Bcc.B 0010cond dspppppp
1383 Additionally, we can synthesize longer conditional branches using
1384 pairs of opcodes, one with an inverted conditional (flip LSB):
1386 Bcc.W 0010ncnd 00000110 00111000 dspppppp pppppppp
1387 Bcc.A 0010ncnd 00000111 00000100 dspppppp pppppppp pppppppp
1388 BEQ.A 00011100 00000100 dspppppp pppppppp pppppppp
1389 BNE.A 00010100 00000100 dspppppp pppppppp pppppppp */
1391 /* Given the opcode bytes at OP, figure out which opcode it is and
1392 return the type of opcode. We use this to re-encode the opcode as
1393 a different size later. */
1396 rx_opcode_type (char * op)
1398 unsigned char b = (unsigned char) op[0];
1402 case 0x08: return OT_bra;
1403 case 0x10: return OT_beq;
1404 case 0x18: return OT_bne;
1409 case 0x2e: return OT_bra;
1410 case 0x38: return OT_bra;
1411 case 0x04: return OT_bra;
1413 case 0x20: return OT_beq;
1414 case 0x3a: return OT_beq;
1416 case 0x21: return OT_bne;
1417 case 0x3b: return OT_bne;
1419 case 0x39: return OT_bsr;
1420 case 0x05: return OT_bsr;
1423 if ((b & 0xf0) == 0x20)
1429 /* Returns zero if *addrP has the target address. Else returns nonzero
1430 if we cannot compute the target address yet. */
1433 rx_frag_fix_value (fragS * fragP,
1438 addressT * sym_addr)
1441 rx_bytesT * b = fragP->tc_frag_data;
1442 expressionS * exp = & b->fixups[which].exp;
1444 if (need_diff && exp->X_op != O_subtract)
1447 if (exp->X_add_symbol)
1449 if (S_FORCE_RELOC (exp->X_add_symbol, 1))
1451 if (S_GET_SEGMENT (exp->X_add_symbol) != segment)
1453 addr += S_GET_VALUE (exp->X_add_symbol);
1456 if (exp->X_op_symbol)
1458 if (exp->X_op != O_subtract)
1460 if (S_FORCE_RELOC (exp->X_op_symbol, 1))
1462 if (S_GET_SEGMENT (exp->X_op_symbol) != segment)
1464 addr -= S_GET_VALUE (exp->X_op_symbol);
1468 addr += exp->X_add_number;
1473 /* Estimate how big the opcode is after this relax pass. The return
1474 value is the difference between fr_fix and the actual size. We
1475 compute the total size in rx_relax_frag and store it in fr_subtype,
1476 sowe only need to subtract fx_fix and return it. */
1479 md_estimate_size_before_relax (fragS * fragP ATTRIBUTE_UNUSED, segT segment ATTRIBUTE_UNUSED)
1484 tprintf ("\033[32m est frag: addr %08lx fix %ld var %ld ofs %ld lit %p opc %p type %d sub %d\033[0m\n",
1485 (unsigned long) (fragP->fr_address
1486 + (fragP->fr_opcode - fragP->fr_literal)),
1487 (long) fragP->fr_fix, (long) fragP->fr_var, (long) fragP->fr_offset,
1488 fragP->fr_literal, fragP->fr_opcode, fragP->fr_type, fragP->fr_subtype);
1490 /* This is the size of the opcode that's accounted for in fr_fix. */
1491 opfixsize = fragP->fr_fix - (fragP->fr_opcode - fragP->fr_literal);
1492 /* This is the size of the opcode that isn't. */
1493 delta = (fragP->fr_subtype - opfixsize);
1495 tprintf (" -> opfixsize %d delta %d\n", opfixsize, delta);
1499 /* Given a frag FRAGP, return the "next" frag that contains an
1500 opcode. Assumes the next opcode is relaxable, and thus rs_machine_dependent. */
1503 rx_next_opcode (fragS *fragP)
1506 fragP = fragP->fr_next;
1507 } while (fragP && fragP->fr_type != rs_machine_dependent);
1511 /* Given the new addresses for this relax pass, figure out how big
1512 each opcode must be. We store the total number of bytes needed in
1513 fr_subtype. The return value is the difference between the size
1514 after the last pass and the size after this pass, so we use the old
1515 fr_subtype to calculate the difference. */
1518 rx_relax_frag (segT segment ATTRIBUTE_UNUSED, fragS * fragP, long stretch)
1520 addressT addr0, sym_addr;
1523 int oldsize = fragP->fr_subtype;
1524 int newsize = oldsize;
1526 /* Index of relaxation we care about. */
1529 tprintf ("\033[36mrelax frag: addr %08lx fix %ld var %ld ofs %ld lit %p opc %p type %d sub %d str %ld\033[0m\n",
1530 (unsigned long) (fragP->fr_address
1531 + (fragP->fr_opcode - fragP->fr_literal)),
1532 (long) fragP->fr_fix, (long) fragP->fr_var, (long) fragP->fr_offset,
1533 fragP->fr_literal, fragP->fr_opcode, fragP->fr_type, fragP->fr_subtype, stretch);
1535 mypc = fragP->fr_address + (fragP->fr_opcode - fragP->fr_literal);
1537 if (fragP->tc_frag_data->n_base == RX_NBASE_FETCHALIGN)
1539 unsigned int next_size;
1540 if (fragP->fr_next == NULL)
1543 next_size = fragP->tc_frag_data->n_ops;
1546 fragS *n = rx_next_opcode (fragP);
1547 next_size = n->fr_subtype;
1550 fragP->fr_subtype = (8-(mypc & 7)) & 7;
1551 tprintf("subtype %u\n", fragP->fr_subtype);
1552 if (fragP->fr_subtype >= next_size)
1553 fragP->fr_subtype = 0;
1554 tprintf ("\033[34m -> mypc %lu next_size %u new %d old %d delta %d (fetchalign)\033[0m\n",
1555 (unsigned long) (mypc & 7),
1556 next_size, fragP->fr_subtype, oldsize, fragP->fr_subtype-oldsize);
1558 newsize = fragP->fr_subtype;
1560 return newsize - oldsize;
1563 optype = rx_opcode_type (fragP->fr_opcode);
1565 /* In the one case where we have both a disp and imm relaxation, we want
1566 the imm relaxation here. */
1568 if (fragP->tc_frag_data->n_relax > 1
1569 && fragP->tc_frag_data->relax[0].type == RX_RELAX_DISP)
1572 /* Try to get the target address. */
1573 if (rx_frag_fix_value (fragP, segment, ri, & addr0,
1574 fragP->tc_frag_data->relax[ri].type != RX_RELAX_BRANCH,
1577 /* If we don't, we must use the maximum size for the linker.
1578 Note that we don't use synthetically expanded conditionals
1580 switch (fragP->tc_frag_data->relax[ri].type)
1582 case RX_RELAX_BRANCH:
1603 newsize = fragP->tc_frag_data->relax[ri].val_ofs + 4;
1606 fragP->fr_subtype = newsize;
1607 tprintf (" -> new %d old %d delta %d (external)\n", newsize, oldsize, newsize-oldsize);
1608 return newsize - oldsize;
1611 if (sym_addr > mypc)
1614 switch (fragP->tc_frag_data->relax[ri].type)
1616 case RX_RELAX_BRANCH:
1617 tprintf ("branch, addr %08lx pc %08lx disp %ld\n",
1618 (unsigned long) addr0, (unsigned long) mypc,
1619 (long) (addr0 - mypc));
1620 disp = (int) addr0 - (int) mypc;
1625 if (disp >= -128 && (disp - (oldsize-2)) <= 127)
1628 else if (disp >= -32768 && (disp - (oldsize-5)) <= 32767)
1638 if ((disp - (oldsize-1)) >= 3 && (disp - (oldsize-1)) <= 10 && !linkrelax)
1641 else if (disp >= -128 && (disp - (oldsize-2)) <= 127)
1644 else if (disp >= -32768 && (disp - (oldsize-3)) <= 32767)
1654 if ((disp - (oldsize-1)) >= 3 && (disp - (oldsize-1)) <= 10 && !linkrelax)
1657 else if (disp >= -128 && (disp - (oldsize-2)) <= 127)
1660 else if (disp >= -32768 && (disp - (oldsize-3)) <= 32767)
1671 tprintf (" - newsize %d\n", newsize);
1675 tprintf ("other, addr %08lx pc %08lx LI %d OF %d\n",
1676 (unsigned long) addr0, (unsigned long) mypc,
1677 fragP->tc_frag_data->relax[ri].field_pos,
1678 fragP->tc_frag_data->relax[ri].val_ofs);
1680 newsize = fragP->tc_frag_data->relax[ri].val_ofs;
1682 if ((long) addr0 >= -128 && (long) addr0 <= 127)
1684 else if ((long) addr0 >= -32768 && (long) addr0 <= 32767)
1686 else if ((long) addr0 >= -8388608 && (long) addr0 <= 8388607)
1696 if (fragP->tc_frag_data->relax[ri].type == RX_RELAX_BRANCH)
1712 /* This prevents infinite loops in align-heavy sources. */
1713 if (newsize < oldsize)
1715 if (fragP->tc_frag_data->times_shrank > 10
1716 && fragP->tc_frag_data->times_grown > 10)
1718 if (fragP->tc_frag_data->times_shrank < 20)
1719 fragP->tc_frag_data->times_shrank ++;
1721 else if (newsize > oldsize)
1723 if (fragP->tc_frag_data->times_grown < 20)
1724 fragP->tc_frag_data->times_grown ++;
1727 fragP->fr_subtype = newsize;
1728 tprintf (" -> new %d old %d delta %d\n", newsize, oldsize, newsize-oldsize);
1729 return newsize - oldsize;
1732 /* This lets us test for the opcode type and the desired size in a
1733 switch statement. */
1734 #define OPCODE(type,size) ((type) * 16 + (size))
1736 /* Given the opcode stored in fr_opcode and the number of bytes we
1737 think we need, encode a new opcode. We stored a pointer to the
1738 fixup for this opcode in the tc_frag_data structure. If we can do
1739 the fixup here, we change the relocation type to "none" (we test
1740 for that in tc_gen_reloc) else we change it to the right type for
1741 the new (biggest) opcode. */
1744 md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
1745 segT segment ATTRIBUTE_UNUSED,
1746 fragS * fragP ATTRIBUTE_UNUSED)
1748 rx_bytesT * rxb = fragP->tc_frag_data;
1749 addressT addr0, mypc;
1751 int reloc_type, reloc_adjust;
1752 char * op = fragP->fr_opcode;
1755 int fi = (rxb->n_fixups > 1) ? 1 : 0;
1756 fixS * fix = rxb->fixups[fi].fixP;
1758 tprintf ("\033[31mconvrt frag: addr %08lx fix %ld var %ld ofs %ld lit %p opc %p type %d sub %d\033[0m\n",
1759 (unsigned long) (fragP->fr_address
1760 + (fragP->fr_opcode - fragP->fr_literal)),
1761 (long) fragP->fr_fix, (long) fragP->fr_var, (long) fragP->fr_offset,
1762 fragP->fr_literal, fragP->fr_opcode, fragP->fr_type,
1769 printf ("lit 0x%p opc 0x%p", fragP->fr_literal, fragP->fr_opcode);
1770 for (i = 0; i < 10; i++)
1771 printf (" %02x", (unsigned char) (fragP->fr_opcode[i]));
1776 if (fragP->tc_frag_data->n_base == RX_NBASE_FETCHALIGN)
1778 int count = fragP->fr_subtype;
1781 else if (count > BIGGEST_NOP)
1788 memcpy (op, nops[count], count);
1792 /* In the one case where we have both a disp and imm relaxation, we want
1793 the imm relaxation here. */
1795 if (fragP->tc_frag_data->n_relax > 1
1796 && fragP->tc_frag_data->relax[0].type == RX_RELAX_DISP)
1799 /* We used a new frag for this opcode, so the opcode address should
1800 be the frag address. */
1801 mypc = fragP->fr_address + (fragP->fr_opcode - fragP->fr_literal);
1803 /* Try to get the target address. If we fail here, we just use the
1805 if (rx_frag_fix_value (fragP, segment, 0, & addr0,
1806 fragP->tc_frag_data->relax[ri].type != RX_RELAX_BRANCH, 0))
1808 /* We don't know the target address. */
1815 /* We know the target address, and it's in addr0. */
1816 disp = (int) addr0 - (int) mypc;
1822 reloc_type = BFD_RELOC_NONE;
1825 tprintf ("convert, op is %d, disp %d (%lx-%lx)\n",
1826 rx_opcode_type (fragP->fr_opcode), disp,
1827 (unsigned long) addr0, (unsigned long) mypc);
1828 switch (fragP->tc_frag_data->relax[ri].type)
1830 case RX_RELAX_BRANCH:
1831 switch (OPCODE (rx_opcode_type (fragP->fr_opcode), fragP->fr_subtype))
1833 case OPCODE (OT_bra, 1): /* BRA.S - no change. */
1834 op[0] = 0x08 + (disp & 7);
1836 case OPCODE (OT_bra, 2): /* BRA.B - 8 bit. */
1839 reloc_type = keep_reloc ? BFD_RELOC_8_PCREL : BFD_RELOC_NONE;
1842 case OPCODE (OT_bra, 3): /* BRA.W - 16 bit. */
1844 #if RX_OPCODE_BIG_ENDIAN
1845 op[1] = (disp >> 8) & 0xff;
1848 op[2] = (disp >> 8) & 0xff;
1852 reloc_type = keep_reloc ? BFD_RELOC_16_PCREL : BFD_RELOC_NONE;
1854 case OPCODE (OT_bra, 4): /* BRA.A - 24 bit. */
1856 #if RX_OPCODE_BIG_ENDIAN
1857 op[1] = (disp >> 16) & 0xff;
1858 op[2] = (disp >> 8) & 0xff;
1861 op[3] = (disp >> 16) & 0xff;
1862 op[2] = (disp >> 8) & 0xff;
1865 reloc_type = keep_reloc ? BFD_RELOC_24_PCREL : BFD_RELOC_NONE;
1869 case OPCODE (OT_beq, 1): /* BEQ.S - no change. */
1870 op[0] = 0x10 + (disp & 7);
1872 case OPCODE (OT_beq, 2): /* BEQ.B - 8 bit. */
1876 reloc_type = keep_reloc ? BFD_RELOC_8_PCREL : BFD_RELOC_NONE;
1878 case OPCODE (OT_beq, 3): /* BEQ.W - 16 bit. */
1880 #if RX_OPCODE_BIG_ENDIAN
1881 op[1] = (disp >> 8) & 0xff;
1884 op[2] = (disp >> 8) & 0xff;
1887 reloc_type = keep_reloc ? BFD_RELOC_16_PCREL : BFD_RELOC_NONE;
1890 case OPCODE (OT_beq, 5): /* BEQ.A - synthetic. */
1891 op[0] = 0x1d; /* bne.s .+5. */
1892 op[1] = 0x04; /* bra.a dsp:24. */
1894 #if RX_OPCODE_BIG_ENDIAN
1895 op[2] = (disp >> 16) & 0xff;
1896 op[3] = (disp >> 8) & 0xff;
1899 op[4] = (disp >> 16) & 0xff;
1900 op[3] = (disp >> 8) & 0xff;
1903 reloc_type = keep_reloc ? BFD_RELOC_24_PCREL : BFD_RELOC_NONE;
1907 case OPCODE (OT_bne, 1): /* BNE.S - no change. */
1908 op[0] = 0x18 + (disp & 7);
1910 case OPCODE (OT_bne, 2): /* BNE.B - 8 bit. */
1914 reloc_type = keep_reloc ? BFD_RELOC_8_PCREL : BFD_RELOC_NONE;
1916 case OPCODE (OT_bne, 3): /* BNE.W - 16 bit. */
1918 #if RX_OPCODE_BIG_ENDIAN
1919 op[1] = (disp >> 8) & 0xff;
1922 op[2] = (disp >> 8) & 0xff;
1925 reloc_type = keep_reloc ? BFD_RELOC_16_PCREL : BFD_RELOC_NONE;
1928 case OPCODE (OT_bne, 5): /* BNE.A - synthetic. */
1929 op[0] = 0x15; /* beq.s .+5. */
1930 op[1] = 0x04; /* bra.a dsp:24. */
1932 #if RX_OPCODE_BIG_ENDIAN
1933 op[2] = (disp >> 16) & 0xff;
1934 op[3] = (disp >> 8) & 0xff;
1937 op[4] = (disp >> 16) & 0xff;
1938 op[3] = (disp >> 8) & 0xff;
1941 reloc_type = keep_reloc ? BFD_RELOC_24_PCREL : BFD_RELOC_NONE;
1945 case OPCODE (OT_bsr, 3): /* BSR.W - 16 bit. */
1947 #if RX_OPCODE_BIG_ENDIAN
1948 op[1] = (disp >> 8) & 0xff;
1951 op[2] = (disp >> 8) & 0xff;
1954 reloc_type = keep_reloc ? BFD_RELOC_16_PCREL : BFD_RELOC_NONE;
1957 case OPCODE (OT_bsr, 4): /* BSR.A - 24 bit. */
1959 #if RX_OPCODE_BIG_ENDIAN
1960 op[1] = (disp >> 16) & 0xff;
1961 op[2] = (disp >> 8) & 0xff;
1964 op[3] = (disp >> 16) & 0xff;
1965 op[2] = (disp >> 8) & 0xff;
1968 reloc_type = keep_reloc ? BFD_RELOC_24_PCREL : BFD_RELOC_NONE;
1972 case OPCODE (OT_bcc, 2): /* Bcond.B - 8 bit. */
1974 reloc_type = keep_reloc ? BFD_RELOC_8_PCREL : BFD_RELOC_NONE;
1976 case OPCODE (OT_bcc, 5): /* Bcond.W - synthetic. */
1977 op[0] ^= 1; /* Invert condition. */
1978 op[1] = 5; /* Displacement. */
1981 #if RX_OPCODE_BIG_ENDIAN
1982 op[3] = (disp >> 8) & 0xff;
1985 op[4] = (disp >> 8) & 0xff;
1988 reloc_type = keep_reloc ? BFD_RELOC_16_PCREL : BFD_RELOC_NONE;
1991 case OPCODE (OT_bcc, 6): /* Bcond.S - synthetic. */
1992 op[0] ^= 1; /* Invert condition. */
1993 op[1] = 6; /* Displacement. */
1996 #if RX_OPCODE_BIG_ENDIAN
1997 op[3] = (disp >> 16) & 0xff;
1998 op[4] = (disp >> 8) & 0xff;
2001 op[5] = (disp >> 16) & 0xff;
2002 op[4] = (disp >> 8) & 0xff;
2005 reloc_type = keep_reloc ? BFD_RELOC_24_PCREL : BFD_RELOC_NONE;
2010 /* These are opcodes we'll relax in th linker, later. */
2012 reloc_type = rxb->fixups[ri].fixP->fx_r_type;
2019 int nbytes = fragP->fr_subtype - fragP->tc_frag_data->relax[ri].val_ofs;
2021 char * imm = op + fragP->tc_frag_data->relax[ri].val_ofs;
2028 reloc_type = BFD_RELOC_8;
2032 #if RX_OPCODE_BIG_ENDIAN
2034 imm[0] = addr0 >> 8;
2037 imm[1] = addr0 >> 8;
2039 reloc_type = BFD_RELOC_RX_16_OP;
2043 #if RX_OPCODE_BIG_ENDIAN
2045 imm[1] = addr0 >> 8;
2046 imm[0] = addr0 >> 16;
2049 imm[1] = addr0 >> 8;
2050 imm[2] = addr0 >> 16;
2052 reloc_type = BFD_RELOC_RX_24_OP;
2056 #if RX_OPCODE_BIG_ENDIAN
2058 imm[2] = addr0 >> 8;
2059 imm[1] = addr0 >> 16;
2060 imm[0] = addr0 >> 24;
2063 imm[1] = addr0 >> 8;
2064 imm[2] = addr0 >> 16;
2065 imm[3] = addr0 >> 24;
2067 reloc_type = BFD_RELOC_RX_32_OP;
2070 as_bad (_("invalid immediate size"));
2074 switch (fragP->tc_frag_data->relax[ri].field_pos)
2089 as_bad (_("invalid immediate field position"));
2097 reloc_type = fix->fx_r_type;
2106 fix->fx_r_type = reloc_type;
2107 fix->fx_where += reloc_adjust;
2110 case BFD_RELOC_NONE:
2116 case BFD_RELOC_16_PCREL:
2117 case BFD_RELOC_RX_16_OP:
2120 case BFD_RELOC_24_PCREL:
2121 case BFD_RELOC_RX_24_OP:
2124 case BFD_RELOC_RX_32_OP:
2130 fragP->fr_fix = fragP->fr_subtype + (fragP->fr_opcode - fragP->fr_literal);
2131 tprintf ("fragP->fr_fix now %ld (%d + (%p - %p)\n", (long) fragP->fr_fix,
2132 fragP->fr_subtype, fragP->fr_opcode, fragP->fr_literal);
2135 if (fragP->fr_next != NULL
2136 && ((offsetT) (fragP->fr_next->fr_address - fragP->fr_address)
2138 as_bad (_("bad frag at %p : fix %ld addr %ld %ld \n"), fragP,
2139 (long) fragP->fr_fix,
2140 (long) fragP->fr_address, (long) fragP->fr_next->fr_address);
2146 rx_validate_fix_sub (struct fix * f)
2148 /* We permit the subtraction of two symbols in a few cases. */
2149 /* mov #sym1-sym2, R3 */
2150 if (f->fx_r_type == BFD_RELOC_RX_32_OP)
2152 /* .long sym1-sym2 */
2153 if (f->fx_r_type == BFD_RELOC_RX_DIFF
2155 && (f->fx_size == 4 || f->fx_size == 2 || f->fx_size == 1))
2161 md_pcrel_from_section (fixS * fixP, segT sec)
2165 if (fixP->fx_addsy != NULL
2166 && (! S_IS_DEFINED (fixP->fx_addsy)
2167 || S_GET_SEGMENT (fixP->fx_addsy) != sec))
2168 /* The symbol is undefined (or is defined but not in this section).
2169 Let the linker figure it out. */
2172 rv = fixP->fx_frag->fr_address + fixP->fx_where;
2173 switch (fixP->fx_r_type)
2175 case BFD_RELOC_RX_DIR3U_PCREL:
2183 rx_cons_fix_new (fragS * frag,
2187 bfd_reloc_code_real_type type)
2195 type = BFD_RELOC_16;
2198 type = BFD_RELOC_24;
2201 type = BFD_RELOC_32;
2204 as_bad (_("unsupported constant size %d\n"), size);
2208 if (exp->X_op == O_subtract && exp->X_op_symbol)
2210 if (size != 4 && size != 2 && size != 1)
2211 as_bad (_("difference of two symbols only supported with .long, .short, or .byte"));
2213 type = BFD_RELOC_RX_DIFF;
2216 fix_new_exp (frag, where, (int) size, exp, 0, type);
2220 md_apply_fix (struct fix * f ATTRIBUTE_UNUSED,
2221 valueT * t ATTRIBUTE_UNUSED,
2222 segT s ATTRIBUTE_UNUSED)
2224 /* Instruction bytes are always little endian. */
2228 if (f->fx_addsy && S_FORCE_RELOC (f->fx_addsy, 1))
2230 if (f->fx_subsy && S_FORCE_RELOC (f->fx_subsy, 1))
2233 #define OP2(x) op[target_big_endian ? 1-x : x]
2234 #define OP3(x) op[target_big_endian ? 2-x : x]
2235 #define OP4(x) op[target_big_endian ? 3-x : x]
2237 op = f->fx_frag->fr_literal + f->fx_where;
2238 val = (unsigned long) * t;
2240 /* Opcode words are always the same endian. Data words are either
2241 big or little endian. */
2243 switch (f->fx_r_type)
2245 case BFD_RELOC_NONE:
2248 case BFD_RELOC_RX_RELAX:
2252 case BFD_RELOC_RX_DIR3U_PCREL:
2253 if (val < 3 || val > 10)
2254 as_bad_where (f->fx_file, f->fx_line,
2255 _("jump not 3..10 bytes away (is %d)"), (int) val);
2257 op[0] |= val & 0x07;
2261 case BFD_RELOC_8_PCREL:
2262 case BFD_RELOC_RX_8U:
2267 OP2(1) = val & 0xff;
2268 OP2(0) = (val >> 8) & 0xff;
2271 case BFD_RELOC_16_PCREL:
2272 case BFD_RELOC_RX_16_OP:
2273 case BFD_RELOC_RX_16U:
2274 #if RX_OPCODE_BIG_ENDIAN
2276 op[0] = (val >> 8) & 0xff;
2279 op[1] = (val >> 8) & 0xff;
2284 OP3(0) = val & 0xff;
2285 OP3(1) = (val >> 8) & 0xff;
2286 OP3(2) = (val >> 16) & 0xff;
2289 case BFD_RELOC_24_PCREL:
2290 case BFD_RELOC_RX_24_OP:
2291 case BFD_RELOC_RX_24U:
2292 #if RX_OPCODE_BIG_ENDIAN
2294 op[1] = (val >> 8) & 0xff;
2295 op[0] = (val >> 16) & 0xff;
2298 op[1] = (val >> 8) & 0xff;
2299 op[2] = (val >> 16) & 0xff;
2303 case BFD_RELOC_RX_DIFF:
2310 OP2(0) = val & 0xff;
2311 OP2(1) = (val >> 8) & 0xff;
2314 OP4(0) = val & 0xff;
2315 OP4(1) = (val >> 8) & 0xff;
2316 OP4(2) = (val >> 16) & 0xff;
2317 OP4(3) = (val >> 24) & 0xff;
2323 OP4(0) = val & 0xff;
2324 OP4(1) = (val >> 8) & 0xff;
2325 OP4(2) = (val >> 16) & 0xff;
2326 OP4(3) = (val >> 24) & 0xff;
2329 case BFD_RELOC_RX_32_OP:
2330 #if RX_OPCODE_BIG_ENDIAN
2332 op[2] = (val >> 8) & 0xff;
2333 op[1] = (val >> 16) & 0xff;
2334 op[0] = (val >> 24) & 0xff;
2337 op[1] = (val >> 8) & 0xff;
2338 op[2] = (val >> 16) & 0xff;
2339 op[3] = (val >> 24) & 0xff;
2343 case BFD_RELOC_RX_NEG8:
2347 case BFD_RELOC_RX_NEG16:
2349 #if RX_OPCODE_BIG_ENDIAN
2351 op[0] = (val >> 8) & 0xff;
2354 op[1] = (val >> 8) & 0xff;
2358 case BFD_RELOC_RX_NEG24:
2360 #if RX_OPCODE_BIG_ENDIAN
2362 op[1] = (val >> 8) & 0xff;
2363 op[0] = (val >> 16) & 0xff;
2366 op[1] = (val >> 8) & 0xff;
2367 op[2] = (val >> 16) & 0xff;
2371 case BFD_RELOC_RX_NEG32:
2373 #if RX_OPCODE_BIG_ENDIAN
2375 op[2] = (val >> 8) & 0xff;
2376 op[1] = (val >> 16) & 0xff;
2377 op[0] = (val >> 24) & 0xff;
2380 op[1] = (val >> 8) & 0xff;
2381 op[2] = (val >> 16) & 0xff;
2382 op[3] = (val >> 24) & 0xff;
2386 case BFD_RELOC_RX_GPRELL:
2388 case BFD_RELOC_RX_GPRELW:
2390 case BFD_RELOC_RX_GPRELB:
2391 #if RX_OPCODE_BIG_ENDIAN
2393 op[0] = (val >> 8) & 0xff;
2396 op[1] = (val >> 8) & 0xff;
2401 as_bad (_("Unknown reloc in md_apply_fix: %s"),
2402 bfd_get_reloc_code_name (f->fx_r_type));
2406 if (f->fx_addsy == NULL)
2411 tc_gen_reloc (asection * sec ATTRIBUTE_UNUSED, fixS * fixp)
2413 static arelent * reloc[5];
2414 bfd_boolean is_opcode = FALSE;
2416 if (fixp->fx_r_type == BFD_RELOC_NONE)
2423 && S_GET_SEGMENT (fixp->fx_subsy) == absolute_section)
2425 fixp->fx_offset -= S_GET_VALUE (fixp->fx_subsy);
2426 fixp->fx_subsy = NULL;
2429 reloc[0] = (arelent *) xmalloc (sizeof (arelent));
2430 reloc[0]->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
2431 * reloc[0]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
2432 reloc[0]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2433 reloc[0]->addend = fixp->fx_offset;
2435 if (fixp->fx_r_type == BFD_RELOC_RX_32_OP
2438 fixp->fx_r_type = BFD_RELOC_RX_DIFF;
2442 is_opcode = sec->flags & SEC_CODE;
2444 /* Certain BFD relocations cannot be translated directly into
2445 a single (non-Red Hat) RX relocation, but instead need
2446 multiple RX relocations - handle them here. */
2447 switch (fixp->fx_r_type)
2449 case BFD_RELOC_RX_DIFF:
2450 reloc[0]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
2452 reloc[1] = (arelent *) xmalloc (sizeof (arelent));
2453 reloc[1]->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
2454 * reloc[1]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_subsy);
2455 reloc[1]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2456 reloc[1]->addend = 0;
2457 reloc[1]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
2459 reloc[2] = (arelent *) xmalloc (sizeof (arelent));
2460 reloc[2]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_OP_SUBTRACT);
2461 reloc[2]->addend = 0;
2462 reloc[2]->sym_ptr_ptr = reloc[1]->sym_ptr_ptr;
2463 reloc[2]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2465 reloc[3] = (arelent *) xmalloc (sizeof (arelent));
2466 switch (fixp->fx_size)
2469 reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS8);
2472 if (!is_opcode && target_big_endian)
2473 reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS16_REV);
2475 reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS16UL);
2477 reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS16);
2480 if (!is_opcode && target_big_endian)
2481 reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS32_REV);
2483 reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS32);
2486 reloc[3]->addend = 0;
2487 reloc[3]->sym_ptr_ptr = reloc[1]->sym_ptr_ptr;
2488 reloc[3]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2493 case BFD_RELOC_RX_GPRELL:
2494 reloc[0]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
2496 reloc[1] = (arelent *) xmalloc (sizeof (arelent));
2497 reloc[1]->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
2498 if (gp_symbol == NULL)
2500 if (symbol_table_frozen)
2504 gp = symbol_find ("__gp");
2506 as_bad (("unable to create __gp symbol: please re-assemble with the -msmall-data-limit option specified"));
2508 gp_symbol = symbol_get_bfdsym (gp);
2511 gp_symbol = symbol_get_bfdsym (symbol_find_or_make ("__gp"));
2513 * reloc[1]->sym_ptr_ptr = gp_symbol;
2514 reloc[1]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2515 reloc[1]->addend = 0;
2516 reloc[1]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
2518 reloc[2] = (arelent *) xmalloc (sizeof (arelent));
2519 reloc[2]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_OP_SUBTRACT);
2520 reloc[2]->addend = 0;
2521 reloc[2]->sym_ptr_ptr = reloc[1]->sym_ptr_ptr;
2522 reloc[2]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2524 reloc[3] = (arelent *) xmalloc (sizeof (arelent));
2525 reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS16UL);
2526 reloc[3]->addend = 0;
2527 reloc[3]->sym_ptr_ptr = reloc[1]->sym_ptr_ptr;
2528 reloc[3]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2533 case BFD_RELOC_RX_GPRELW:
2534 reloc[0]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
2536 reloc[1] = (arelent *) xmalloc (sizeof (arelent));
2537 reloc[1]->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
2538 if (gp_symbol == NULL)
2540 if (symbol_table_frozen)
2544 gp = symbol_find ("__gp");
2546 as_bad (("unable to create __gp symbol: please re-assemble with the -msmall-data-limit option specified"));
2548 gp_symbol = symbol_get_bfdsym (gp);
2551 gp_symbol = symbol_get_bfdsym (symbol_find_or_make ("__gp"));
2553 * reloc[1]->sym_ptr_ptr = gp_symbol;
2554 reloc[1]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2555 reloc[1]->addend = 0;
2556 reloc[1]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
2558 reloc[2] = (arelent *) xmalloc (sizeof (arelent));
2559 reloc[2]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_OP_SUBTRACT);
2560 reloc[2]->addend = 0;
2561 reloc[2]->sym_ptr_ptr = reloc[1]->sym_ptr_ptr;
2562 reloc[2]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2564 reloc[3] = (arelent *) xmalloc (sizeof (arelent));
2565 reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS16UW);
2566 reloc[3]->addend = 0;
2567 reloc[3]->sym_ptr_ptr = reloc[1]->sym_ptr_ptr;
2568 reloc[3]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2573 case BFD_RELOC_RX_GPRELB:
2574 reloc[0]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
2576 reloc[1] = (arelent *) xmalloc (sizeof (arelent));
2577 reloc[1]->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
2578 if (gp_symbol == NULL)
2580 if (symbol_table_frozen)
2584 gp = symbol_find ("__gp");
2586 as_bad (("unable to create __gp symbol: please re-assemble with the -msmall-data-limit option specified"));
2588 gp_symbol = symbol_get_bfdsym (gp);
2591 gp_symbol = symbol_get_bfdsym (symbol_find_or_make ("__gp"));
2593 * reloc[1]->sym_ptr_ptr = gp_symbol;
2594 reloc[1]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2595 reloc[1]->addend = 0;
2596 reloc[1]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
2598 reloc[2] = (arelent *) xmalloc (sizeof (arelent));
2599 reloc[2]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_OP_SUBTRACT);
2600 reloc[2]->addend = 0;
2601 reloc[2]->sym_ptr_ptr = reloc[1]->sym_ptr_ptr;
2602 reloc[2]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2604 reloc[3] = (arelent *) xmalloc (sizeof (arelent));
2605 reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS16U);
2606 reloc[3]->addend = 0;
2607 reloc[3]->sym_ptr_ptr = reloc[1]->sym_ptr_ptr;
2608 reloc[3]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2613 case BFD_RELOC_RX_NEG32:
2614 reloc[0]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
2616 reloc[1] = (arelent *) xmalloc (sizeof (arelent));
2617 reloc[1]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_OP_NEG);
2618 reloc[1]->addend = 0;
2619 reloc[1]->sym_ptr_ptr = reloc[0]->sym_ptr_ptr;
2620 reloc[1]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2622 reloc[2] = (arelent *) xmalloc (sizeof (arelent));
2623 reloc[2]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS32);
2624 reloc[2]->addend = 0;
2625 reloc[2]->sym_ptr_ptr = reloc[0]->sym_ptr_ptr;
2626 reloc[2]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2632 reloc[0]->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
2641 rx_note_string_insn_use (void)
2643 if ((elf_flags & E_FLAG_RX_SINSNS_MASK) == (E_FLAG_RX_SINSNS_SET | E_FLAG_RX_SINSNS_NO))
2644 as_bad (_("Use of an RX string instruction detected in a file being assembled without string instruction support"));
2645 elf_flags |= E_FLAG_RX_SINSNS_SET | E_FLAG_RX_SINSNS_YES;
2648 /* Set the ELF specific flags. */
2651 rx_elf_final_processing (void)
2653 elf_elfheader (stdoutput)->e_flags |= elf_flags;
2656 /* Scan the current input line for occurances of Renesas
2657 local labels and replace them with the GAS version. */
2660 rx_start_line (void)
2662 int in_double_quote = 0;
2663 int in_single_quote = 0;
2665 char * p = input_line_pointer;
2667 /* Scan the line looking for question marks. Skip past quote enclosed regions. */
2678 in_double_quote = ! in_double_quote;
2682 in_single_quote = ! in_single_quote;
2686 if (in_double_quote || in_single_quote)
2691 else if (p[1] == '+')
2696 else if (p[1] == '-')