1 /* tc-microblaze.c -- Assemble code for Xilinx MicroBlaze
3 Copyright 2009, 2010, 2012 Free Software Foundation.
5 This file is part of GAS, the GNU Assembler.
7 GAS is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
12 GAS is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GAS; see the file COPYING. If not, write to the Free
19 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
27 #include "../opcodes/microblaze-opc.h"
28 #include "../opcodes/microblaze-opcm.h"
29 #include "safe-ctype.h"
31 #include <dwarf2dbg.h>
32 #include "aout/stab_gnu.h"
35 #define streq(a,b) (strcmp (a, b) == 0)
38 void microblaze_generate_symbol (char *sym
);
39 static bfd_boolean
check_spl_reg (unsigned *);
41 /* Several places in this file insert raw instructions into the
42 object. They should generate the instruction
43 and then use these four macros to crack the instruction value into
44 the appropriate byte values. */
45 #define INST_BYTE0(x) (target_big_endian ? (((x) >> 24) & 0xFF) : ((x) & 0xFF))
46 #define INST_BYTE1(x) (target_big_endian ? (((x) >> 16) & 0xFF) : (((x) >> 8) & 0xFF))
47 #define INST_BYTE2(x) (target_big_endian ? (((x) >> 8) & 0xFF) : (((x) >> 16) & 0xFF))
48 #define INST_BYTE3(x) (target_big_endian ? ((x) & 0xFF) : (((x) >> 24) & 0xFF))
50 /* This array holds the chars that always start a comment. If the
51 pre-processor is disabled, these aren't very useful. */
52 const char comment_chars
[] = "#";
54 const char line_separator_chars
[] = ";";
56 /* This array holds the chars that only start a comment at the beginning of
58 const char line_comment_chars
[] = "#";
60 const int md_reloc_size
= 8; /* Size of relocation record. */
62 /* Chars that can be used to separate mant
63 from exp in floating point numbers. */
64 const char EXP_CHARS
[] = "eE";
66 /* Chars that mean this number is a floating point constant
69 const char FLT_CHARS
[] = "rRsSfFdDxXpP";
71 /* INST_PC_OFFSET and INST_NO_OFFSET are 0 and 1. */
72 #define UNDEFINED_PC_OFFSET 2
73 #define DEFINED_ABS_SEGMENT 3
74 #define DEFINED_PC_OFFSET 4
75 #define DEFINED_RO_SEGMENT 5
76 #define DEFINED_RW_SEGMENT 6
77 #define LARGE_DEFINED_PC_OFFSET 7
80 #define GOTOFF_OFFSET 10
83 /* Initialize the relax table. */
84 const relax_typeS md_relax_table
[] =
86 { 1, 1, 0, 0 }, /* 0: Unused. */
87 { 1, 1, 0, 0 }, /* 1: Unused. */
88 { 1, 1, 0, 0 }, /* 2: Unused. */
89 { 1, 1, 0, 0 }, /* 3: Unused. */
90 { 32767, -32768, INST_WORD_SIZE
, LARGE_DEFINED_PC_OFFSET
}, /* 4: DEFINED_PC_OFFSET. */
91 { 1, 1, 0, 0 }, /* 5: Unused. */
92 { 1, 1, 0, 0 }, /* 6: Unused. */
93 { 0x7fffffff, 0x80000000, INST_WORD_SIZE
*2, 0 }, /* 7: LARGE_DEFINED_PC_OFFSET. */
94 { 0x7fffffff, 0x80000000, INST_WORD_SIZE
*2, 0 }, /* 8: GOT_OFFSET. */
95 { 0x7fffffff, 0x80000000, INST_WORD_SIZE
*2, 0 }, /* 9: PLT_OFFSET. */
96 { 0x7fffffff, 0x80000000, INST_WORD_SIZE
*2, 0 }, /* 10: GOTOFF_OFFSET. */
99 static struct hash_control
* opcode_hash_control
; /* Opcode mnemonics. */
101 static segT sbss_segment
= 0; /* Small bss section. */
102 static segT sbss2_segment
= 0; /* Section not used. */
103 static segT sdata_segment
= 0; /* Small data section. */
104 static segT sdata2_segment
= 0; /* Small read-only section. */
105 static segT rodata_segment
= 0; /* read-only section. */
107 /* Generate a symbol for stabs information. */
110 microblaze_generate_symbol (char *sym
)
112 #define MICROBLAZE_FAKE_LABEL_NAME "XL0\001"
113 static int microblaze_label_count
;
114 sprintf (sym
, "%sL%d", MICROBLAZE_FAKE_LABEL_NAME
, microblaze_label_count
);
115 ++microblaze_label_count
;
118 /* Handle the section changing pseudo-ops. */
121 microblaze_s_text (int ignore ATTRIBUTE_UNUSED
)
124 obj_elf_text (ignore
);
131 microblaze_s_data (int ignore ATTRIBUTE_UNUSED
)
134 obj_elf_change_section (".data", SHT_PROGBITS
, SHF_ALLOC
+SHF_WRITE
, 0, 0, 0, 0);
140 /* Things in the .sdata segment are always considered to be in the small data section. */
143 microblaze_s_sdata (int ignore ATTRIBUTE_UNUSED
)
146 obj_elf_change_section (".sdata", SHT_PROGBITS
, SHF_ALLOC
+SHF_WRITE
, 0, 0, 0, 0);
152 /* Pseudo op to make file scope bss items. */
155 microblaze_s_lcomm (int xxx ATTRIBUTE_UNUSED
)
165 segT current_seg
= now_seg
;
166 subsegT current_subseg
= now_subseg
;
168 name
= input_line_pointer
;
169 c
= get_symbol_end ();
171 /* Just after name is now '\0'. */
172 p
= input_line_pointer
;
175 if (*input_line_pointer
!= ',')
177 as_bad (_("Expected comma after symbol-name: rest of line ignored."));
178 ignore_rest_of_line ();
182 input_line_pointer
++; /* skip ',' */
183 if ((size
= get_absolute_expression ()) < 0)
185 as_warn (_(".COMMon length (%ld.) <0! Ignored."), (long) size
);
186 ignore_rest_of_line ();
190 /* The third argument to .lcomm is the alignment. */
191 if (*input_line_pointer
!= ',')
195 ++input_line_pointer
;
196 align
= get_absolute_expression ();
199 as_warn (_("ignoring bad alignment"));
205 symbolP
= symbol_find_or_make (name
);
208 if (S_IS_DEFINED (symbolP
) && ! S_IS_COMMON (symbolP
))
210 as_bad (_("Ignoring attempt to re-define symbol `%s'."),
211 S_GET_NAME (symbolP
));
212 ignore_rest_of_line ();
216 if (S_GET_VALUE (symbolP
) && S_GET_VALUE (symbolP
) != (valueT
) size
)
218 as_bad (_("Length of .lcomm \"%s\" is already %ld. Not changed to %ld."),
219 S_GET_NAME (symbolP
),
220 (long) S_GET_VALUE (symbolP
),
223 ignore_rest_of_line ();
230 /* Convert to a power of 2 alignment. */
231 for (align2
= 0; (align
& 1) == 0; align
>>= 1, ++align2
);
234 as_bad (_("Common alignment not a power of 2"));
235 ignore_rest_of_line ();
242 record_alignment (current_seg
, align2
);
243 subseg_set (current_seg
, current_subseg
);
245 frag_align (align2
, 0, 0);
246 if (S_GET_SEGMENT (symbolP
) == current_seg
)
247 symbol_get_frag (symbolP
)->fr_symbol
= 0;
248 symbol_set_frag (symbolP
, frag_now
);
249 pfrag
= frag_var (rs_org
, 1, 1, (relax_substateT
) 0, symbolP
, size
,
252 S_SET_SIZE (symbolP
, size
);
253 S_SET_SEGMENT (symbolP
, current_seg
);
254 subseg_set (current_seg
, current_subseg
);
255 demand_empty_rest_of_line ();
259 microblaze_s_rdata (int localvar
)
265 obj_elf_change_section (".rodata", SHT_PROGBITS
, SHF_ALLOC
, 0, 0, 0, 0);
266 if (rodata_segment
== 0)
267 rodata_segment
= subseg_new (".rodata", 0);
272 obj_elf_change_section (".sdata2", SHT_PROGBITS
, SHF_ALLOC
, 0, 0, 0, 0);
280 microblaze_s_bss (int localvar
)
283 if (localvar
== 0) /* bss. */
284 obj_elf_change_section (".bss", SHT_NOBITS
, SHF_ALLOC
+SHF_WRITE
, 0, 0, 0, 0);
285 else if (localvar
== 1)
288 obj_elf_change_section (".sbss", SHT_NOBITS
, SHF_ALLOC
+SHF_WRITE
, 0, 0, 0, 0);
289 if (sbss_segment
== 0)
290 sbss_segment
= subseg_new (".sbss", 0);
297 /* endp_p is always 1 as this func is called only for .end <funcname>
298 This func consumes the <funcname> and calls regular processing
299 s_func(1) with arg 1 (1 for end). */
302 microblaze_s_func (int end_p ATTRIBUTE_UNUSED
)
304 *input_line_pointer
= get_symbol_end ();
308 /* Handle the .weakext pseudo-op as defined in Kane and Heinrich. */
311 microblaze_s_weakext (int ignore ATTRIBUTE_UNUSED
)
318 name
= input_line_pointer
;
319 c
= get_symbol_end ();
320 symbolP
= symbol_find_or_make (name
);
321 S_SET_WEAK (symbolP
);
322 *input_line_pointer
= c
;
326 if (!is_end_of_line
[(unsigned char) *input_line_pointer
])
328 if (S_IS_DEFINED (symbolP
))
330 as_bad ("Ignoring attempt to redefine symbol `%s'.",
331 S_GET_NAME (symbolP
));
332 ignore_rest_of_line ();
336 if (*input_line_pointer
== ',')
338 ++input_line_pointer
;
343 if (exp
.X_op
!= O_symbol
)
345 as_bad ("bad .weakext directive");
346 ignore_rest_of_line ();
349 symbol_set_value_expression (symbolP
, &exp
);
352 demand_empty_rest_of_line ();
355 /* This table describes all the machine specific pseudo-ops the assembler
356 has to support. The fields are:
357 Pseudo-op name without dot
358 Function to call to execute this pseudo-op
359 Integer arg to pass to the function. */
360 /* If the pseudo-op is not found in this table, it searches in the obj-elf.c,
361 and then in the read.c table. */
362 const pseudo_typeS md_pseudo_table
[] =
364 {"lcomm", microblaze_s_lcomm
, 1},
365 {"data", microblaze_s_data
, 0},
366 {"data8", cons
, 1}, /* Same as byte. */
367 {"data16", cons
, 2}, /* Same as hword. */
368 {"data32", cons
, 4}, /* Same as word. */
369 {"ent", s_func
, 0}, /* Treat ent as function entry point. */
370 {"end", microblaze_s_func
, 1}, /* Treat end as function end point. */
371 {"gpword", s_rva
, 4}, /* gpword label => store resolved label address in data section. */
372 {"weakext", microblaze_s_weakext
, 0},
373 {"rodata", microblaze_s_rdata
, 0},
374 {"sdata2", microblaze_s_rdata
, 1},
375 {"sdata", microblaze_s_sdata
, 0},
376 {"bss", microblaze_s_bss
, 0},
377 {"sbss", microblaze_s_bss
, 1},
378 {"text", microblaze_s_text
, 0},
380 {"frame", s_ignore
, 0},
381 {"mask", s_ignore
, 0}, /* Emitted by gcc. */
385 /* This function is called once, at assembler startup time. This should
386 set up all the tables, etc that the MD part of the assembler needs. */
391 struct op_code_struct
* opcode
;
393 opcode_hash_control
= hash_new ();
395 /* Insert unique names into hash table. */
396 for (opcode
= opcodes
; opcode
->name
; opcode
++)
397 hash_insert (opcode_hash_control
, opcode
->name
, (char *) opcode
);
400 /* Try to parse a reg name. */
403 parse_reg (char * s
, unsigned * reg
)
407 /* Strip leading whitespace. */
408 while (ISSPACE (* s
))
411 if (strncasecmp (s
, "rpc", 3) == 0)
416 else if (strncasecmp (s
, "rmsr", 4) == 0)
421 else if (strncasecmp (s
, "rear", 4) == 0)
426 else if (strncasecmp (s
, "resr", 4) == 0)
431 else if (strncasecmp (s
, "rfsr", 4) == 0)
436 else if (strncasecmp (s
, "rbtr", 4) == 0)
441 else if (strncasecmp (s
, "redr", 4) == 0)
446 /* MMU registers start. */
447 else if (strncasecmp (s
, "rpid", 4) == 0)
452 else if (strncasecmp (s
, "rzpr", 4) == 0)
457 else if (strncasecmp (s
, "rtlbx", 5) == 0)
462 else if (strncasecmp (s
, "rtlblo", 6) == 0)
467 else if (strncasecmp (s
, "rtlbhi", 6) == 0)
472 else if (strncasecmp (s
, "rtlbsx", 6) == 0)
477 /* MMU registers end. */
478 else if (strncasecmp (s
, "rpvr", 4) == 0)
480 if (ISDIGIT (s
[4]) && ISDIGIT (s
[5]))
482 tmpreg
= (s
[4]-'0')*10 + s
[5] - '0';
486 else if (ISDIGIT (s
[4]))
492 as_bad (_("register expected, but saw '%.6s'"), s
);
493 if ((int) tmpreg
>= MIN_PVR_REGNUM
&& tmpreg
<= MAX_PVR_REGNUM
)
494 *reg
= REG_PVR
+ tmpreg
;
497 as_bad (_("Invalid register number at '%.6s'"), s
);
502 else if (strncasecmp (s
, "rsp", 3) == 0)
507 else if (strncasecmp (s
, "rfsl", 4) == 0)
509 if (ISDIGIT (s
[4]) && ISDIGIT (s
[5]))
511 tmpreg
= (s
[4] - '0') * 10 + s
[5] - '0';
514 else if (ISDIGIT (s
[4]))
520 as_bad (_("register expected, but saw '%.6s'"), s
);
522 if ((int) tmpreg
>= MIN_REGNUM
&& tmpreg
<= MAX_REGNUM
)
526 as_bad (_("Invalid register number at '%.6s'"), s
);
533 if (TOLOWER (s
[0]) == 'r')
535 if (ISDIGIT (s
[1]) && ISDIGIT (s
[2]))
537 tmpreg
= (s
[1] - '0') * 10 + s
[2] - '0';
540 else if (ISDIGIT (s
[1]))
546 as_bad (_("register expected, but saw '%.6s'"), s
);
548 if ((int)tmpreg
>= MIN_REGNUM
&& tmpreg
<= MAX_REGNUM
)
552 as_bad (_("Invalid register number at '%.6s'"), s
);
558 as_bad (_("register expected, but saw '%.6s'"), s
);
564 parse_exp (char *s
, expressionS
*e
)
569 /* Skip whitespace. */
570 while (ISSPACE (* s
))
573 save
= input_line_pointer
;
574 input_line_pointer
= s
;
578 if (e
->X_op
== O_absent
)
579 as_fatal (_("missing operand"));
581 new_pointer
= input_line_pointer
;
582 input_line_pointer
= save
;
587 /* Symbol modifiers (@GOT, @PLT, @GOTOFF). */
592 static symbolS
* GOT_symbol
;
594 #define GOT_SYMBOL_NAME "_GLOBAL_OFFSET_TABLE_"
597 parse_imm (char * s
, expressionS
* e
, int min
, int max
)
602 /* Find the start of "@GOT" or "@PLT" suffix (if any) */
603 for (atp
= s
; *atp
!= '@'; atp
++)
604 if (is_end_of_line
[(unsigned char) *atp
])
609 if (strncmp (atp
+ 1, "GOTOFF", 5) == 0)
612 e
->X_md
= IMM_GOTOFF
;
614 else if (strncmp (atp
+ 1, "GOT", 3) == 0)
619 else if (strncmp (atp
+ 1, "PLT", 3) == 0)
637 if (atp
&& !GOT_symbol
)
639 GOT_symbol
= symbol_find_or_make (GOT_SYMBOL_NAME
);
642 new_pointer
= parse_exp (s
, e
);
644 if (e
->X_op
== O_absent
)
645 ; /* An error message has already been emitted. */
646 else if ((e
->X_op
!= O_constant
&& e
->X_op
!= O_symbol
) )
647 as_fatal (_("operand must be a constant or a label"));
648 else if ((e
->X_op
== O_constant
) && ((int) e
->X_add_number
< min
649 || (int) e
->X_add_number
> max
))
651 as_fatal (_("operand must be absolute in range %d..%d, not %d"),
652 min
, max
, (int) e
->X_add_number
);
657 *atp
= '@'; /* restore back (needed?) */
658 if (new_pointer
>= atp
)
659 new_pointer
+= (e
->X_md
== IMM_GOTOFF
)?7:4;
660 /* sizeof("@GOTOFF", "@GOT" or "@PLT") */
667 check_got (int * got_type
, int * got_len
)
675 /* Find the start of "@GOT" or "@PLT" suffix (if any). */
676 for (atp
= input_line_pointer
; *atp
!= '@'; atp
++)
677 if (is_end_of_line
[(unsigned char) *atp
])
680 if (strncmp (atp
+ 1, "GOTOFF", 5) == 0)
683 *got_type
= IMM_GOTOFF
;
685 else if (strncmp (atp
+ 1, "GOT", 3) == 0)
690 else if (strncmp (atp
+ 1, "PLT", 3) == 0)
699 GOT_symbol
= symbol_find_or_make (GOT_SYMBOL_NAME
);
701 first
= atp
- input_line_pointer
;
703 past_got
= atp
+ *got_len
+ 1;
704 for (new_pointer
= past_got
; !is_end_of_line
[(unsigned char) *new_pointer
++];)
706 second
= new_pointer
- past_got
;
707 tmpbuf
= xmalloc (first
+ second
+ 2); /* One extra byte for ' ' and one for NUL. */
708 memcpy (tmpbuf
, input_line_pointer
, first
);
709 tmpbuf
[first
] = ' '; /* @GOTOFF is replaced with a single space. */
710 memcpy (tmpbuf
+ first
+ 1, past_got
, second
);
711 tmpbuf
[first
+ second
+ 1] = '\0';
717 parse_cons_expression_microblaze (expressionS
*exp
, int size
)
721 /* Handle @GOTOFF et.al. */
722 char *save
, *gotfree_copy
;
723 int got_len
, got_type
;
725 save
= input_line_pointer
;
726 gotfree_copy
= check_got (& got_type
, & got_len
);
728 input_line_pointer
= gotfree_copy
;
734 exp
->X_md
= got_type
;
735 input_line_pointer
= save
+ (input_line_pointer
- gotfree_copy
)
744 /* This is the guts of the machine-dependent assembler. STR points to a
745 machine dependent instruction. This function is supposed to emit
746 the frags/bytes it assembles to. */
748 static char * str_microblaze_ro_anchor
= "RO";
749 static char * str_microblaze_rw_anchor
= "RW";
752 check_spl_reg (unsigned * reg
)
754 if ((*reg
== REG_MSR
) || (*reg
== REG_PC
)
755 || (*reg
== REG_EAR
) || (*reg
== REG_ESR
)
756 || (*reg
== REG_FSR
) || (*reg
== REG_BTR
) || (*reg
== REG_EDR
)
757 || (*reg
== REG_PID
) || (*reg
== REG_ZPR
)
758 || (*reg
== REG_TLBX
) || (*reg
== REG_TLBLO
)
759 || (*reg
== REG_TLBHI
) || (*reg
== REG_TLBSX
)
760 || (*reg
>= REG_PVR
+MIN_PVR_REGNUM
&& *reg
<= REG_PVR
+MAX_PVR_REGNUM
))
766 /* Here we decide which fixups can be adjusted to make them relative to
767 the beginning of the section instead of the symbol. Basically we need
768 to make sure that the dynamic relocations are done correctly, so in
769 some cases we force the original symbol to be used. */
772 tc_microblaze_fix_adjustable (struct fix
*fixP
)
774 if (GOT_symbol
&& fixP
->fx_subsy
== GOT_symbol
)
777 if (fixP
->fx_r_type
== BFD_RELOC_MICROBLAZE_64_GOTOFF
778 || fixP
->fx_r_type
== BFD_RELOC_MICROBLAZE_32_GOTOFF
779 || fixP
->fx_r_type
== BFD_RELOC_MICROBLAZE_64_GOT
780 || fixP
->fx_r_type
== BFD_RELOC_MICROBLAZE_64_PLT
)
787 md_assemble (char * str
)
791 struct op_code_struct
* opcode
, *opcode1
;
792 char * output
= NULL
;
795 unsigned long inst
, inst1
;
800 unsigned int immed
, temp
;
804 /* Drop leading whitespace. */
805 while (ISSPACE (* str
))
808 /* Find the op code end. */
809 for (op_start
= op_end
= str
;
810 *op_end
&& !is_end_of_line
[(unsigned char) *op_end
] && *op_end
!= ' ';
813 name
[nlen
] = op_start
[nlen
];
815 if (nlen
== sizeof (name
) - 1)
823 as_bad (_("can't find opcode "));
827 opcode
= (struct op_code_struct
*) hash_find (opcode_hash_control
, name
);
830 as_bad (_("unknown opcode \"%s\""), name
);
834 inst
= opcode
->bit_sequence
;
837 switch (opcode
->inst_type
)
839 case INST_TYPE_RD_R1_R2
:
840 if (strcmp (op_end
, ""))
841 op_end
= parse_reg (op_end
+ 1, ®1
); /* Get rd. */
844 as_fatal (_("Error in statement syntax"));
847 if (strcmp (op_end
, ""))
848 op_end
= parse_reg (op_end
+ 1, ®2
); /* Get r1. */
851 as_fatal (_("Error in statement syntax"));
854 if (strcmp (op_end
, ""))
855 op_end
= parse_reg (op_end
+ 1, ®3
); /* Get r2. */
858 as_fatal (_("Error in statement syntax"));
862 /* Check for spl registers. */
863 if (check_spl_reg (& reg1
))
864 as_fatal (_("Cannot use special register with this instruction"));
865 if (check_spl_reg (& reg2
))
866 as_fatal (_("Cannot use special register with this instruction"));
867 if (check_spl_reg (& reg3
))
868 as_fatal (_("Cannot use special register with this instruction"));
870 if (streq (name
, "sub"))
872 /* sub rd, r1, r2 becomes rsub rd, r2, r1. */
873 inst
|= (reg1
<< RD_LOW
) & RD_MASK
;
874 inst
|= (reg3
<< RA_LOW
) & RA_MASK
;
875 inst
|= (reg2
<< RB_LOW
) & RB_MASK
;
879 inst
|= (reg1
<< RD_LOW
) & RD_MASK
;
880 inst
|= (reg2
<< RA_LOW
) & RA_MASK
;
881 inst
|= (reg3
<< RB_LOW
) & RB_MASK
;
883 output
= frag_more (isize
);
886 case INST_TYPE_RD_R1_IMM
:
887 if (strcmp (op_end
, ""))
888 op_end
= parse_reg (op_end
+ 1, ®1
); /* Get rd. */
891 as_fatal (_("Error in statement syntax"));
894 if (strcmp (op_end
, ""))
895 op_end
= parse_reg (op_end
+ 1, ®2
); /* Get r1. */
898 as_fatal (_("Error in statement syntax"));
901 if (strcmp (op_end
, ""))
902 op_end
= parse_imm (op_end
+ 1, & exp
, MIN_IMM
, MAX_IMM
);
904 as_fatal (_("Error in statement syntax"));
906 /* Check for spl registers. */
907 if (check_spl_reg (& reg1
))
908 as_fatal (_("Cannot use special register with this instruction"));
909 if (check_spl_reg (& reg2
))
910 as_fatal (_("Cannot use special register with this instruction"));
912 if (exp
.X_op
!= O_constant
)
915 relax_substateT subtype
;
917 if (streq (name
, "lmi"))
918 as_fatal (_("lmi pseudo instruction should not use a label in imm field"));
919 else if (streq (name
, "smi"))
920 as_fatal (_("smi pseudo instruction should not use a label in imm field"));
922 if (reg2
== REG_ROSDP
)
923 opc
= str_microblaze_ro_anchor
;
924 else if (reg2
== REG_RWSDP
)
925 opc
= str_microblaze_rw_anchor
;
928 if (exp
.X_md
== IMM_GOT
)
929 subtype
= GOT_OFFSET
;
930 else if (exp
.X_md
== IMM_PLT
)
931 subtype
= PLT_OFFSET
;
932 else if (exp
.X_md
== IMM_GOTOFF
)
933 subtype
= GOTOFF_OFFSET
;
935 subtype
= opcode
->inst_offset_type
;
937 output
= frag_var (rs_machine_dependent
,
938 isize
* 2, /* maxm of 2 words. */
939 isize
, /* minm of 1 word. */
940 subtype
, /* PC-relative or not. */
948 output
= frag_more (isize
);
949 immed
= exp
.X_add_number
;
952 if (streq (name
, "lmi") || streq (name
, "smi"))
954 /* Load/store 32-d consecutive registers. Used on exit/entry
955 to subroutines to save and restore registers to stack.
956 Generate 32-d insts. */
960 if (streq (name
, "lmi"))
961 opcode
= (struct op_code_struct
*) hash_find (opcode_hash_control
, "lwi");
963 opcode
= (struct op_code_struct
*) hash_find (opcode_hash_control
, "swi");
966 as_bad (_("unknown opcode \"%s\""), "lwi");
969 inst
= opcode
->bit_sequence
;
970 inst
|= (reg1
<< RD_LOW
) & RD_MASK
;
971 inst
|= (reg2
<< RA_LOW
) & RA_MASK
;
972 inst
|= (immed
<< IMM_LOW
) & IMM_MASK
;
974 for (i
= 0; i
< count
- 1; i
++)
976 output
[0] = INST_BYTE0 (inst
);
977 output
[1] = INST_BYTE1 (inst
);
978 output
[2] = INST_BYTE2 (inst
);
979 output
[3] = INST_BYTE3 (inst
);
980 output
= frag_more (isize
);
983 inst
= opcode
->bit_sequence
;
984 inst
|= (reg1
<< RD_LOW
) & RD_MASK
;
985 inst
|= (reg2
<< RA_LOW
) & RA_MASK
;
986 inst
|= (immed
<< IMM_LOW
) & IMM_MASK
;
991 temp
= immed
& 0xFFFF8000;
992 if ((temp
!= 0) && (temp
!= 0xFFFF8000))
994 /* Needs an immediate inst. */
995 opcode1
= (struct op_code_struct
*) hash_find (opcode_hash_control
, "imm");
998 as_bad (_("unknown opcode \"%s\""), "imm");
1002 inst1
= opcode1
->bit_sequence
;
1003 inst1
|= ((immed
& 0xFFFF0000) >> 16) & IMM_MASK
;
1004 output
[0] = INST_BYTE0 (inst1
);
1005 output
[1] = INST_BYTE1 (inst1
);
1006 output
[2] = INST_BYTE2 (inst1
);
1007 output
[3] = INST_BYTE3 (inst1
);
1008 output
= frag_more (isize
);
1010 inst
|= (reg1
<< RD_LOW
) & RD_MASK
;
1011 inst
|= (reg2
<< RA_LOW
) & RA_MASK
;
1012 inst
|= (immed
<< IMM_LOW
) & IMM_MASK
;
1016 case INST_TYPE_RD_R1_IMM5
:
1017 if (strcmp (op_end
, ""))
1018 op_end
= parse_reg (op_end
+ 1, ®1
); /* Get rd. */
1021 as_fatal (_("Error in statement syntax"));
1024 if (strcmp (op_end
, ""))
1025 op_end
= parse_reg (op_end
+ 1, ®2
); /* Get r1. */
1028 as_fatal (_("Error in statement syntax"));
1031 if (strcmp (op_end
, ""))
1032 op_end
= parse_imm (op_end
+ 1, & exp
, MIN_IMM
, MAX_IMM
);
1034 as_fatal (_("Error in statement syntax"));
1036 /* Check for spl registers. */
1037 if (check_spl_reg (®1
))
1038 as_fatal (_("Cannot use special register with this instruction"));
1039 if (check_spl_reg (®2
))
1040 as_fatal (_("Cannot use special register with this instruction"));
1042 if (exp
.X_op
!= O_constant
)
1043 as_warn (_("Symbol used as immediate for shift instruction"));
1046 output
= frag_more (isize
);
1047 immed
= exp
.X_add_number
;
1050 if (immed
!= (immed
% 32))
1052 as_warn (_("Shift value > 32. using <value %% 32>"));
1055 inst
|= (reg1
<< RD_LOW
) & RD_MASK
;
1056 inst
|= (reg2
<< RA_LOW
) & RA_MASK
;
1057 inst
|= (immed
<< IMM_LOW
) & IMM5_MASK
;
1060 case INST_TYPE_R1_R2
:
1061 if (strcmp (op_end
, ""))
1062 op_end
= parse_reg (op_end
+ 1, ®1
); /* Get r1. */
1065 as_fatal (_("Error in statement syntax"));
1068 if (strcmp (op_end
, ""))
1069 op_end
= parse_reg (op_end
+ 1, ®2
); /* Get r2. */
1072 as_fatal (_("Error in statement syntax"));
1076 /* Check for spl registers. */
1077 if (check_spl_reg (& reg1
))
1078 as_fatal (_("Cannot use special register with this instruction"));
1079 if (check_spl_reg (& reg2
))
1080 as_fatal (_("Cannot use special register with this instruction"));
1082 inst
|= (reg1
<< RA_LOW
) & RA_MASK
;
1083 inst
|= (reg2
<< RB_LOW
) & RB_MASK
;
1084 output
= frag_more (isize
);
1087 case INST_TYPE_RD_R1
:
1088 if (strcmp (op_end
, ""))
1089 op_end
= parse_reg (op_end
+ 1, ®1
); /* Get rd. */
1092 as_fatal (_("Error in statement syntax"));
1095 if (strcmp (op_end
, ""))
1096 op_end
= parse_reg (op_end
+ 1, ®2
); /* Get r1. */
1099 as_fatal (_("Error in statement syntax"));
1103 /* Check for spl registers. */
1104 if (check_spl_reg (®1
))
1105 as_fatal (_("Cannot use special register with this instruction"));
1106 if (check_spl_reg (®2
))
1107 as_fatal (_("Cannot use special register with this instruction"));
1109 inst
|= (reg1
<< RD_LOW
) & RD_MASK
;
1110 inst
|= (reg2
<< RA_LOW
) & RA_MASK
;
1111 output
= frag_more (isize
);
1114 case INST_TYPE_RD_RFSL
:
1115 if (strcmp (op_end
, ""))
1116 op_end
= parse_reg (op_end
+ 1, ®1
); /* Get rd. */
1119 as_fatal (_("Error in statement syntax"));
1122 if (strcmp (op_end
, ""))
1123 op_end
= parse_reg (op_end
+ 1, &immed
); /* Get rfslN. */
1126 as_fatal (_("Error in statement syntax"));
1130 /* Check for spl registers. */
1131 if (check_spl_reg (®1
))
1132 as_fatal (_("Cannot use special register with this instruction"));
1134 inst
|= (reg1
<< RD_LOW
) & RD_MASK
;
1135 inst
|= (immed
<< IMM_LOW
) & RFSL_MASK
;
1136 output
= frag_more (isize
);
1139 case INST_TYPE_RD_IMM15
:
1140 if (strcmp (op_end
, ""))
1141 op_end
= parse_reg (op_end
+ 1, ®1
); /* Get rd. */
1144 as_fatal (_("Error in statement syntax"));
1148 if (strcmp (op_end
, ""))
1149 op_end
= parse_imm (op_end
+ 1, & exp
, MIN_IMM15
, MAX_IMM15
);
1151 as_fatal (_("Error in statement syntax"));
1153 /* Check for spl registers. */
1154 if (check_spl_reg (®1
))
1155 as_fatal (_("Cannot use special register with this instruction"));
1157 if (exp
.X_op
!= O_constant
)
1158 as_fatal (_("Symbol used as immediate value for msrset/msrclr instructions"));
1161 output
= frag_more (isize
);
1162 immed
= exp
.X_add_number
;
1164 inst
|= (reg1
<< RD_LOW
) & RD_MASK
;
1165 inst
|= (immed
<< IMM_LOW
) & IMM15_MASK
;
1168 case INST_TYPE_R1_RFSL
:
1169 if (strcmp (op_end
, ""))
1170 op_end
= parse_reg (op_end
+ 1, ®1
); /* Get r1. */
1173 as_fatal (_("Error in statement syntax"));
1176 if (strcmp (op_end
, ""))
1177 op_end
= parse_reg (op_end
+ 1, &immed
); /* Get rfslN. */
1180 as_fatal (_("Error in statement syntax"));
1184 /* Check for spl registers. */
1185 if (check_spl_reg (®1
))
1186 as_fatal (_("Cannot use special register with this instruction"));
1188 inst
|= (reg1
<< RA_LOW
) & RA_MASK
;
1189 inst
|= (immed
<< IMM_LOW
) & RFSL_MASK
;
1190 output
= frag_more (isize
);
1193 case INST_TYPE_RFSL
:
1194 if (strcmp (op_end
, ""))
1195 op_end
= parse_reg (op_end
+ 1, &immed
); /* Get rfslN. */
1198 as_fatal (_("Error in statement syntax"));
1201 inst
|= (immed
<< IMM_LOW
) & RFSL_MASK
;
1202 output
= frag_more (isize
);
1206 if (strcmp (op_end
, ""))
1207 op_end
= parse_reg (op_end
+ 1, ®1
); /* Get r1. */
1210 as_fatal (_("Error in statement syntax"));
1214 /* Check for spl registers. */
1215 if (check_spl_reg (®1
))
1216 as_fatal (_("Cannot use special register with this instruction"));
1218 inst
|= (reg1
<< RA_LOW
) & RA_MASK
;
1219 output
= frag_more (isize
);
1222 /* For tuqula insn...:) */
1224 if (strcmp (op_end
, ""))
1225 op_end
= parse_reg (op_end
+ 1, ®1
); /* Get rd. */
1228 as_fatal (_("Error in statement syntax"));
1232 /* Check for spl registers. */
1233 if (check_spl_reg (®1
))
1234 as_fatal (_("Cannot use special register with this instruction"));
1236 inst
|= (reg1
<< RD_LOW
) & RD_MASK
;
1237 output
= frag_more (isize
);
1240 case INST_TYPE_RD_SPECIAL
:
1241 if (strcmp (op_end
, ""))
1242 op_end
= parse_reg (op_end
+ 1, ®1
); /* Get rd. */
1245 as_fatal (_("Error in statement syntax"));
1248 if (strcmp (op_end
, ""))
1249 op_end
= parse_reg (op_end
+ 1, ®2
); /* Get r1. */
1252 as_fatal (_("Error in statement syntax"));
1256 if (reg2
== REG_MSR
)
1257 immed
= opcode
->immval_mask
| REG_MSR_MASK
;
1258 else if (reg2
== REG_PC
)
1259 immed
= opcode
->immval_mask
| REG_PC_MASK
;
1260 else if (reg2
== REG_EAR
)
1261 immed
= opcode
->immval_mask
| REG_EAR_MASK
;
1262 else if (reg2
== REG_ESR
)
1263 immed
= opcode
->immval_mask
| REG_ESR_MASK
;
1264 else if (reg2
== REG_FSR
)
1265 immed
= opcode
->immval_mask
| REG_FSR_MASK
;
1266 else if (reg2
== REG_BTR
)
1267 immed
= opcode
->immval_mask
| REG_BTR_MASK
;
1268 else if (reg2
== REG_EDR
)
1269 immed
= opcode
->immval_mask
| REG_EDR_MASK
;
1270 else if (reg2
== REG_PID
)
1271 immed
= opcode
->immval_mask
| REG_PID_MASK
;
1272 else if (reg2
== REG_ZPR
)
1273 immed
= opcode
->immval_mask
| REG_ZPR_MASK
;
1274 else if (reg2
== REG_TLBX
)
1275 immed
= opcode
->immval_mask
| REG_TLBX_MASK
;
1276 else if (reg2
== REG_TLBLO
)
1277 immed
= opcode
->immval_mask
| REG_TLBLO_MASK
;
1278 else if (reg2
== REG_TLBHI
)
1279 immed
= opcode
->immval_mask
| REG_TLBHI_MASK
;
1280 else if (reg2
>= (REG_PVR
+MIN_PVR_REGNUM
) && reg2
<= (REG_PVR
+MAX_PVR_REGNUM
))
1281 immed
= opcode
->immval_mask
| REG_PVR_MASK
| reg2
;
1283 as_fatal (_("invalid value for special purpose register"));
1284 inst
|= (reg1
<< RD_LOW
) & RD_MASK
;
1285 inst
|= (immed
<< IMM_LOW
) & IMM_MASK
;
1286 output
= frag_more (isize
);
1289 case INST_TYPE_SPECIAL_R1
:
1290 if (strcmp (op_end
, ""))
1291 op_end
= parse_reg (op_end
+ 1, ®1
); /* Get rd. */
1294 as_fatal (_("Error in statement syntax"));
1297 if (strcmp (op_end
, ""))
1298 op_end
= parse_reg (op_end
+ 1, ®2
); /* Get r1. */
1301 as_fatal (_("Error in statement syntax"));
1305 if (reg1
== REG_MSR
)
1306 immed
= opcode
->immval_mask
| REG_MSR_MASK
;
1307 else if (reg1
== REG_PC
)
1308 immed
= opcode
->immval_mask
| REG_PC_MASK
;
1309 else if (reg1
== REG_EAR
)
1310 immed
= opcode
->immval_mask
| REG_EAR_MASK
;
1311 else if (reg1
== REG_ESR
)
1312 immed
= opcode
->immval_mask
| REG_ESR_MASK
;
1313 else if (reg1
== REG_FSR
)
1314 immed
= opcode
->immval_mask
| REG_FSR_MASK
;
1315 else if (reg1
== REG_BTR
)
1316 immed
= opcode
->immval_mask
| REG_BTR_MASK
;
1317 else if (reg1
== REG_EDR
)
1318 immed
= opcode
->immval_mask
| REG_EDR_MASK
;
1319 else if (reg1
== REG_PID
)
1320 immed
= opcode
->immval_mask
| REG_PID_MASK
;
1321 else if (reg1
== REG_ZPR
)
1322 immed
= opcode
->immval_mask
| REG_ZPR_MASK
;
1323 else if (reg1
== REG_TLBX
)
1324 immed
= opcode
->immval_mask
| REG_TLBX_MASK
;
1325 else if (reg1
== REG_TLBLO
)
1326 immed
= opcode
->immval_mask
| REG_TLBLO_MASK
;
1327 else if (reg1
== REG_TLBHI
)
1328 immed
= opcode
->immval_mask
| REG_TLBHI_MASK
;
1329 else if (reg1
== REG_TLBSX
)
1330 immed
= opcode
->immval_mask
| REG_TLBSX_MASK
;
1332 as_fatal (_("invalid value for special purpose register"));
1333 inst
|= (reg2
<< RA_LOW
) & RA_MASK
;
1334 inst
|= (immed
<< IMM_LOW
) & IMM_MASK
;
1335 output
= frag_more (isize
);
1338 case INST_TYPE_RD_R1_SPECIAL
:
1339 if (strcmp (op_end
, ""))
1340 op_end
= parse_reg (op_end
+ 1, ®1
); /* Get rd. */
1343 as_fatal (_("Error in statement syntax"));
1346 if (strcmp (op_end
, ""))
1347 op_end
= parse_reg (op_end
+ 1, ®2
); /* Get r1. */
1350 as_fatal (_("Error in statement syntax"));
1354 /* Check for spl registers. */
1355 if (check_spl_reg (®1
))
1356 as_fatal (_("Cannot use special register with this instruction"));
1357 if (check_spl_reg (®2
))
1358 as_fatal (_("Cannot use special register with this instruction"));
1360 /* insn wic ra, rb => wic ra, ra, rb. */
1361 inst
|= (reg1
<< RD_LOW
) & RD_MASK
;
1362 inst
|= (reg1
<< RA_LOW
) & RA_MASK
;
1363 inst
|= (reg2
<< RB_LOW
) & RB_MASK
;
1365 output
= frag_more (isize
);
1368 case INST_TYPE_RD_R2
:
1369 if (strcmp (op_end
, ""))
1370 op_end
= parse_reg (op_end
+ 1, ®1
); /* Get rd. */
1373 as_fatal (_("Error in statement syntax"));
1376 if (strcmp (op_end
, ""))
1377 op_end
= parse_reg (op_end
+ 1, ®2
); /* Get r2. */
1380 as_fatal (_("Error in statement syntax"));
1384 /* Check for spl registers. */
1385 if (check_spl_reg (®1
))
1386 as_fatal (_("Cannot use special register with this instruction"));
1387 if (check_spl_reg (®2
))
1388 as_fatal (_("Cannot use special register with this instruction"));
1390 inst
|= (reg1
<< RD_LOW
) & RD_MASK
;
1391 inst
|= (reg2
<< RB_LOW
) & RB_MASK
;
1392 output
= frag_more (isize
);
1395 case INST_TYPE_R1_IMM
:
1396 if (strcmp (op_end
, ""))
1397 op_end
= parse_reg (op_end
+ 1, ®1
); /* Get r1. */
1400 as_fatal (_("Error in statement syntax"));
1403 if (strcmp (op_end
, ""))
1404 op_end
= parse_imm (op_end
+ 1, & exp
, MIN_IMM
, MAX_IMM
);
1406 as_fatal (_("Error in statement syntax"));
1408 /* Check for spl registers. */
1409 if (check_spl_reg (®1
))
1410 as_fatal (_("Cannot use special register with this instruction"));
1412 if (exp
.X_op
!= O_constant
)
1415 relax_substateT subtype
;
1417 if (exp
.X_md
== IMM_GOT
)
1418 subtype
= GOT_OFFSET
;
1419 else if (exp
.X_md
== IMM_PLT
)
1420 subtype
= PLT_OFFSET
;
1422 subtype
= opcode
->inst_offset_type
;
1423 output
= frag_var (rs_machine_dependent
,
1424 isize
* 2, /* maxm of 2 words. */
1425 isize
, /* minm of 1 word. */
1426 subtype
, /* PC-relative or not. */
1434 output
= frag_more (isize
);
1435 immed
= exp
.X_add_number
;
1438 temp
= immed
& 0xFFFF8000;
1439 if ((temp
!= 0) && (temp
!= 0xFFFF8000))
1441 /* Needs an immediate inst. */
1442 opcode1
= (struct op_code_struct
*) hash_find (opcode_hash_control
, "imm");
1443 if (opcode1
== NULL
)
1445 as_bad (_("unknown opcode \"%s\""), "imm");
1449 inst1
= opcode1
->bit_sequence
;
1450 inst1
|= ((immed
& 0xFFFF0000) >> 16) & IMM_MASK
;
1451 output
[0] = INST_BYTE0 (inst1
);
1452 output
[1] = INST_BYTE1 (inst1
);
1453 output
[2] = INST_BYTE2 (inst1
);
1454 output
[3] = INST_BYTE3 (inst1
);
1455 output
= frag_more (isize
);
1458 inst
|= (reg1
<< RA_LOW
) & RA_MASK
;
1459 inst
|= (immed
<< IMM_LOW
) & IMM_MASK
;
1462 case INST_TYPE_RD_IMM
:
1463 if (strcmp (op_end
, ""))
1464 op_end
= parse_reg (op_end
+ 1, ®1
); /* Get rd. */
1467 as_fatal (_("Error in statement syntax"));
1470 if (strcmp (op_end
, ""))
1471 op_end
= parse_imm (op_end
+ 1, & exp
, MIN_IMM
, MAX_IMM
);
1473 as_fatal (_("Error in statement syntax"));
1475 /* Check for spl registers. */
1476 if (check_spl_reg (®1
))
1477 as_fatal (_("Cannot use special register with this instruction"));
1479 if (exp
.X_op
!= O_constant
)
1482 relax_substateT subtype
;
1484 if (exp
.X_md
== IMM_GOT
)
1485 subtype
= GOT_OFFSET
;
1486 else if (exp
.X_md
== IMM_PLT
)
1487 subtype
= PLT_OFFSET
;
1489 subtype
= opcode
->inst_offset_type
;
1490 output
= frag_var (rs_machine_dependent
,
1491 isize
* 2, /* maxm of 2 words. */
1492 isize
, /* minm of 1 word. */
1493 subtype
, /* PC-relative or not. */
1501 output
= frag_more (isize
);
1502 immed
= exp
.X_add_number
;
1505 temp
= immed
& 0xFFFF8000;
1506 if ((temp
!= 0) && (temp
!= 0xFFFF8000))
1508 /* Needs an immediate inst. */
1509 opcode1
= (struct op_code_struct
*) hash_find (opcode_hash_control
, "imm");
1510 if (opcode1
== NULL
)
1512 as_bad (_("unknown opcode \"%s\""), "imm");
1516 inst1
= opcode1
->bit_sequence
;
1517 inst1
|= ((immed
& 0xFFFF0000) >> 16) & IMM_MASK
;
1518 output
[0] = INST_BYTE0 (inst1
);
1519 output
[1] = INST_BYTE1 (inst1
);
1520 output
[2] = INST_BYTE2 (inst1
);
1521 output
[3] = INST_BYTE3 (inst1
);
1522 output
= frag_more (isize
);
1525 inst
|= (reg1
<< RD_LOW
) & RD_MASK
;
1526 inst
|= (immed
<< IMM_LOW
) & IMM_MASK
;
1530 if (strcmp (op_end
, ""))
1531 op_end
= parse_reg (op_end
+ 1, ®2
); /* Get r2. */
1534 as_fatal (_("Error in statement syntax"));
1538 /* Check for spl registers. */
1539 if (check_spl_reg (®2
))
1540 as_fatal (_("Cannot use special register with this instruction"));
1542 inst
|= (reg2
<< RB_LOW
) & RB_MASK
;
1543 output
= frag_more (isize
);
1547 if (streq (name
, "imm"))
1548 as_fatal (_("An IMM instruction should not be present in the .s file"));
1550 op_end
= parse_imm (op_end
+ 1, & exp
, MIN_IMM
, MAX_IMM
);
1552 if (exp
.X_op
!= O_constant
)
1555 relax_substateT subtype
;
1557 if (exp
.X_md
== IMM_GOT
)
1558 subtype
= GOT_OFFSET
;
1559 else if (exp
.X_md
== IMM_PLT
)
1560 subtype
= PLT_OFFSET
;
1562 subtype
= opcode
->inst_offset_type
;
1563 output
= frag_var (rs_machine_dependent
,
1564 isize
* 2, /* maxm of 2 words. */
1565 isize
, /* minm of 1 word. */
1566 subtype
, /* PC-relative or not. */
1574 output
= frag_more (isize
);
1575 immed
= exp
.X_add_number
;
1579 temp
= immed
& 0xFFFF8000;
1580 if ((temp
!= 0) && (temp
!= 0xFFFF8000))
1582 /* Needs an immediate inst. */
1583 opcode1
= (struct op_code_struct
*) hash_find (opcode_hash_control
, "imm");
1584 if (opcode1
== NULL
)
1586 as_bad (_("unknown opcode \"%s\""), "imm");
1590 inst1
= opcode1
->bit_sequence
;
1591 inst1
|= ((immed
& 0xFFFF0000) >> 16) & IMM_MASK
;
1592 output
[0] = INST_BYTE0 (inst1
);
1593 output
[1] = INST_BYTE1 (inst1
);
1594 output
[2] = INST_BYTE2 (inst1
);
1595 output
[3] = INST_BYTE3 (inst1
);
1596 output
= frag_more (isize
);
1598 inst
|= (immed
<< IMM_LOW
) & IMM_MASK
;
1601 case INST_TYPE_NONE
:
1602 output
= frag_more (isize
);
1606 as_fatal (_("unimplemented opcode \"%s\""), name
);
1609 /* Drop whitespace after all the operands have been parsed. */
1610 while (ISSPACE (* op_end
))
1613 /* Give warning message if the insn has more operands than required. */
1614 if (strcmp (op_end
, opcode
->name
) && strcmp (op_end
, ""))
1615 as_warn (_("ignoring operands: %s "), op_end
);
1617 output
[0] = INST_BYTE0 (inst
);
1618 output
[1] = INST_BYTE1 (inst
);
1619 output
[2] = INST_BYTE2 (inst
);
1620 output
[3] = INST_BYTE3 (inst
);
1623 dwarf2_emit_insn (4);
1628 md_undefined_symbol (char * name ATTRIBUTE_UNUSED
)
1633 /* Various routines to kill one day. */
1634 /* Equal to MAX_PRECISION in atof-ieee.c */
1635 #define MAX_LITTLENUMS 6
1637 /* Turn a string in input_line_pointer into a floating point constant of type
1638 type, and store the appropriate bytes in *litP. The number of LITTLENUMS
1639 emitted is stored in *sizeP. An error message is returned, or NULL on OK.*/
1641 md_atof (int type
, char * litP
, int * sizeP
)
1644 LITTLENUM_TYPE words
[MAX_LITTLENUMS
];
1676 return _("Bad call to MD_NTOF()");
1679 t
= atof_ieee (input_line_pointer
, type
, words
);
1682 input_line_pointer
= t
;
1684 *sizeP
= prec
* sizeof (LITTLENUM_TYPE
);
1686 if (! target_big_endian
)
1688 for (i
= prec
- 1; i
>= 0; i
--)
1690 md_number_to_chars (litP
, (valueT
) words
[i
],
1691 sizeof (LITTLENUM_TYPE
));
1692 litP
+= sizeof (LITTLENUM_TYPE
);
1696 for (i
= 0; i
< prec
; i
++)
1698 md_number_to_chars (litP
, (valueT
) words
[i
],
1699 sizeof (LITTLENUM_TYPE
));
1700 litP
+= sizeof (LITTLENUM_TYPE
);
1706 const char * md_shortopts
= "";
1708 struct option md_longopts
[] =
1710 { NULL
, no_argument
, NULL
, 0}
1713 size_t md_longopts_size
= sizeof (md_longopts
);
1715 int md_short_jump_size
;
1718 md_create_short_jump (char * ptr ATTRIBUTE_UNUSED
,
1719 addressT from_Nddr ATTRIBUTE_UNUSED
,
1720 addressT to_Nddr ATTRIBUTE_UNUSED
,
1721 fragS
* frag ATTRIBUTE_UNUSED
,
1722 symbolS
* to_symbol ATTRIBUTE_UNUSED
)
1724 as_fatal (_("failed sanity check: short_jump"));
1728 md_create_long_jump (char * ptr ATTRIBUTE_UNUSED
,
1729 addressT from_Nddr ATTRIBUTE_UNUSED
,
1730 addressT to_Nddr ATTRIBUTE_UNUSED
,
1731 fragS
* frag ATTRIBUTE_UNUSED
,
1732 symbolS
* to_symbol ATTRIBUTE_UNUSED
)
1734 as_fatal (_("failed sanity check: long_jump"));
1737 /* Called after relaxing, change the frags so they know how big they are. */
1740 md_convert_frag (bfd
* abfd ATTRIBUTE_UNUSED
,
1741 segT sec ATTRIBUTE_UNUSED
,
1746 switch (fragP
->fr_subtype
)
1748 case UNDEFINED_PC_OFFSET
:
1749 fix_new (fragP
, fragP
->fr_fix
, INST_WORD_SIZE
* 2, fragP
->fr_symbol
,
1750 fragP
->fr_offset
, TRUE
, BFD_RELOC_64_PCREL
);
1751 fragP
->fr_fix
+= INST_WORD_SIZE
* 2;
1754 case DEFINED_ABS_SEGMENT
:
1755 if (fragP
->fr_symbol
== GOT_symbol
)
1756 fix_new (fragP
, fragP
->fr_fix
, INST_WORD_SIZE
* 2, fragP
->fr_symbol
,
1757 fragP
->fr_offset
, TRUE
, BFD_RELOC_MICROBLAZE_64_GOTPC
);
1759 fix_new (fragP
, fragP
->fr_fix
, INST_WORD_SIZE
* 2, fragP
->fr_symbol
,
1760 fragP
->fr_offset
, FALSE
, BFD_RELOC_64
);
1761 fragP
->fr_fix
+= INST_WORD_SIZE
* 2;
1764 case DEFINED_RO_SEGMENT
:
1765 fix_new (fragP
, fragP
->fr_fix
, INST_WORD_SIZE
, fragP
->fr_symbol
,
1766 fragP
->fr_offset
, FALSE
, BFD_RELOC_MICROBLAZE_32_ROSDA
);
1767 fragP
->fr_fix
+= INST_WORD_SIZE
;
1770 case DEFINED_RW_SEGMENT
:
1771 fix_new (fragP
, fragP
->fr_fix
, INST_WORD_SIZE
, fragP
->fr_symbol
,
1772 fragP
->fr_offset
, FALSE
, BFD_RELOC_MICROBLAZE_32_RWSDA
);
1773 fragP
->fr_fix
+= INST_WORD_SIZE
;
1776 case DEFINED_PC_OFFSET
:
1777 fix_new (fragP
, fragP
->fr_fix
, INST_WORD_SIZE
, fragP
->fr_symbol
,
1778 fragP
->fr_offset
, TRUE
, BFD_RELOC_MICROBLAZE_32_LO_PCREL
);
1779 fragP
->fr_fix
+= INST_WORD_SIZE
;
1782 case LARGE_DEFINED_PC_OFFSET
:
1783 fix_new (fragP
, fragP
->fr_fix
, INST_WORD_SIZE
* 2, fragP
->fr_symbol
,
1784 fragP
->fr_offset
, TRUE
, BFD_RELOC_64_PCREL
);
1785 fragP
->fr_fix
+= INST_WORD_SIZE
* 2;
1789 fix_new (fragP
, fragP
->fr_fix
, INST_WORD_SIZE
* 2, fragP
->fr_symbol
,
1790 fragP
->fr_offset
, FALSE
, BFD_RELOC_MICROBLAZE_64_GOT
);
1791 fragP
->fr_fix
+= INST_WORD_SIZE
* 2;
1795 fixP
= fix_new (fragP
, fragP
->fr_fix
, INST_WORD_SIZE
* 2, fragP
->fr_symbol
,
1796 fragP
->fr_offset
, TRUE
, BFD_RELOC_MICROBLAZE_64_PLT
);
1797 /* fixP->fx_plt = 1; */
1799 fragP
->fr_fix
+= INST_WORD_SIZE
* 2;
1803 fix_new (fragP
, fragP
->fr_fix
, INST_WORD_SIZE
* 2, fragP
->fr_symbol
,
1804 fragP
->fr_offset
, FALSE
, BFD_RELOC_MICROBLAZE_64_GOTOFF
);
1805 fragP
->fr_fix
+= INST_WORD_SIZE
* 2;
1814 /* Applies the desired value to the specified location.
1815 Also sets up addends for 'rela' type relocations. */
1817 md_apply_fix (fixS
* fixP
,
1821 char * buf
= fixP
->fx_where
+ fixP
->fx_frag
->fr_literal
;
1822 char * file
= fixP
->fx_file
? fixP
->fx_file
: _("unknown");
1823 const char * symname
;
1824 /* Note: use offsetT because it is signed, valueT is unsigned. */
1825 offsetT val
= (offsetT
) * valp
;
1827 struct op_code_struct
* opcode1
;
1828 unsigned long inst1
;
1830 symname
= fixP
->fx_addsy
? S_GET_NAME (fixP
->fx_addsy
) : _("<unknown>");
1832 /* fixP->fx_offset is supposed to be set up correctly for all
1833 symbol relocations. */
1834 if (fixP
->fx_addsy
== NULL
)
1836 if (!fixP
->fx_pcrel
)
1837 fixP
->fx_offset
= val
; /* Absolute relocation. */
1839 fprintf (stderr
, "NULL symbol PC-relative relocation? offset = %08x, val = %08x\n",
1840 (unsigned int) fixP
->fx_offset
, (unsigned int) val
);
1843 /* If we aren't adjusting this fixup to be against the section
1844 symbol, we need to adjust the value. */
1845 if (fixP
->fx_addsy
!= NULL
)
1847 if (S_IS_WEAK (fixP
->fx_addsy
)
1848 || (symbol_used_in_reloc_p (fixP
->fx_addsy
)
1849 && (((bfd_get_section_flags (stdoutput
,
1850 S_GET_SEGMENT (fixP
->fx_addsy
))
1851 & SEC_LINK_ONCE
) != 0)
1852 || !strncmp (segment_name (S_GET_SEGMENT (fixP
->fx_addsy
)),
1854 sizeof (".gnu.linkonce") - 1))))
1856 val
-= S_GET_VALUE (fixP
->fx_addsy
);
1857 if (val
!= 0 && ! fixP
->fx_pcrel
)
1859 /* In this case, the bfd_install_relocation routine will
1860 incorrectly add the symbol value back in. We just want
1861 the addend to appear in the object file.
1862 FIXME: If this makes VALUE zero, we're toast. */
1863 val
-= S_GET_VALUE (fixP
->fx_addsy
);
1868 /* If the fix is relative to a symbol which is not defined, or not
1869 in the same segment as the fix, we cannot resolve it here. */
1870 /* fixP->fx_addsy is NULL if valp contains the entire relocation. */
1871 if (fixP
->fx_addsy
!= NULL
1872 && (!S_IS_DEFINED (fixP
->fx_addsy
)
1873 || (S_GET_SEGMENT (fixP
->fx_addsy
) != segment
)))
1877 /* For ELF we can just return and let the reloc that will be generated
1878 take care of everything. For COFF we still have to insert 'val'
1879 into the insn since the addend field will be ignored. */
1883 /* All fixups in the text section must be handled in the linker. */
1884 else if (segment
->flags
& SEC_CODE
)
1886 else if (!fixP
->fx_pcrel
&& fixP
->fx_addsy
!= NULL
)
1891 switch (fixP
->fx_r_type
)
1893 case BFD_RELOC_MICROBLAZE_32_LO
:
1894 case BFD_RELOC_MICROBLAZE_32_LO_PCREL
:
1895 if (target_big_endian
)
1897 buf
[2] |= ((val
>> 8) & 0xff);
1898 buf
[3] |= (val
& 0xff);
1902 buf
[1] |= ((val
>> 8) & 0xff);
1903 buf
[0] |= (val
& 0xff);
1906 case BFD_RELOC_MICROBLAZE_32_ROSDA
:
1907 case BFD_RELOC_MICROBLAZE_32_RWSDA
:
1908 /* Don't do anything if the symbol is not defined. */
1909 if (fixP
->fx_addsy
== NULL
|| S_IS_DEFINED (fixP
->fx_addsy
))
1911 if (((val
& 0xFFFF8000) != 0) && ((val
& 0xFFFF8000) != 0xFFFF8000))
1912 as_bad_where (file
, fixP
->fx_line
,
1913 _("pcrel for branch to %s too far (0x%x)"),
1914 symname
, (int) val
);
1915 if (target_big_endian
)
1917 buf
[2] |= ((val
>> 8) & 0xff);
1918 buf
[3] |= (val
& 0xff);
1922 buf
[1] |= ((val
>> 8) & 0xff);
1923 buf
[0] |= (val
& 0xff);
1929 case BFD_RELOC_32_PCREL
:
1930 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM
:
1931 /* Don't do anything if the symbol is not defined. */
1932 if (fixP
->fx_addsy
== NULL
|| S_IS_DEFINED (fixP
->fx_addsy
))
1934 if (target_big_endian
)
1936 buf
[0] |= ((val
>> 24) & 0xff);
1937 buf
[1] |= ((val
>> 16) & 0xff);
1938 buf
[2] |= ((val
>> 8) & 0xff);
1939 buf
[3] |= (val
& 0xff);
1943 buf
[3] |= ((val
>> 24) & 0xff);
1944 buf
[2] |= ((val
>> 16) & 0xff);
1945 buf
[1] |= ((val
>> 8) & 0xff);
1946 buf
[0] |= (val
& 0xff);
1950 case BFD_RELOC_64_PCREL
:
1952 /* Add an imm instruction. First save the current instruction. */
1953 for (i
= 0; i
< INST_WORD_SIZE
; i
++)
1954 buf
[i
+ INST_WORD_SIZE
] = buf
[i
];
1956 /* Generate the imm instruction. */
1957 opcode1
= (struct op_code_struct
*) hash_find (opcode_hash_control
, "imm");
1958 if (opcode1
== NULL
)
1960 as_bad (_("unknown opcode \"%s\""), "imm");
1964 inst1
= opcode1
->bit_sequence
;
1965 if (fixP
->fx_addsy
== NULL
|| S_IS_DEFINED (fixP
->fx_addsy
))
1966 inst1
|= ((val
& 0xFFFF0000) >> 16) & IMM_MASK
;
1968 buf
[0] = INST_BYTE0 (inst1
);
1969 buf
[1] = INST_BYTE1 (inst1
);
1970 buf
[2] = INST_BYTE2 (inst1
);
1971 buf
[3] = INST_BYTE3 (inst1
);
1973 /* Add the value only if the symbol is defined. */
1974 if (fixP
->fx_addsy
== NULL
|| S_IS_DEFINED (fixP
->fx_addsy
))
1976 if (target_big_endian
)
1978 buf
[6] |= ((val
>> 8) & 0xff);
1979 buf
[7] |= (val
& 0xff);
1983 buf
[5] |= ((val
>> 8) & 0xff);
1984 buf
[4] |= (val
& 0xff);
1989 case BFD_RELOC_MICROBLAZE_64_GOTPC
:
1990 case BFD_RELOC_MICROBLAZE_64_GOT
:
1991 case BFD_RELOC_MICROBLAZE_64_PLT
:
1992 case BFD_RELOC_MICROBLAZE_64_GOTOFF
:
1993 /* Add an imm instruction. First save the current instruction. */
1994 for (i
= 0; i
< INST_WORD_SIZE
; i
++)
1995 buf
[i
+ INST_WORD_SIZE
] = buf
[i
];
1997 /* Generate the imm instruction. */
1998 opcode1
= (struct op_code_struct
*) hash_find (opcode_hash_control
, "imm");
1999 if (opcode1
== NULL
)
2001 as_bad (_("unknown opcode \"%s\""), "imm");
2005 inst1
= opcode1
->bit_sequence
;
2007 /* We can fixup call to a defined non-global address
2008 within the same section only. */
2009 buf
[0] = INST_BYTE0 (inst1
);
2010 buf
[1] = INST_BYTE1 (inst1
);
2011 buf
[2] = INST_BYTE2 (inst1
);
2012 buf
[3] = INST_BYTE3 (inst1
);
2019 if (fixP
->fx_addsy
== NULL
)
2021 /* This fixup has been resolved. Create a reloc in case the linker
2022 moves code around due to relaxing. */
2023 if (fixP
->fx_r_type
== BFD_RELOC_64_PCREL
)
2024 fixP
->fx_r_type
= BFD_RELOC_MICROBLAZE_64_NONE
;
2026 fixP
->fx_r_type
= BFD_RELOC_NONE
;
2027 fixP
->fx_addsy
= section_symbol (absolute_section
);
2033 md_operand (expressionS
* expressionP
)
2035 /* Ignore leading hash symbol, if present. */
2036 if (*input_line_pointer
== '#')
2038 input_line_pointer
++;
2039 expression (expressionP
);
2043 /* Called just before address relaxation, return the length
2044 by which a fragment must grow to reach it's destination. */
2047 md_estimate_size_before_relax (fragS
* fragP
,
2050 sbss_segment
= bfd_get_section_by_name (stdoutput
, ".sbss");
2051 sbss2_segment
= bfd_get_section_by_name (stdoutput
, ".sbss2");
2052 sdata_segment
= bfd_get_section_by_name (stdoutput
, ".sdata");
2053 sdata2_segment
= bfd_get_section_by_name (stdoutput
, ".sdata2");
2055 switch (fragP
->fr_subtype
)
2057 case INST_PC_OFFSET
:
2058 /* Used to be a PC-relative branch. */
2059 if (!fragP
->fr_symbol
)
2061 /* We know the abs value: Should never happen. */
2062 as_bad (_("Absolute PC-relative value in relaxation code. Assembler error....."));
2065 else if (S_GET_SEGMENT (fragP
->fr_symbol
) == segment_type
&&
2066 !S_IS_WEAK (fragP
->fr_symbol
))
2068 fragP
->fr_subtype
= DEFINED_PC_OFFSET
;
2069 /* Don't know now whether we need an imm instruction. */
2070 fragP
->fr_var
= INST_WORD_SIZE
;
2072 else if (S_IS_DEFINED (fragP
->fr_symbol
)
2073 && (((S_GET_SEGMENT (fragP
->fr_symbol
))->flags
& SEC_CODE
) == 0))
2075 /* Cannot have a PC-relative branch to a diff segment. */
2076 as_bad (_("PC relative branch to label %s which is not in the instruction space"),
2077 S_GET_NAME (fragP
->fr_symbol
));
2078 fragP
->fr_subtype
= UNDEFINED_PC_OFFSET
;
2079 fragP
->fr_var
= INST_WORD_SIZE
*2;
2083 fragP
->fr_subtype
= UNDEFINED_PC_OFFSET
;
2084 fragP
->fr_var
= INST_WORD_SIZE
*2;
2088 case INST_NO_OFFSET
:
2089 /* Used to be a reference to somewhere which was unknown. */
2090 if (fragP
->fr_symbol
)
2092 if (fragP
->fr_opcode
== NULL
)
2094 /* Used as an absolute value. */
2095 fragP
->fr_subtype
= DEFINED_ABS_SEGMENT
;
2096 /* Variable part does not change. */
2097 fragP
->fr_var
= INST_WORD_SIZE
*2;
2099 else if (streq (fragP
->fr_opcode
, str_microblaze_ro_anchor
))
2101 /* It is accessed using the small data read only anchor. */
2102 if ((S_GET_SEGMENT (fragP
->fr_symbol
) == bfd_com_section_ptr
)
2103 || (S_GET_SEGMENT (fragP
->fr_symbol
) == sdata2_segment
)
2104 || (S_GET_SEGMENT (fragP
->fr_symbol
) == sbss2_segment
)
2105 || (! S_IS_DEFINED (fragP
->fr_symbol
)))
2107 fragP
->fr_subtype
= DEFINED_RO_SEGMENT
;
2108 fragP
->fr_var
= INST_WORD_SIZE
;
2112 /* Variable not in small data read only segment accessed
2113 using small data read only anchor. */
2114 char *file
= fragP
->fr_file
? fragP
->fr_file
: _("unknown");
2116 as_bad_where (file
, fragP
->fr_line
,
2117 _("Variable is accessed using small data read "
2118 "only anchor, but it is not in the small data "
2119 "read only section"));
2120 fragP
->fr_subtype
= DEFINED_RO_SEGMENT
;
2121 fragP
->fr_var
= INST_WORD_SIZE
;
2124 else if (streq (fragP
->fr_opcode
, str_microblaze_rw_anchor
))
2126 if ((S_GET_SEGMENT (fragP
->fr_symbol
) == bfd_com_section_ptr
)
2127 || (S_GET_SEGMENT (fragP
->fr_symbol
) == sdata_segment
)
2128 || (S_GET_SEGMENT (fragP
->fr_symbol
) == sbss_segment
)
2129 || (!S_IS_DEFINED (fragP
->fr_symbol
)))
2131 /* It is accessed using the small data read write anchor. */
2132 fragP
->fr_subtype
= DEFINED_RW_SEGMENT
;
2133 fragP
->fr_var
= INST_WORD_SIZE
;
2137 char *file
= fragP
->fr_file
? fragP
->fr_file
: _("unknown");
2139 as_bad_where (file
, fragP
->fr_line
,
2140 _("Variable is accessed using small data read "
2141 "write anchor, but it is not in the small data "
2142 "read write section"));
2143 fragP
->fr_subtype
= DEFINED_RW_SEGMENT
;
2144 fragP
->fr_var
= INST_WORD_SIZE
;
2149 as_bad (_("Incorrect fr_opcode value in frag. Internal error....."));
2155 /* We know the abs value: Should never happen. */
2156 as_bad (_("Absolute value in relaxation code. Assembler error....."));
2161 case UNDEFINED_PC_OFFSET
:
2162 case LARGE_DEFINED_PC_OFFSET
:
2163 case DEFINED_ABS_SEGMENT
:
2167 fragP
->fr_var
= INST_WORD_SIZE
*2;
2169 case DEFINED_RO_SEGMENT
:
2170 case DEFINED_RW_SEGMENT
:
2171 case DEFINED_PC_OFFSET
:
2172 fragP
->fr_var
= INST_WORD_SIZE
;
2178 return fragP
->fr_var
;
2181 /* Put number into target byte order. */
2184 md_number_to_chars (char * ptr
, valueT use
, int nbytes
)
2186 if (target_big_endian
)
2187 number_to_chars_bigendian (ptr
, use
, nbytes
);
2189 number_to_chars_littleendian (ptr
, use
, nbytes
);
2192 /* Round up a section size to the appropriate boundary. */
2195 md_section_align (segT segment ATTRIBUTE_UNUSED
, valueT size
)
2197 return size
; /* Byte alignment is fine. */
2201 /* The location from which a PC relative jump should be calculated,
2202 given a PC relative reloc. */
2205 md_pcrel_from_section (fixS
* fixp
, segT sec ATTRIBUTE_UNUSED
)
2208 /* If the symbol is undefined or defined in another section
2209 we leave the add number alone for the linker to fix it later.
2210 Only account for the PC pre-bump (No PC-pre-bump on the Microblaze). */
2212 if (fixp
->fx_addsy
!= (symbolS
*) NULL
2213 && (!S_IS_DEFINED (fixp
->fx_addsy
)
2214 || (S_GET_SEGMENT (fixp
->fx_addsy
) != sec
)))
2218 /* The case where we are going to resolve things... */
2219 if (fixp
->fx_r_type
== BFD_RELOC_64_PCREL
)
2220 return fixp
->fx_where
+ fixp
->fx_frag
->fr_address
+ INST_WORD_SIZE
;
2222 return fixp
->fx_where
+ fixp
->fx_frag
->fr_address
;
2228 #define F(SZ,PCREL) (((SZ) << 1) + (PCREL))
2229 #define MAP(SZ,PCREL,TYPE) case F (SZ, PCREL): code = (TYPE); break
2232 tc_gen_reloc (asection
* section ATTRIBUTE_UNUSED
, fixS
* fixp
)
2235 bfd_reloc_code_real_type code
;
2237 switch (fixp
->fx_r_type
)
2239 case BFD_RELOC_NONE
:
2240 case BFD_RELOC_MICROBLAZE_64_NONE
:
2242 case BFD_RELOC_MICROBLAZE_32_LO
:
2243 case BFD_RELOC_MICROBLAZE_32_LO_PCREL
:
2246 case BFD_RELOC_64_PCREL
:
2247 case BFD_RELOC_MICROBLAZE_32_ROSDA
:
2248 case BFD_RELOC_MICROBLAZE_32_RWSDA
:
2249 case BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM
:
2250 case BFD_RELOC_MICROBLAZE_64_GOTPC
:
2251 case BFD_RELOC_MICROBLAZE_64_GOT
:
2252 case BFD_RELOC_MICROBLAZE_64_PLT
:
2253 case BFD_RELOC_MICROBLAZE_64_GOTOFF
:
2254 case BFD_RELOC_MICROBLAZE_32_GOTOFF
:
2255 code
= fixp
->fx_r_type
;
2259 switch (F (fixp
->fx_size
, fixp
->fx_pcrel
))
2261 MAP (1, 0, BFD_RELOC_8
);
2262 MAP (2, 0, BFD_RELOC_16
);
2263 MAP (4, 0, BFD_RELOC_32
);
2264 MAP (1, 1, BFD_RELOC_8_PCREL
);
2265 MAP (2, 1, BFD_RELOC_16_PCREL
);
2266 MAP (4, 1, BFD_RELOC_32_PCREL
);
2268 code
= fixp
->fx_r_type
;
2269 as_bad (_("Can not do %d byte %srelocation"),
2271 fixp
->fx_pcrel
? _("pc-relative") : "");
2276 rel
= (arelent
*) xmalloc (sizeof (arelent
));
2277 rel
->sym_ptr_ptr
= (asymbol
**) xmalloc (sizeof (asymbol
*));
2279 if (code
== BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM
)
2280 *rel
->sym_ptr_ptr
= symbol_get_bfdsym (fixp
->fx_subsy
);
2282 *rel
->sym_ptr_ptr
= symbol_get_bfdsym (fixp
->fx_addsy
);
2284 rel
->address
= fixp
->fx_frag
->fr_address
+ fixp
->fx_where
;
2285 /* Always pass the addend along! */
2286 rel
->addend
= fixp
->fx_offset
;
2287 rel
->howto
= bfd_reloc_type_lookup (stdoutput
, code
);
2289 if (rel
->howto
== NULL
)
2291 as_bad_where (fixp
->fx_file
, fixp
->fx_line
,
2292 _("Cannot represent relocation type %s"),
2293 bfd_get_reloc_code_name (code
));
2295 /* Set howto to a garbage value so that we can keep going. */
2296 rel
->howto
= bfd_reloc_type_lookup (stdoutput
, BFD_RELOC_32
);
2297 gas_assert (rel
->howto
!= NULL
);
2303 md_parse_option (int c
, char * arg ATTRIBUTE_UNUSED
)
2314 md_show_usage (FILE * stream ATTRIBUTE_UNUSED
)
2316 /* fprintf(stream, _("\
2317 MicroBlaze options:\n\
2318 -noSmall Data in the comm and data sections do not go into the small data section\n")); */
2322 /* Create a fixup for a cons expression. If parse_cons_expression_microblaze
2323 found a machine specific op in an expression,
2324 then we create relocs accordingly. */
2327 cons_fix_new_microblaze (fragS
* frag
,
2333 bfd_reloc_code_real_type r
;
2335 if ((exp
->X_op
== O_subtract
) && (exp
->X_add_symbol
) &&
2336 (exp
->X_op_symbol
) && (now_seg
!= absolute_section
) && (size
== 4)
2337 && (!S_IS_LOCAL (exp
->X_op_symbol
)))
2338 r
= BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM
;
2339 else if (exp
->X_md
== IMM_GOTOFF
&& exp
->X_op
== O_symbol_rva
)
2341 exp
->X_op
= O_symbol
;
2342 r
= BFD_RELOC_MICROBLAZE_32_GOTOFF
;
2361 as_bad (_("unsupported BFD relocation size %u"), size
);
2366 fix_new_exp (frag
, where
, size
, exp
, 0, r
);