1 /* tc-rx.c -- Assembler for the Renesas RX
2 Copyright (C) 2008-2016 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);
115 struct cpu_type cpu_type_list[] =
125 md_parse_option (int c ATTRIBUTE_UNUSED, char * arg ATTRIBUTE_UNUSED)
130 target_big_endian = 1;
134 target_big_endian = 0;
137 case OPTION_32BIT_DOUBLES:
138 elf_flags &= ~ E_FLAG_RX_64BIT_DOUBLES;
141 case OPTION_64BIT_DOUBLES:
142 elf_flags |= E_FLAG_RX_64BIT_DOUBLES;
145 case OPTION_CONVENTIONAL_SECTION_NAMES:
146 rx_use_conventional_section_names = TRUE;
149 case OPTION_RENESAS_SECTION_NAMES:
150 rx_use_conventional_section_names = FALSE;
153 case OPTION_SMALL_DATA_LIMIT:
154 rx_use_small_data_limit = TRUE;
163 elf_flags |= E_FLAG_RX_PID;
166 case OPTION_INT_REGS:
167 rx_num_int_regs = atoi (optarg);
170 case OPTION_USES_GCC_ABI:
171 elf_flags &= ~ E_FLAG_RX_ABI;
174 case OPTION_USES_RX_ABI:
175 elf_flags |= E_FLAG_RX_ABI;
181 for (i = 0; i < ARRAY_SIZE (cpu_type_list); i++)
183 if (strcasecmp (arg, cpu_type_list[i].cpu_name) == 0)
185 rx_cpu = cpu_type_list[i].type;
187 elf_flags |= E_FLAG_RX_V2;
191 as_warn (_("unrecognised RX CPU type %s"), arg);
195 case OPTION_DISALLOW_STRING_INSNS:
196 elf_flags |= E_FLAG_RX_SINSNS_SET | E_FLAG_RX_SINSNS_NO;
204 md_show_usage (FILE * stream)
206 fprintf (stream, _(" RX specific command line options:\n"));
207 fprintf (stream, _(" --mbig-endian-data\n"));
208 fprintf (stream, _(" --mlittle-endian-data [default]\n"));
209 fprintf (stream, _(" --m32bit-doubles [default]\n"));
210 fprintf (stream, _(" --m64bit-doubles\n"));
211 fprintf (stream, _(" --muse-conventional-section-names\n"));
212 fprintf (stream, _(" --muse-renesas-section-names [default]\n"));
213 fprintf (stream, _(" --msmall-data-limit\n"));
214 fprintf (stream, _(" --mrelax\n"));
215 fprintf (stream, _(" --mpid\n"));
216 fprintf (stream, _(" --mint-register=<value>\n"));
217 fprintf (stream, _(" --mcpu=<rx100|rx200|rx600|rx610|rxv2>\n"));
218 fprintf (stream, _(" --mno-allow-string-insns"));
222 s_bss (int ignore ATTRIBUTE_UNUSED)
226 temp = get_absolute_expression ();
227 subseg_set (bss_section, (subsegT) temp);
228 demand_empty_rest_of_line ();
232 rx_float_cons (int ignore ATTRIBUTE_UNUSED)
234 if (elf_flags & E_FLAG_RX_64BIT_DOUBLES)
235 return float_cons ('d');
236 return float_cons ('f');
240 rx_strcasestr (const char *string, const char *sub)
246 return (char *)string;
249 strl = strlen (string);
253 /* strncasecmp is in libiberty. */
254 if (strncasecmp (string, sub, subl) == 0)
255 return (char *)string;
264 rx_include (int ignore)
269 char * current_filename;
277 /* The RX version of the .INCLUDE pseudo-op does not
278 have to have the filename inside double quotes. */
280 if (*input_line_pointer == '"')
282 /* Treat as the normal GAS .include pseudo-op. */
287 /* Get the filename. Spaces are allowed, NUL characters are not. */
288 filename = input_line_pointer;
289 last_char = find_end_of_line (filename, FALSE);
290 input_line_pointer = last_char;
292 while (last_char >= filename && (* last_char == ' ' || * last_char == '\n'))
294 end_char = *(++ last_char);
296 if (last_char == filename)
298 as_bad (_("no filename following .INCLUDE pseudo-op"));
299 * last_char = end_char;
303 as_where (& current_filename, NULL);
304 f = (char *) xmalloc (strlen (current_filename) + strlen (filename) + 1);
306 /* Check the filename. If [@]..FILE[@] is found then replace
307 this with the current assembler source filename, stripped
308 of any directory prefixes or extensions. */
309 if ((p = rx_strcasestr (filename, "..file")) != NULL)
313 len = 6; /* strlen ("..file"); */
315 if (p > filename && p[-1] == '@')
321 for (d = c = current_filename; *c; c++)
322 if (IS_DIR_SEPARATOR (* c))
328 sprintf (f, "%.*s%.*s%.*s", (int) (p - filename), filename,
330 (int) (strlen (filename) - ((p + len) - filename)),
334 strcpy (f, filename);
336 /* RX .INCLUDE semantics say that 'filename' is located by:
338 1. If filename is absolute, just try that. Otherwise...
340 2. If the current source file includes a directory component
341 then prepend that to the filename and try. Otherwise...
343 3. Try any directories specified by the -I command line
346 4 .Try a directory specifed by the INC100 environment variable. */
348 if (IS_ABSOLUTE_PATH (f))
349 try = fopen (path = f, FOPEN_RT);
352 char * env = getenv ("INC100");
356 len = strlen (current_filename);
357 if ((size_t) include_dir_maxlen > len)
358 len = include_dir_maxlen;
359 if (env && strlen (env) > len)
362 path = (char *) xmalloc (strlen (f) + len + 5);
364 if (current_filename != NULL)
366 for (d = NULL, p = current_filename; *p; p++)
367 if (IS_DIR_SEPARATOR (* p))
372 sprintf (path, "%.*s/%s", (int) (d - current_filename), current_filename,
374 try = fopen (path, FOPEN_RT);
382 for (i = 0; i < include_dir_count; i++)
384 sprintf (path, "%s/%s", include_dirs[i], f);
385 if ((try = fopen (path, FOPEN_RT)) != NULL)
390 if (try == NULL && env != NULL)
392 sprintf (path, "%s/%s", env, f);
393 try = fopen (path, FOPEN_RT);
401 as_bad (_("unable to locate include file: %s"), filename);
407 register_dependency (path);
408 input_scrub_insert_file (path);
411 * last_char = end_char;
415 parse_rx_section (char * name)
419 int attr = SHF_ALLOC | SHF_EXECINSTR;
428 for (p = input_line_pointer; *p && strchr ("\n\t, =", *p) == NULL; p++)
433 if (strcasecmp (input_line_pointer, "ALIGN") == 0)
448 case '2': align = 1; break;
449 case '4': align = 2; break;
450 case '8': align = 3; break;
452 as_bad (_("unrecognised alignment value in .SECTION directive: %s"), p);
453 ignore_rest_of_line ();
461 else if (strcasecmp (input_line_pointer, "CODE") == 0)
462 attr = SHF_ALLOC | SHF_EXECINSTR;
463 else if (strcasecmp (input_line_pointer, "DATA") == 0)
464 attr = SHF_ALLOC | SHF_WRITE;
465 else if (strcasecmp (input_line_pointer, "ROMDATA") == 0)
469 as_bad (_("unknown parameter following .SECTION directive: %s"),
473 input_line_pointer = p + 1;
474 ignore_rest_of_line ();
479 input_line_pointer = p + 1;
481 while (end_char != '\n' && end_char != 0);
483 if ((sec = bfd_get_section_by_name (stdoutput, name)) == NULL)
485 if (strcmp (name, "B") && strcmp (name, "B_1") && strcmp (name, "B_2"))
490 obj_elf_change_section (name, type, attr, 0, NULL, FALSE, FALSE);
492 else /* Try not to redefine a section, especially B_1. */
494 int flags = sec->flags;
496 type = elf_section_type (sec);
498 attr = ((flags & SEC_READONLY) ? 0 : SHF_WRITE)
499 | ((flags & SEC_ALLOC) ? SHF_ALLOC : 0)
500 | ((flags & SEC_CODE) ? SHF_EXECINSTR : 0)
501 | ((flags & SEC_MERGE) ? SHF_MERGE : 0)
502 | ((flags & SEC_STRINGS) ? SHF_STRINGS : 0)
503 | ((flags & SEC_THREAD_LOCAL) ? SHF_TLS : 0);
505 obj_elf_change_section (name, type, attr, 0, NULL, FALSE, FALSE);
508 bfd_set_section_alignment (stdoutput, now_seg, align);
512 rx_section (int ignore)
516 /* The as100 assembler supports a different syntax for the .section
517 pseudo-op. So check for it and handle it here if necessary. */
520 /* Peek past the section name to see if arguments follow. */
521 for (p = input_line_pointer; *p; p++)
522 if (*p == ',' || *p == '\n')
527 int len = p - input_line_pointer;
529 while (ISSPACE (*++p))
532 if (*p != '"' && *p != '#')
534 char * name = (char *) xmalloc (len + 1);
536 strncpy (name, input_line_pointer, len);
539 input_line_pointer = p;
540 parse_rx_section (name);
545 obj_elf_section (ignore);
549 rx_list (int ignore ATTRIBUTE_UNUSED)
553 if (strncasecmp (input_line_pointer, "OFF", 3))
555 else if (strncasecmp (input_line_pointer, "ON", 2))
558 as_warn (_("expecting either ON or OFF after .list"));
561 /* Like the .rept pseudo op, but supports the
562 use of ..MACREP inside the repeated region. */
565 rx_rept (int ignore ATTRIBUTE_UNUSED)
567 int count = get_absolute_expression ();
569 do_repeat_with_expander (count, "MREPEAT", "ENDR", "..MACREP");
572 /* Like cons() accept that strings are allowed. */
579 if (* input_line_pointer == '"')
586 rx_nop (int ignore ATTRIBUTE_UNUSED)
588 ignore_rest_of_line ();
594 as_warn (_("The \".%s\" pseudo-op is not implemented\n"),
595 md_pseudo_table[idx].poc_name);
596 ignore_rest_of_line ();
599 /* The target specific pseudo-ops which we support. */
600 const pseudo_typeS md_pseudo_table[] =
602 /* These are unimplemented. They're listed first so that we can use
603 the poc_value as the index into this array, to get the name of
604 the pseudo. So, keep these (1) first, and (2) in order, with (3)
605 the poc_value's in sequence. */
606 { "btglb", rx_unimp, 0 },
607 { "call", rx_unimp, 1 },
608 { "einsf", rx_unimp, 2 },
609 { "fb", rx_unimp, 3 },
610 { "fbsym", rx_unimp, 4 },
611 { "id", rx_unimp, 5 },
612 { "initsct", rx_unimp, 6 },
613 { "insf", rx_unimp, 7 },
614 { "instr", rx_unimp, 8 },
615 { "lbba", rx_unimp, 9 },
616 { "len", rx_unimp, 10 },
617 { "optj", rx_unimp, 11 },
618 { "rvector", rx_unimp, 12 },
619 { "sb", rx_unimp, 13 },
620 { "sbbit", rx_unimp, 14 },
621 { "sbsym", rx_unimp, 15 },
622 { "sbsym16", rx_unimp, 16 },
624 /* These are the do-nothing pseudos. */
625 { "stk", rx_nop, 0 },
626 /* The manual documents ".stk" but the compiler emits ".stack". */
627 { "stack", rx_nop, 0 },
629 /* These are Renesas as100 assembler pseudo-ops that we do support. */
630 { "addr", rx_cons, 3 },
631 { "align", s_align_bytes, 2 },
632 { "byte", rx_cons, 1 },
633 { "fixed", float_cons, 'f' },
634 { "form", listing_psize, 0 },
635 { "glb", s_globl, 0 },
636 { "include", rx_include, 0 },
637 { "list", rx_list, 0 },
638 { "lword", rx_cons, 4 },
639 { "mrepeat", rx_rept, 0 },
640 { "section", rx_section, 0 },
642 /* FIXME: The following pseudo-ops place their values (and associated
643 label if present) in the data section, regardless of whatever
644 section we are currently in. At the moment this code does not
645 implement that part of the semantics. */
646 { "blka", s_space, 3 },
647 { "blkb", s_space, 1 },
648 { "blkd", s_space, 8 },
649 { "blkf", s_space, 4 },
650 { "blkl", s_space, 4 },
651 { "blkw", s_space, 2 },
653 /* Our "standard" pseudos. */
654 { "double", rx_float_cons, 0 },
656 { "3byte", cons, 3 },
660 { "fetchalign", rx_fetchalign, 0 },
662 /* End of list marker. */
666 static asymbol * gp_symbol;
667 static asymbol * rx_pid_symbol;
669 static symbolS * rx_pidreg_symbol;
670 static symbolS * rx_gpreg_symbol;
675 /* Make the __gp and __pid_base symbols now rather
676 than after the symbol table is frozen. We only do this
677 when supporting small data limits because otherwise we
678 pollute the symbol table. */
680 /* The meta-registers %pidreg and %gpreg depend on what other
681 options are specified. The __rx_*_defined symbols exist so we
682 can .ifdef asm code based on what options were passed to gas,
683 without needing a preprocessor */
687 rx_pid_register = 13 - rx_num_int_regs;
688 rx_pid_symbol = symbol_get_bfdsym (symbol_find_or_make ("__pid_base"));
689 rx_pidreg_symbol = symbol_find_or_make ("__rx_pidreg_defined");
690 S_SET_VALUE (rx_pidreg_symbol, rx_pid_register);
691 S_SET_SEGMENT (rx_pidreg_symbol, absolute_section);
694 if (rx_use_small_data_limit)
697 rx_gp_register = rx_pid_register - 1;
699 rx_gp_register = 13 - rx_num_int_regs;
700 gp_symbol = symbol_get_bfdsym (symbol_find_or_make ("__gp"));
701 rx_gpreg_symbol = symbol_find_or_make ("__rx_gpreg_defined");
702 S_SET_VALUE (rx_gpreg_symbol, rx_gp_register);
703 S_SET_SEGMENT (rx_gpreg_symbol, absolute_section);
710 /* These negative numbers are found in rx_bytesT.n_base for non-opcode
712 #define RX_NBASE_FETCHALIGN -1
714 typedef struct rx_bytesT
717 /* If this is negative, it's a special-purpose frag as per the defines above. */
726 char type; /* RXREL_*. */
739 fixS *link_relax_fixP;
744 static rx_bytesT rx_bytes;
745 /* We set n_ops to be "size of next opcode" if the next opcode doesn't relax. */
746 static rx_bytesT *fetchalign_bytes = NULL;
749 rx_fetchalign (int ignore ATTRIBUTE_UNUSED)
754 memset (& rx_bytes, 0, sizeof (rx_bytes));
755 rx_bytes.n_base = RX_NBASE_FETCHALIGN;
757 bytes = frag_more (8);
758 frag_then = frag_now;
759 frag_variant (rs_machine_dependent,
766 frag_then->fr_opcode = bytes;
767 frag_then->fr_subtype = 0;
768 fetchalign_bytes = frag_then->tc_frag_data;
772 rx_relax (int type, int pos)
774 rx_bytes.relax[rx_bytes.n_relax].type = type;
775 rx_bytes.relax[rx_bytes.n_relax].field_pos = pos;
776 rx_bytes.relax[rx_bytes.n_relax].val_ofs = rx_bytes.n_base + rx_bytes.n_ops;
781 rx_linkrelax_dsp (int pos)
786 rx_bytes.link_relax |= RX_RELAXA_DSP4;
789 rx_bytes.link_relax |= RX_RELAXA_DSP6;
792 rx_bytes.link_relax |= RX_RELAXA_DSP14;
798 rx_linkrelax_imm (int pos)
803 rx_bytes.link_relax |= RX_RELAXA_IMM6;
806 rx_bytes.link_relax |= RX_RELAXA_IMM12;
812 rx_linkrelax_branch (void)
814 rx_bytes.link_relax |= RX_RELAXA_BRA;
818 rx_fixup (expressionS exp, int offsetbits, int nbits, int type)
820 rx_bytes.fixups[rx_bytes.n_fixups].exp = exp;
821 rx_bytes.fixups[rx_bytes.n_fixups].offset = offsetbits;
822 rx_bytes.fixups[rx_bytes.n_fixups].nbits = nbits;
823 rx_bytes.fixups[rx_bytes.n_fixups].type = type;
824 rx_bytes.fixups[rx_bytes.n_fixups].reloc = exp.X_md;
825 rx_bytes.n_fixups ++;
828 #define rx_field_fixup(exp, offset, nbits, type) \
829 rx_fixup (exp, offset, nbits, type)
831 #define rx_op_fixup(exp, offset, nbits, type) \
832 rx_fixup (exp, offset + 8 * rx_bytes.n_base, nbits, type)
837 rx_bytes.base[0] = b1;
842 rx_base2 (int b1, int b2)
844 rx_bytes.base[0] = b1;
845 rx_bytes.base[1] = b2;
850 rx_base3 (int b1, int b2, int b3)
852 rx_bytes.base[0] = b1;
853 rx_bytes.base[1] = b2;
854 rx_bytes.base[2] = b3;
859 rx_base4 (int b1, int b2, int b3, int b4)
861 rx_bytes.base[0] = b1;
862 rx_bytes.base[1] = b2;
863 rx_bytes.base[2] = b3;
864 rx_bytes.base[3] = b4;
868 /* This gets complicated when the field spans bytes, because fields
869 are numbered from the MSB of the first byte as zero, and bits are
870 stored LSB towards the LSB of the byte. Thus, a simple four-bit
871 insertion of 12 at position 4 of 0x00 yields: 0x0b. A three-bit
872 insertion of b'MXL at position 7 is like this:
874 - - - - - - - - - - - - - - - -
878 rx_field (int val, int pos, int sz)
885 if (val < 0 || val >= (1 << sz))
886 as_bad (_("Value %d doesn't fit in unsigned %d-bit field"), val, sz);
891 if (val < -(1 << (sz - 1)) || val >= (1 << (sz - 1)))
892 as_bad (_("Value %d doesn't fit in signed %d-bit field"), val, sz);
895 /* This code points at 'M' in the above example. */
899 while (bitp + sz > 8)
904 svalm = val >> (sz - ssz);
905 svalm = svalm & ((1 << ssz) - 1);
906 svalm = svalm << (8 - bitp - ssz);
907 gas_assert (bytep < rx_bytes.n_base);
908 rx_bytes.base[bytep] |= svalm;
914 valm = val & ((1 << sz) - 1);
915 valm = valm << (8 - bitp - sz);
916 gas_assert (bytep < rx_bytes.n_base);
917 rx_bytes.base[bytep] |= valm;
920 /* Special case of the above, for 3-bit displacements of 2..9. */
923 rx_disp3 (expressionS exp, int pos)
925 rx_field_fixup (exp, pos, 3, RXREL_PCREL);
928 /* Special case of the above, for split 5-bit displacements. Assumes
929 the displacement has been checked with rx_disp5op. */
930 /* ---- -432 1--- 0--- */
933 rx_field5s (expressionS exp)
937 val = exp.X_add_number;
938 rx_bytes.base[0] |= val >> 2;
939 rx_bytes.base[1] |= (val << 6) & 0x80;
940 rx_bytes.base[1] |= (val << 3) & 0x08;
943 /* ---- ---- 4--- 3210 */
946 rx_field5s2 (expressionS exp)
950 val = exp.X_add_number;
951 rx_bytes.base[1] |= (val << 3) & 0x80;
952 rx_bytes.base[1] |= (val ) & 0x0f;
955 #define OP(x) rx_bytes.ops[rx_bytes.n_ops++] = (x)
957 #define F_PRECISION 2
960 rx_op (expressionS exp, int nbytes, int type)
964 if ((exp.X_op == O_constant || exp.X_op == O_big)
965 && type != RXREL_PCREL)
967 if (exp.X_op == O_big)
969 if (exp.X_add_number == -1)
972 char * ip = rx_bytes.ops + rx_bytes.n_ops;
974 gen_to_words (w, F_PRECISION, 8);
975 #if RX_OPCODE_BIG_ENDIAN
990 v = ((generic_bignum[1] & LITTLENUM_MASK) << LITTLENUM_NUMBER_OF_BITS)
991 | (generic_bignum[0] & LITTLENUM_MASK);
995 v = exp.X_add_number;
999 #if RX_OPCODE_BIG_ENDIAN
1000 OP ((v >> (8 * (nbytes - 1))) & 0xff);
1010 rx_op_fixup (exp, rx_bytes.n_ops * 8, nbytes * 8, type);
1011 memset (rx_bytes.ops + rx_bytes.n_ops, 0, nbytes);
1012 rx_bytes.n_ops += nbytes;
1022 #define APPEND(B, N_B) \
1025 memcpy (bytes + idx, rx_bytes.B, rx_bytes.N_B); \
1026 idx += rx_bytes.N_B; \
1030 rx_frag_init (fragS * fragP)
1032 if (rx_bytes.n_relax || rx_bytes.link_relax || rx_bytes.n_base < 0)
1034 fragP->tc_frag_data = malloc (sizeof (rx_bytesT));
1035 memcpy (fragP->tc_frag_data, & rx_bytes, sizeof (rx_bytesT));
1038 fragP->tc_frag_data = 0;
1041 /* Handle the as100's version of the .equ pseudo-op. It has the syntax:
1042 <symbol_name> .equ <expression> */
1045 rx_equ (char * name, char * expression)
1047 char saved_name_end_char;
1051 while (ISSPACE (* name))
1054 for (name_end = name + 1; *name_end; name_end ++)
1055 if (! ISALNUM (* name_end))
1058 saved_name_end_char = * name_end;
1061 saved_ilp = input_line_pointer;
1062 input_line_pointer = expression;
1066 input_line_pointer = saved_ilp;
1067 * name_end = saved_name_end_char;
1070 /* Look for Renesas as100 pseudo-ops that occur after a symbol name
1071 rather than at the start of a line. (eg .EQU or .DEFINE). If one
1072 is found, process it and return TRUE otherwise return FALSE. */
1075 scan_for_infix_rx_pseudo_ops (char * str)
1079 char * dot = strchr (str, '.');
1081 if (dot == NULL || dot == str)
1084 /* A real pseudo-op must be preceeded by whitespace. */
1085 if (dot[-1] != ' ' && dot[-1] != '\t')
1088 pseudo_op = dot + 1;
1090 if (!ISALNUM (* pseudo_op))
1093 for (p = pseudo_op + 1; ISALNUM (* p); p++)
1096 if (strncasecmp ("EQU", pseudo_op, p - pseudo_op) == 0)
1098 else if (strncasecmp ("DEFINE", pseudo_op, p - pseudo_op) == 0)
1099 as_warn (_("The .DEFINE pseudo-op is not implemented"));
1100 else if (strncasecmp ("MACRO", pseudo_op, p - pseudo_op) == 0)
1101 as_warn (_("The .MACRO pseudo-op is not implemented"));
1102 else if (strncasecmp ("BTEQU", pseudo_op, p - pseudo_op) == 0)
1103 as_warn (_("The .BTEQU pseudo-op is not implemented."));
1111 md_assemble (char * str)
1116 fragS * frag_then = frag_now;
1119 memset (& rx_bytes, 0, sizeof (rx_bytes));
1121 rx_lex_init (str, str + strlen (str));
1122 if (scan_for_infix_rx_pseudo_ops (str))
1126 /* This simplifies the relaxation code. */
1127 if (rx_bytes.n_relax || rx_bytes.link_relax)
1129 /* We do it this way because we want the frag to have the
1130 rx_bytes in it, which we initialize above. */
1131 bytes = frag_more (12);
1132 frag_then = frag_now;
1133 frag_variant (rs_machine_dependent,
1140 frag_then->fr_opcode = bytes;
1141 frag_then->fr_fix += rx_bytes.n_base + rx_bytes.n_ops;
1142 frag_then->fr_subtype = rx_bytes.n_base + rx_bytes.n_ops;
1146 bytes = frag_more (rx_bytes.n_base + rx_bytes.n_ops);
1147 frag_then = frag_now;
1148 if (fetchalign_bytes)
1149 fetchalign_bytes->n_ops = rx_bytes.n_base + rx_bytes.n_ops;
1152 fetchalign_bytes = NULL;
1154 APPEND (base, n_base);
1155 APPEND (ops, n_ops);
1157 if (rx_bytes.link_relax && rx_bytes.n_fixups)
1161 f = fix_new (frag_then,
1162 (char *) bytes - frag_then->fr_literal,
1165 rx_bytes.link_relax | rx_bytes.n_fixups,
1167 BFD_RELOC_RX_RELAX);
1168 frag_then->tc_frag_data->link_relax_fixP = f;
1171 for (i = 0; i < rx_bytes.n_fixups; i ++)
1173 /* index: [nbytes][type] */
1174 static int reloc_map[5][4] =
1176 { 0, 0, 0, BFD_RELOC_RX_DIR3U_PCREL },
1177 { BFD_RELOC_8, BFD_RELOC_RX_8U, BFD_RELOC_RX_NEG8, BFD_RELOC_8_PCREL },
1178 { BFD_RELOC_RX_16_OP, BFD_RELOC_RX_16U, BFD_RELOC_RX_NEG16, BFD_RELOC_16_PCREL },
1179 { BFD_RELOC_RX_24_OP, BFD_RELOC_RX_24U, BFD_RELOC_RX_NEG24, BFD_RELOC_24_PCREL },
1180 { BFD_RELOC_RX_32_OP, BFD_RELOC_32, BFD_RELOC_RX_NEG32, BFD_RELOC_32_PCREL },
1184 idx = rx_bytes.fixups[i].offset / 8;
1185 rel = reloc_map [rx_bytes.fixups[i].nbits / 8][(int) rx_bytes.fixups[i].type];
1187 if (rx_bytes.fixups[i].reloc)
1188 rel = rx_bytes.fixups[i].reloc;
1190 if (frag_then->tc_frag_data)
1191 exp = & frag_then->tc_frag_data->fixups[i].exp;
1193 exp = & rx_bytes.fixups[i].exp;
1195 f = fix_new_exp (frag_then,
1196 (char *) bytes + idx - frag_then->fr_literal,
1197 rx_bytes.fixups[i].nbits / 8,
1199 rx_bytes.fixups[i].type == RXREL_PCREL ? 1 : 0,
1201 if (frag_then->tc_frag_data)
1202 frag_then->tc_frag_data->fixups[i].fixP = f;
1205 dwarf2_emit_insn (idx);
1213 /* Write a value out to the object file, using the appropriate endianness. */
1216 md_number_to_chars (char * buf, valueT val, int n)
1218 if (target_big_endian)
1219 number_to_chars_bigendian (buf, val, n);
1221 number_to_chars_littleendian (buf, val, n);
1231 { "gp", BFD_RELOC_GPREL16 },
1236 md_operand (expressionS * exp ATTRIBUTE_UNUSED)
1241 for (i = 0; reloc_functions[i].fname; i++)
1243 int flen = strlen (reloc_functions[i].fname);
1245 if (input_line_pointer[0] == '%'
1246 && strncasecmp (input_line_pointer + 1, reloc_functions[i].fname, flen) == 0
1247 && input_line_pointer[flen + 1] == '(')
1249 reloc = reloc_functions[i].reloc;
1250 input_line_pointer += flen + 2;
1258 if (* input_line_pointer == ')')
1259 input_line_pointer ++;
1265 md_section_align (segT segment, valueT size)
1267 int align = bfd_get_section_alignment (stdoutput, segment);
1268 return ((size + (1 << align) - 1) & -(1 << align));
1272 static unsigned char nop_1[] = { 0x03};
1273 /* MOV.L R0,R0 - 1 cycle */
1274 static unsigned char nop_2[] = { 0xef, 0x00};
1275 /* MAX R0,R0 - 1 cycle */
1276 static unsigned char nop_3[] = { 0xfc, 0x13, 0x00 };
1277 /* MUL #1,R0 - 1 cycle */
1278 static unsigned char nop_4[] = { 0x76, 0x10, 0x01, 0x00 };
1279 /* MUL #1,R0 - 1 cycle */
1280 static unsigned char nop_5[] = { 0x77, 0x10, 0x01, 0x00, 0x00 };
1281 /* MUL #1,R0 - 1 cycle */
1282 static unsigned char nop_6[] = { 0x74, 0x10, 0x01, 0x00, 0x00, 0x00 };
1283 /* MAX 0x80000000,R0 - 1 cycle */
1284 static unsigned char nop_7[] = { 0xFD, 0x70, 0x40, 0x00, 0x00, 0x00, 0x80 };
1286 static unsigned char *nops[] = { NULL, nop_1, nop_2, nop_3, nop_4, nop_5, nop_6, nop_7 };
1287 #define BIGGEST_NOP 7
1289 /* When relaxing, we need to output a reloc for any .align directive
1290 so that we can retain this alignment as we adjust opcode sizes. */
1292 rx_handle_align (fragS * frag)
1294 /* If handling an alignment frag, use an optimal NOP pattern.
1295 Only do this if a fill value has not already been provided.
1296 FIXME: This test fails if the provided fill value is zero. */
1297 if ((frag->fr_type == rs_align
1298 || frag->fr_type == rs_align_code)
1299 && subseg_text_p (now_seg))
1301 int count = (frag->fr_next->fr_address
1304 unsigned char *base = (unsigned char *)frag->fr_literal + frag->fr_fix;
1308 if (count > BIGGEST_NOP)
1316 memcpy (base, nops[count], count);
1317 frag->fr_var = count;
1323 && (frag->fr_type == rs_align
1324 || frag->fr_type == rs_align_code)
1325 && frag->fr_address + frag->fr_fix > 0
1326 && frag->fr_offset > 0
1327 && now_seg != bss_section)
1329 fix_new (frag, frag->fr_fix, 0,
1330 &abs_symbol, RX_RELAXA_ALIGN + frag->fr_offset,
1331 0, BFD_RELOC_RX_RELAX);
1332 /* For the purposes of relaxation, this relocation is attached
1333 to the byte *after* the alignment - i.e. the byte that must
1335 fix_new (frag->fr_next, 0, 0,
1336 &abs_symbol, RX_RELAXA_ELIGN + frag->fr_offset,
1337 0, BFD_RELOC_RX_RELAX);
1342 md_atof (int type, char * litP, int * sizeP)
1344 return ieee_md_atof (type, litP, sizeP, target_big_endian);
1348 md_undefined_symbol (char * name ATTRIBUTE_UNUSED)
1353 /*----------------------------------------------------------------------*/
1354 /* To recap: we estimate everything based on md_estimate_size, then
1355 adjust based on rx_relax_frag. When it all settles, we call
1356 md_convert frag to update the bytes. The relaxation types and
1357 relocations are in fragP->tc_frag_data, which is a copy of that
1360 Our scheme is as follows: fr_fix has the size of the smallest
1361 opcode (like BRA.S). We store the number of total bytes we need in
1362 fr_subtype. When we're done relaxing, we use fr_subtype and the
1363 existing opcode bytes to figure out what actual opcode we need to
1364 put in there. If the fixup isn't resolvable now, we use the
1367 #define TRACE_RELAX 0
1368 #define tprintf if (TRACE_RELAX) printf
1380 /* We're looking for these types of relaxations:
1383 BRA.B 00101110 dspppppp
1384 BRA.W 00111000 dspppppp pppppppp
1385 BRA.A 00000100 dspppppp pppppppp pppppppp
1388 BEQ.B 00100000 dspppppp
1389 BEQ.W 00111010 dspppppp pppppppp
1392 BNE.B 00100001 dspppppp
1393 BNE.W 00111011 dspppppp pppppppp
1395 BSR.W 00111001 dspppppp pppppppp
1396 BSR.A 00000101 dspppppp pppppppp pppppppp
1398 Bcc.B 0010cond dspppppp
1400 Additionally, we can synthesize longer conditional branches using
1401 pairs of opcodes, one with an inverted conditional (flip LSB):
1403 Bcc.W 0010ncnd 00000110 00111000 dspppppp pppppppp
1404 Bcc.A 0010ncnd 00000111 00000100 dspppppp pppppppp pppppppp
1405 BEQ.A 00011100 00000100 dspppppp pppppppp pppppppp
1406 BNE.A 00010100 00000100 dspppppp pppppppp pppppppp */
1408 /* Given the opcode bytes at OP, figure out which opcode it is and
1409 return the type of opcode. We use this to re-encode the opcode as
1410 a different size later. */
1413 rx_opcode_type (char * op)
1415 unsigned char b = (unsigned char) op[0];
1419 case 0x08: return OT_bra;
1420 case 0x10: return OT_beq;
1421 case 0x18: return OT_bne;
1426 case 0x2e: return OT_bra;
1427 case 0x38: return OT_bra;
1428 case 0x04: return OT_bra;
1430 case 0x20: return OT_beq;
1431 case 0x3a: return OT_beq;
1433 case 0x21: return OT_bne;
1434 case 0x3b: return OT_bne;
1436 case 0x39: return OT_bsr;
1437 case 0x05: return OT_bsr;
1440 if ((b & 0xf0) == 0x20)
1446 /* Returns zero if *addrP has the target address. Else returns nonzero
1447 if we cannot compute the target address yet. */
1450 rx_frag_fix_value (fragS * fragP,
1455 addressT * sym_addr)
1458 rx_bytesT * b = fragP->tc_frag_data;
1459 expressionS * exp = & b->fixups[which].exp;
1461 if (need_diff && exp->X_op != O_subtract)
1464 if (exp->X_add_symbol)
1466 if (S_FORCE_RELOC (exp->X_add_symbol, 1))
1468 if (S_GET_SEGMENT (exp->X_add_symbol) != segment)
1470 addr += S_GET_VALUE (exp->X_add_symbol);
1473 if (exp->X_op_symbol)
1475 if (exp->X_op != O_subtract)
1477 if (S_FORCE_RELOC (exp->X_op_symbol, 1))
1479 if (S_GET_SEGMENT (exp->X_op_symbol) != segment)
1481 addr -= S_GET_VALUE (exp->X_op_symbol);
1485 addr += exp->X_add_number;
1490 /* Estimate how big the opcode is after this relax pass. The return
1491 value is the difference between fr_fix and the actual size. We
1492 compute the total size in rx_relax_frag and store it in fr_subtype,
1493 sowe only need to subtract fx_fix and return it. */
1496 md_estimate_size_before_relax (fragS * fragP ATTRIBUTE_UNUSED, segT segment ATTRIBUTE_UNUSED)
1501 tprintf ("\033[32m est frag: addr %08lx fix %ld var %ld ofs %ld lit %p opc %p type %d sub %d\033[0m\n",
1502 (unsigned long) (fragP->fr_address
1503 + (fragP->fr_opcode - fragP->fr_literal)),
1504 (long) fragP->fr_fix, (long) fragP->fr_var, (long) fragP->fr_offset,
1505 fragP->fr_literal, fragP->fr_opcode, fragP->fr_type, fragP->fr_subtype);
1507 /* This is the size of the opcode that's accounted for in fr_fix. */
1508 opfixsize = fragP->fr_fix - (fragP->fr_opcode - fragP->fr_literal);
1509 /* This is the size of the opcode that isn't. */
1510 delta = (fragP->fr_subtype - opfixsize);
1512 tprintf (" -> opfixsize %d delta %d\n", opfixsize, delta);
1516 /* Given a frag FRAGP, return the "next" frag that contains an
1517 opcode. Assumes the next opcode is relaxable, and thus rs_machine_dependent. */
1520 rx_next_opcode (fragS *fragP)
1523 fragP = fragP->fr_next;
1524 } while (fragP && fragP->fr_type != rs_machine_dependent);
1528 /* Given the new addresses for this relax pass, figure out how big
1529 each opcode must be. We store the total number of bytes needed in
1530 fr_subtype. The return value is the difference between the size
1531 after the last pass and the size after this pass, so we use the old
1532 fr_subtype to calculate the difference. */
1535 rx_relax_frag (segT segment ATTRIBUTE_UNUSED, fragS * fragP, long stretch)
1537 addressT addr0, sym_addr;
1540 int oldsize = fragP->fr_subtype;
1541 int newsize = oldsize;
1543 /* Index of relaxation we care about. */
1546 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",
1547 (unsigned long) (fragP->fr_address
1548 + (fragP->fr_opcode - fragP->fr_literal)),
1549 (long) fragP->fr_fix, (long) fragP->fr_var, (long) fragP->fr_offset,
1550 fragP->fr_literal, fragP->fr_opcode, fragP->fr_type, fragP->fr_subtype, stretch);
1552 mypc = fragP->fr_address + (fragP->fr_opcode - fragP->fr_literal);
1554 if (fragP->tc_frag_data->n_base == RX_NBASE_FETCHALIGN)
1556 unsigned int next_size;
1557 if (fragP->fr_next == NULL)
1560 next_size = fragP->tc_frag_data->n_ops;
1563 fragS *n = rx_next_opcode (fragP);
1564 next_size = n->fr_subtype;
1567 fragP->fr_subtype = (8-(mypc & 7)) & 7;
1568 tprintf("subtype %u\n", fragP->fr_subtype);
1569 if (fragP->fr_subtype >= next_size)
1570 fragP->fr_subtype = 0;
1571 tprintf ("\033[34m -> mypc %lu next_size %u new %d old %d delta %d (fetchalign)\033[0m\n",
1572 (unsigned long) (mypc & 7),
1573 next_size, fragP->fr_subtype, oldsize, fragP->fr_subtype-oldsize);
1575 newsize = fragP->fr_subtype;
1577 return newsize - oldsize;
1580 optype = rx_opcode_type (fragP->fr_opcode);
1582 /* In the one case where we have both a disp and imm relaxation, we want
1583 the imm relaxation here. */
1585 if (fragP->tc_frag_data->n_relax > 1
1586 && fragP->tc_frag_data->relax[0].type == RX_RELAX_DISP)
1589 /* Try to get the target address. */
1590 if (rx_frag_fix_value (fragP, segment, ri, & addr0,
1591 fragP->tc_frag_data->relax[ri].type != RX_RELAX_BRANCH,
1594 /* If we don't, we must use the maximum size for the linker.
1595 Note that we don't use synthetically expanded conditionals
1597 switch (fragP->tc_frag_data->relax[ri].type)
1599 case RX_RELAX_BRANCH:
1620 newsize = fragP->tc_frag_data->relax[ri].val_ofs + 4;
1623 fragP->fr_subtype = newsize;
1624 tprintf (" -> new %d old %d delta %d (external)\n", newsize, oldsize, newsize-oldsize);
1625 return newsize - oldsize;
1628 if (sym_addr > mypc)
1631 switch (fragP->tc_frag_data->relax[ri].type)
1633 case RX_RELAX_BRANCH:
1634 tprintf ("branch, addr %08lx pc %08lx disp %ld\n",
1635 (unsigned long) addr0, (unsigned long) mypc,
1636 (long) (addr0 - mypc));
1637 disp = (int) addr0 - (int) mypc;
1642 if (disp >= -128 && (disp - (oldsize-2)) <= 127)
1645 else if (disp >= -32768 && (disp - (oldsize-5)) <= 32767)
1655 if ((disp - (oldsize-1)) >= 3 && (disp - (oldsize-1)) <= 10 && !linkrelax)
1658 else if (disp >= -128 && (disp - (oldsize-2)) <= 127)
1661 else if (disp >= -32768 && (disp - (oldsize-3)) <= 32767)
1671 if ((disp - (oldsize-1)) >= 3 && (disp - (oldsize-1)) <= 10 && !linkrelax)
1674 else if (disp >= -128 && (disp - (oldsize-2)) <= 127)
1677 else if (disp >= -32768 && (disp - (oldsize-3)) <= 32767)
1688 tprintf (" - newsize %d\n", newsize);
1692 tprintf ("other, addr %08lx pc %08lx LI %d OF %d\n",
1693 (unsigned long) addr0, (unsigned long) mypc,
1694 fragP->tc_frag_data->relax[ri].field_pos,
1695 fragP->tc_frag_data->relax[ri].val_ofs);
1697 newsize = fragP->tc_frag_data->relax[ri].val_ofs;
1699 if ((long) addr0 >= -128 && (long) addr0 <= 127)
1701 else if ((long) addr0 >= -32768 && (long) addr0 <= 32767)
1703 else if ((long) addr0 >= -8388608 && (long) addr0 <= 8388607)
1713 if (fragP->tc_frag_data->relax[ri].type == RX_RELAX_BRANCH)
1729 /* This prevents infinite loops in align-heavy sources. */
1730 if (newsize < oldsize)
1732 if (fragP->tc_frag_data->times_shrank > 10
1733 && fragP->tc_frag_data->times_grown > 10)
1735 if (fragP->tc_frag_data->times_shrank < 20)
1736 fragP->tc_frag_data->times_shrank ++;
1738 else if (newsize > oldsize)
1740 if (fragP->tc_frag_data->times_grown < 20)
1741 fragP->tc_frag_data->times_grown ++;
1744 fragP->fr_subtype = newsize;
1745 tprintf (" -> new %d old %d delta %d\n", newsize, oldsize, newsize-oldsize);
1746 return newsize - oldsize;
1749 /* This lets us test for the opcode type and the desired size in a
1750 switch statement. */
1751 #define OPCODE(type,size) ((type) * 16 + (size))
1753 /* Given the opcode stored in fr_opcode and the number of bytes we
1754 think we need, encode a new opcode. We stored a pointer to the
1755 fixup for this opcode in the tc_frag_data structure. If we can do
1756 the fixup here, we change the relocation type to "none" (we test
1757 for that in tc_gen_reloc) else we change it to the right type for
1758 the new (biggest) opcode. */
1761 md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED,
1762 segT segment ATTRIBUTE_UNUSED,
1763 fragS * fragP ATTRIBUTE_UNUSED)
1765 rx_bytesT * rxb = fragP->tc_frag_data;
1766 addressT addr0, mypc;
1768 int reloc_type, reloc_adjust;
1769 char * op = fragP->fr_opcode;
1772 int fi = (rxb->n_fixups > 1) ? 1 : 0;
1773 fixS * fix = rxb->fixups[fi].fixP;
1775 tprintf ("\033[31mconvrt frag: addr %08lx fix %ld var %ld ofs %ld lit %p opc %p type %d sub %d\033[0m\n",
1776 (unsigned long) (fragP->fr_address
1777 + (fragP->fr_opcode - fragP->fr_literal)),
1778 (long) fragP->fr_fix, (long) fragP->fr_var, (long) fragP->fr_offset,
1779 fragP->fr_literal, fragP->fr_opcode, fragP->fr_type,
1786 printf ("lit 0x%p opc 0x%p", fragP->fr_literal, fragP->fr_opcode);
1787 for (i = 0; i < 10; i++)
1788 printf (" %02x", (unsigned char) (fragP->fr_opcode[i]));
1793 if (fragP->tc_frag_data->n_base == RX_NBASE_FETCHALIGN)
1795 int count = fragP->fr_subtype;
1798 else if (count > BIGGEST_NOP)
1805 memcpy (op, nops[count], count);
1809 /* In the one case where we have both a disp and imm relaxation, we want
1810 the imm relaxation here. */
1812 if (fragP->tc_frag_data->n_relax > 1
1813 && fragP->tc_frag_data->relax[0].type == RX_RELAX_DISP)
1816 /* We used a new frag for this opcode, so the opcode address should
1817 be the frag address. */
1818 mypc = fragP->fr_address + (fragP->fr_opcode - fragP->fr_literal);
1820 /* Try to get the target address. If we fail here, we just use the
1822 if (rx_frag_fix_value (fragP, segment, 0, & addr0,
1823 fragP->tc_frag_data->relax[ri].type != RX_RELAX_BRANCH, 0))
1825 /* We don't know the target address. */
1832 /* We know the target address, and it's in addr0. */
1833 disp = (int) addr0 - (int) mypc;
1839 reloc_type = BFD_RELOC_NONE;
1842 tprintf ("convert, op is %d, disp %d (%lx-%lx)\n",
1843 rx_opcode_type (fragP->fr_opcode), disp,
1844 (unsigned long) addr0, (unsigned long) mypc);
1845 switch (fragP->tc_frag_data->relax[ri].type)
1847 case RX_RELAX_BRANCH:
1848 switch (OPCODE (rx_opcode_type (fragP->fr_opcode), fragP->fr_subtype))
1850 case OPCODE (OT_bra, 1): /* BRA.S - no change. */
1851 op[0] = 0x08 + (disp & 7);
1853 case OPCODE (OT_bra, 2): /* BRA.B - 8 bit. */
1856 reloc_type = keep_reloc ? BFD_RELOC_8_PCREL : BFD_RELOC_NONE;
1859 case OPCODE (OT_bra, 3): /* BRA.W - 16 bit. */
1861 #if RX_OPCODE_BIG_ENDIAN
1862 op[1] = (disp >> 8) & 0xff;
1865 op[2] = (disp >> 8) & 0xff;
1869 reloc_type = keep_reloc ? BFD_RELOC_16_PCREL : BFD_RELOC_NONE;
1871 case OPCODE (OT_bra, 4): /* BRA.A - 24 bit. */
1873 #if RX_OPCODE_BIG_ENDIAN
1874 op[1] = (disp >> 16) & 0xff;
1875 op[2] = (disp >> 8) & 0xff;
1878 op[3] = (disp >> 16) & 0xff;
1879 op[2] = (disp >> 8) & 0xff;
1882 reloc_type = keep_reloc ? BFD_RELOC_24_PCREL : BFD_RELOC_NONE;
1886 case OPCODE (OT_beq, 1): /* BEQ.S - no change. */
1887 op[0] = 0x10 + (disp & 7);
1889 case OPCODE (OT_beq, 2): /* BEQ.B - 8 bit. */
1893 reloc_type = keep_reloc ? BFD_RELOC_8_PCREL : BFD_RELOC_NONE;
1895 case OPCODE (OT_beq, 3): /* BEQ.W - 16 bit. */
1897 #if RX_OPCODE_BIG_ENDIAN
1898 op[1] = (disp >> 8) & 0xff;
1901 op[2] = (disp >> 8) & 0xff;
1904 reloc_type = keep_reloc ? BFD_RELOC_16_PCREL : BFD_RELOC_NONE;
1907 case OPCODE (OT_beq, 5): /* BEQ.A - synthetic. */
1908 op[0] = 0x1d; /* bne.s .+5. */
1909 op[1] = 0x04; /* bra.a dsp:24. */
1911 #if RX_OPCODE_BIG_ENDIAN
1912 op[2] = (disp >> 16) & 0xff;
1913 op[3] = (disp >> 8) & 0xff;
1916 op[4] = (disp >> 16) & 0xff;
1917 op[3] = (disp >> 8) & 0xff;
1920 reloc_type = keep_reloc ? BFD_RELOC_24_PCREL : BFD_RELOC_NONE;
1924 case OPCODE (OT_bne, 1): /* BNE.S - no change. */
1925 op[0] = 0x18 + (disp & 7);
1927 case OPCODE (OT_bne, 2): /* BNE.B - 8 bit. */
1931 reloc_type = keep_reloc ? BFD_RELOC_8_PCREL : BFD_RELOC_NONE;
1933 case OPCODE (OT_bne, 3): /* BNE.W - 16 bit. */
1935 #if RX_OPCODE_BIG_ENDIAN
1936 op[1] = (disp >> 8) & 0xff;
1939 op[2] = (disp >> 8) & 0xff;
1942 reloc_type = keep_reloc ? BFD_RELOC_16_PCREL : BFD_RELOC_NONE;
1945 case OPCODE (OT_bne, 5): /* BNE.A - synthetic. */
1946 op[0] = 0x15; /* beq.s .+5. */
1947 op[1] = 0x04; /* bra.a dsp:24. */
1949 #if RX_OPCODE_BIG_ENDIAN
1950 op[2] = (disp >> 16) & 0xff;
1951 op[3] = (disp >> 8) & 0xff;
1954 op[4] = (disp >> 16) & 0xff;
1955 op[3] = (disp >> 8) & 0xff;
1958 reloc_type = keep_reloc ? BFD_RELOC_24_PCREL : BFD_RELOC_NONE;
1962 case OPCODE (OT_bsr, 3): /* BSR.W - 16 bit. */
1964 #if RX_OPCODE_BIG_ENDIAN
1965 op[1] = (disp >> 8) & 0xff;
1968 op[2] = (disp >> 8) & 0xff;
1971 reloc_type = keep_reloc ? BFD_RELOC_16_PCREL : BFD_RELOC_NONE;
1974 case OPCODE (OT_bsr, 4): /* BSR.A - 24 bit. */
1976 #if RX_OPCODE_BIG_ENDIAN
1977 op[1] = (disp >> 16) & 0xff;
1978 op[2] = (disp >> 8) & 0xff;
1981 op[3] = (disp >> 16) & 0xff;
1982 op[2] = (disp >> 8) & 0xff;
1985 reloc_type = keep_reloc ? BFD_RELOC_24_PCREL : BFD_RELOC_NONE;
1989 case OPCODE (OT_bcc, 2): /* Bcond.B - 8 bit. */
1991 reloc_type = keep_reloc ? BFD_RELOC_8_PCREL : BFD_RELOC_NONE;
1993 case OPCODE (OT_bcc, 5): /* Bcond.W - synthetic. */
1994 op[0] ^= 1; /* Invert condition. */
1995 op[1] = 5; /* Displacement. */
1998 #if RX_OPCODE_BIG_ENDIAN
1999 op[3] = (disp >> 8) & 0xff;
2002 op[4] = (disp >> 8) & 0xff;
2005 reloc_type = keep_reloc ? BFD_RELOC_16_PCREL : BFD_RELOC_NONE;
2008 case OPCODE (OT_bcc, 6): /* Bcond.S - synthetic. */
2009 op[0] ^= 1; /* Invert condition. */
2010 op[1] = 6; /* Displacement. */
2013 #if RX_OPCODE_BIG_ENDIAN
2014 op[3] = (disp >> 16) & 0xff;
2015 op[4] = (disp >> 8) & 0xff;
2018 op[5] = (disp >> 16) & 0xff;
2019 op[4] = (disp >> 8) & 0xff;
2022 reloc_type = keep_reloc ? BFD_RELOC_24_PCREL : BFD_RELOC_NONE;
2027 /* These are opcodes we'll relax in th linker, later. */
2029 reloc_type = rxb->fixups[ri].fixP->fx_r_type;
2036 int nbytes = fragP->fr_subtype - fragP->tc_frag_data->relax[ri].val_ofs;
2038 char * imm = op + fragP->tc_frag_data->relax[ri].val_ofs;
2045 reloc_type = BFD_RELOC_8;
2049 #if RX_OPCODE_BIG_ENDIAN
2051 imm[0] = addr0 >> 8;
2054 imm[1] = addr0 >> 8;
2056 reloc_type = BFD_RELOC_RX_16_OP;
2060 #if RX_OPCODE_BIG_ENDIAN
2062 imm[1] = addr0 >> 8;
2063 imm[0] = addr0 >> 16;
2066 imm[1] = addr0 >> 8;
2067 imm[2] = addr0 >> 16;
2069 reloc_type = BFD_RELOC_RX_24_OP;
2073 #if RX_OPCODE_BIG_ENDIAN
2075 imm[2] = addr0 >> 8;
2076 imm[1] = addr0 >> 16;
2077 imm[0] = addr0 >> 24;
2080 imm[1] = addr0 >> 8;
2081 imm[2] = addr0 >> 16;
2082 imm[3] = addr0 >> 24;
2084 reloc_type = BFD_RELOC_RX_32_OP;
2087 as_bad (_("invalid immediate size"));
2091 switch (fragP->tc_frag_data->relax[ri].field_pos)
2106 as_bad (_("invalid immediate field position"));
2114 reloc_type = fix->fx_r_type;
2123 fix->fx_r_type = reloc_type;
2124 fix->fx_where += reloc_adjust;
2127 case BFD_RELOC_NONE:
2133 case BFD_RELOC_16_PCREL:
2134 case BFD_RELOC_RX_16_OP:
2137 case BFD_RELOC_24_PCREL:
2138 case BFD_RELOC_RX_24_OP:
2141 case BFD_RELOC_RX_32_OP:
2147 fragP->fr_fix = fragP->fr_subtype + (fragP->fr_opcode - fragP->fr_literal);
2148 tprintf ("fragP->fr_fix now %ld (%d + (%p - %p)\n", (long) fragP->fr_fix,
2149 fragP->fr_subtype, fragP->fr_opcode, fragP->fr_literal);
2152 if (fragP->fr_next != NULL
2153 && ((offsetT) (fragP->fr_next->fr_address - fragP->fr_address)
2155 as_bad (_("bad frag at %p : fix %ld addr %ld %ld \n"), fragP,
2156 (long) fragP->fr_fix,
2157 (long) fragP->fr_address, (long) fragP->fr_next->fr_address);
2163 rx_validate_fix_sub (struct fix * f)
2165 /* We permit the subtraction of two symbols in a few cases. */
2166 /* mov #sym1-sym2, R3 */
2167 if (f->fx_r_type == BFD_RELOC_RX_32_OP)
2169 /* .long sym1-sym2 */
2170 if (f->fx_r_type == BFD_RELOC_RX_DIFF
2172 && (f->fx_size == 4 || f->fx_size == 2 || f->fx_size == 1))
2178 md_pcrel_from_section (fixS * fixP, segT sec)
2182 if (fixP->fx_addsy != NULL
2183 && (! S_IS_DEFINED (fixP->fx_addsy)
2184 || S_GET_SEGMENT (fixP->fx_addsy) != sec))
2185 /* The symbol is undefined (or is defined but not in this section).
2186 Let the linker figure it out. */
2189 rv = fixP->fx_frag->fr_address + fixP->fx_where;
2190 switch (fixP->fx_r_type)
2192 case BFD_RELOC_RX_DIR3U_PCREL:
2200 rx_cons_fix_new (fragS * frag,
2204 bfd_reloc_code_real_type type)
2212 type = BFD_RELOC_16;
2215 type = BFD_RELOC_24;
2218 type = BFD_RELOC_32;
2221 as_bad (_("unsupported constant size %d\n"), size);
2225 if (exp->X_op == O_subtract && exp->X_op_symbol)
2227 if (size != 4 && size != 2 && size != 1)
2228 as_bad (_("difference of two symbols only supported with .long, .short, or .byte"));
2230 type = BFD_RELOC_RX_DIFF;
2233 fix_new_exp (frag, where, (int) size, exp, 0, type);
2237 md_apply_fix (struct fix * f ATTRIBUTE_UNUSED,
2238 valueT * t ATTRIBUTE_UNUSED,
2239 segT s ATTRIBUTE_UNUSED)
2241 /* Instruction bytes are always little endian. */
2245 if (f->fx_addsy && S_FORCE_RELOC (f->fx_addsy, 1))
2247 if (f->fx_subsy && S_FORCE_RELOC (f->fx_subsy, 1))
2250 #define OP2(x) op[target_big_endian ? 1-x : x]
2251 #define OP3(x) op[target_big_endian ? 2-x : x]
2252 #define OP4(x) op[target_big_endian ? 3-x : x]
2254 op = f->fx_frag->fr_literal + f->fx_where;
2255 val = (unsigned long) * t;
2257 /* Opcode words are always the same endian. Data words are either
2258 big or little endian. */
2260 switch (f->fx_r_type)
2262 case BFD_RELOC_NONE:
2265 case BFD_RELOC_RX_RELAX:
2269 case BFD_RELOC_RX_DIR3U_PCREL:
2270 if (val < 3 || val > 10)
2271 as_bad_where (f->fx_file, f->fx_line,
2272 _("jump not 3..10 bytes away (is %d)"), (int) val);
2274 op[0] |= val & 0x07;
2278 case BFD_RELOC_8_PCREL:
2279 case BFD_RELOC_RX_8U:
2284 OP2(1) = val & 0xff;
2285 OP2(0) = (val >> 8) & 0xff;
2288 case BFD_RELOC_16_PCREL:
2289 case BFD_RELOC_RX_16_OP:
2290 case BFD_RELOC_RX_16U:
2291 #if RX_OPCODE_BIG_ENDIAN
2293 op[0] = (val >> 8) & 0xff;
2296 op[1] = (val >> 8) & 0xff;
2301 OP3(0) = val & 0xff;
2302 OP3(1) = (val >> 8) & 0xff;
2303 OP3(2) = (val >> 16) & 0xff;
2306 case BFD_RELOC_24_PCREL:
2307 case BFD_RELOC_RX_24_OP:
2308 case BFD_RELOC_RX_24U:
2309 #if RX_OPCODE_BIG_ENDIAN
2311 op[1] = (val >> 8) & 0xff;
2312 op[0] = (val >> 16) & 0xff;
2315 op[1] = (val >> 8) & 0xff;
2316 op[2] = (val >> 16) & 0xff;
2320 case BFD_RELOC_RX_DIFF:
2327 OP2(0) = val & 0xff;
2328 OP2(1) = (val >> 8) & 0xff;
2331 OP4(0) = val & 0xff;
2332 OP4(1) = (val >> 8) & 0xff;
2333 OP4(2) = (val >> 16) & 0xff;
2334 OP4(3) = (val >> 24) & 0xff;
2340 OP4(0) = val & 0xff;
2341 OP4(1) = (val >> 8) & 0xff;
2342 OP4(2) = (val >> 16) & 0xff;
2343 OP4(3) = (val >> 24) & 0xff;
2346 case BFD_RELOC_RX_32_OP:
2347 #if RX_OPCODE_BIG_ENDIAN
2349 op[2] = (val >> 8) & 0xff;
2350 op[1] = (val >> 16) & 0xff;
2351 op[0] = (val >> 24) & 0xff;
2354 op[1] = (val >> 8) & 0xff;
2355 op[2] = (val >> 16) & 0xff;
2356 op[3] = (val >> 24) & 0xff;
2360 case BFD_RELOC_RX_NEG8:
2364 case BFD_RELOC_RX_NEG16:
2366 #if RX_OPCODE_BIG_ENDIAN
2368 op[0] = (val >> 8) & 0xff;
2371 op[1] = (val >> 8) & 0xff;
2375 case BFD_RELOC_RX_NEG24:
2377 #if RX_OPCODE_BIG_ENDIAN
2379 op[1] = (val >> 8) & 0xff;
2380 op[0] = (val >> 16) & 0xff;
2383 op[1] = (val >> 8) & 0xff;
2384 op[2] = (val >> 16) & 0xff;
2388 case BFD_RELOC_RX_NEG32:
2390 #if RX_OPCODE_BIG_ENDIAN
2392 op[2] = (val >> 8) & 0xff;
2393 op[1] = (val >> 16) & 0xff;
2394 op[0] = (val >> 24) & 0xff;
2397 op[1] = (val >> 8) & 0xff;
2398 op[2] = (val >> 16) & 0xff;
2399 op[3] = (val >> 24) & 0xff;
2403 case BFD_RELOC_RX_GPRELL:
2405 case BFD_RELOC_RX_GPRELW:
2407 case BFD_RELOC_RX_GPRELB:
2408 #if RX_OPCODE_BIG_ENDIAN
2410 op[0] = (val >> 8) & 0xff;
2413 op[1] = (val >> 8) & 0xff;
2418 as_bad (_("Unknown reloc in md_apply_fix: %s"),
2419 bfd_get_reloc_code_name (f->fx_r_type));
2423 if (f->fx_addsy == NULL)
2428 tc_gen_reloc (asection * sec ATTRIBUTE_UNUSED, fixS * fixp)
2430 static arelent * reloc[5];
2431 bfd_boolean is_opcode = FALSE;
2433 if (fixp->fx_r_type == BFD_RELOC_NONE)
2440 && S_GET_SEGMENT (fixp->fx_subsy) == absolute_section)
2442 fixp->fx_offset -= S_GET_VALUE (fixp->fx_subsy);
2443 fixp->fx_subsy = NULL;
2446 reloc[0] = (arelent *) xmalloc (sizeof (arelent));
2447 reloc[0]->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
2448 * reloc[0]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
2449 reloc[0]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2450 reloc[0]->addend = fixp->fx_offset;
2452 if (fixp->fx_r_type == BFD_RELOC_RX_32_OP
2455 fixp->fx_r_type = BFD_RELOC_RX_DIFF;
2459 is_opcode = sec->flags & SEC_CODE;
2461 /* Certain BFD relocations cannot be translated directly into
2462 a single (non-Red Hat) RX relocation, but instead need
2463 multiple RX relocations - handle them here. */
2464 switch (fixp->fx_r_type)
2466 case BFD_RELOC_RX_DIFF:
2467 reloc[0]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
2469 reloc[1] = (arelent *) xmalloc (sizeof (arelent));
2470 reloc[1]->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
2471 * reloc[1]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_subsy);
2472 reloc[1]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2473 reloc[1]->addend = 0;
2474 reloc[1]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
2476 reloc[2] = (arelent *) xmalloc (sizeof (arelent));
2477 reloc[2]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_OP_SUBTRACT);
2478 reloc[2]->addend = 0;
2479 reloc[2]->sym_ptr_ptr = reloc[1]->sym_ptr_ptr;
2480 reloc[2]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2482 reloc[3] = (arelent *) xmalloc (sizeof (arelent));
2483 switch (fixp->fx_size)
2486 reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS8);
2489 if (!is_opcode && target_big_endian)
2490 reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS16_REV);
2492 reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS16UL);
2494 reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS16);
2497 if (!is_opcode && target_big_endian)
2498 reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS32_REV);
2500 reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS32);
2503 reloc[3]->addend = 0;
2504 reloc[3]->sym_ptr_ptr = reloc[1]->sym_ptr_ptr;
2505 reloc[3]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2510 case BFD_RELOC_RX_GPRELL:
2511 reloc[0]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
2513 reloc[1] = (arelent *) xmalloc (sizeof (arelent));
2514 reloc[1]->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
2515 if (gp_symbol == NULL)
2517 if (symbol_table_frozen)
2521 gp = symbol_find ("__gp");
2523 as_bad (("unable to create __gp symbol: please re-assemble with the -msmall-data-limit option specified"));
2525 gp_symbol = symbol_get_bfdsym (gp);
2528 gp_symbol = symbol_get_bfdsym (symbol_find_or_make ("__gp"));
2530 * reloc[1]->sym_ptr_ptr = gp_symbol;
2531 reloc[1]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2532 reloc[1]->addend = 0;
2533 reloc[1]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
2535 reloc[2] = (arelent *) xmalloc (sizeof (arelent));
2536 reloc[2]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_OP_SUBTRACT);
2537 reloc[2]->addend = 0;
2538 reloc[2]->sym_ptr_ptr = reloc[1]->sym_ptr_ptr;
2539 reloc[2]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2541 reloc[3] = (arelent *) xmalloc (sizeof (arelent));
2542 reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS16UL);
2543 reloc[3]->addend = 0;
2544 reloc[3]->sym_ptr_ptr = reloc[1]->sym_ptr_ptr;
2545 reloc[3]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2550 case BFD_RELOC_RX_GPRELW:
2551 reloc[0]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
2553 reloc[1] = (arelent *) xmalloc (sizeof (arelent));
2554 reloc[1]->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
2555 if (gp_symbol == NULL)
2557 if (symbol_table_frozen)
2561 gp = symbol_find ("__gp");
2563 as_bad (("unable to create __gp symbol: please re-assemble with the -msmall-data-limit option specified"));
2565 gp_symbol = symbol_get_bfdsym (gp);
2568 gp_symbol = symbol_get_bfdsym (symbol_find_or_make ("__gp"));
2570 * reloc[1]->sym_ptr_ptr = gp_symbol;
2571 reloc[1]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2572 reloc[1]->addend = 0;
2573 reloc[1]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
2575 reloc[2] = (arelent *) xmalloc (sizeof (arelent));
2576 reloc[2]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_OP_SUBTRACT);
2577 reloc[2]->addend = 0;
2578 reloc[2]->sym_ptr_ptr = reloc[1]->sym_ptr_ptr;
2579 reloc[2]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2581 reloc[3] = (arelent *) xmalloc (sizeof (arelent));
2582 reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS16UW);
2583 reloc[3]->addend = 0;
2584 reloc[3]->sym_ptr_ptr = reloc[1]->sym_ptr_ptr;
2585 reloc[3]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2590 case BFD_RELOC_RX_GPRELB:
2591 reloc[0]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
2593 reloc[1] = (arelent *) xmalloc (sizeof (arelent));
2594 reloc[1]->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
2595 if (gp_symbol == NULL)
2597 if (symbol_table_frozen)
2601 gp = symbol_find ("__gp");
2603 as_bad (("unable to create __gp symbol: please re-assemble with the -msmall-data-limit option specified"));
2605 gp_symbol = symbol_get_bfdsym (gp);
2608 gp_symbol = symbol_get_bfdsym (symbol_find_or_make ("__gp"));
2610 * reloc[1]->sym_ptr_ptr = gp_symbol;
2611 reloc[1]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2612 reloc[1]->addend = 0;
2613 reloc[1]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
2615 reloc[2] = (arelent *) xmalloc (sizeof (arelent));
2616 reloc[2]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_OP_SUBTRACT);
2617 reloc[2]->addend = 0;
2618 reloc[2]->sym_ptr_ptr = reloc[1]->sym_ptr_ptr;
2619 reloc[2]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2621 reloc[3] = (arelent *) xmalloc (sizeof (arelent));
2622 reloc[3]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS16U);
2623 reloc[3]->addend = 0;
2624 reloc[3]->sym_ptr_ptr = reloc[1]->sym_ptr_ptr;
2625 reloc[3]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2630 case BFD_RELOC_RX_NEG32:
2631 reloc[0]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_SYM);
2633 reloc[1] = (arelent *) xmalloc (sizeof (arelent));
2634 reloc[1]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_OP_NEG);
2635 reloc[1]->addend = 0;
2636 reloc[1]->sym_ptr_ptr = reloc[0]->sym_ptr_ptr;
2637 reloc[1]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2639 reloc[2] = (arelent *) xmalloc (sizeof (arelent));
2640 reloc[2]->howto = bfd_reloc_type_lookup (stdoutput, BFD_RELOC_RX_ABS32);
2641 reloc[2]->addend = 0;
2642 reloc[2]->sym_ptr_ptr = reloc[0]->sym_ptr_ptr;
2643 reloc[2]->address = fixp->fx_frag->fr_address + fixp->fx_where;
2649 reloc[0]->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
2658 rx_note_string_insn_use (void)
2660 if ((elf_flags & E_FLAG_RX_SINSNS_MASK) == (E_FLAG_RX_SINSNS_SET | E_FLAG_RX_SINSNS_NO))
2661 as_bad (_("Use of an RX string instruction detected in a file being assembled without string instruction support"));
2662 elf_flags |= E_FLAG_RX_SINSNS_SET | E_FLAG_RX_SINSNS_YES;
2665 /* Set the ELF specific flags. */
2668 rx_elf_final_processing (void)
2670 elf_elfheader (stdoutput)->e_flags |= elf_flags;
2673 /* Scan the current input line for occurances of Renesas
2674 local labels and replace them with the GAS version. */
2677 rx_start_line (void)
2679 int in_double_quote = 0;
2680 int in_single_quote = 0;
2682 char * p = input_line_pointer;
2684 /* Scan the line looking for question marks. Skip past quote enclosed regions. */
2695 in_double_quote = ! in_double_quote;
2699 in_single_quote = ! in_single_quote;
2703 if (in_double_quote || in_single_quote)
2708 else if (p[1] == '+')
2713 else if (p[1] == '-')