1 /* tc-ldx.c -- Assemble for the DLX
2 Copyright 2002, 2003, 2004 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 2, or (at your option)
11 GAS is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GAS; see the file COPYING. If not, write to the Free
18 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
21 /* Initially created by Kuang Hwa Lin, 3/20/2002. */
23 #include "safe-ctype.h"
26 #include "opcode/dlx.h"
28 /* Make it easier to clone this machine desc into another one. */
29 #define machine_opcode dlx_opcode
30 #define machine_opcodes dlx_opcodes
31 #define machine_ip dlx_ip
32 #define machine_it dlx_it
34 #define NO_RELOC BFD_RELOC_NONE
35 #define RELOC_DLX_REL26 BFD_RELOC_DLX_JMP26
36 #define RELOC_DLX_16 BFD_RELOC_16
37 #define RELOC_DLX_REL16 BFD_RELOC_16_PCREL_S2
38 #define RELOC_DLX_HI16 BFD_RELOC_HI16_S
39 #define RELOC_DLX_LO16 BFD_RELOC_LO16
40 #define RELOC_DLX_VTINHERIT BFD_RELOC_VTABLE_INHERIT
41 #define RELOC_DLX_VTENTRY BFD_RELOC_VTABLE_ENTRY
43 /* handle of the OPCODE hash table */
44 static struct hash_control *op_hash = NULL;
54 int reloc_offset; /* Offset of reloc within insn. */
61 /* static void print_insn PARAMS ((struct machine_it *)); */
62 char * parse_operand PARAMS ((char *, expressionS *));
63 int md_chars_to_number PARAMS ((unsigned char *, int));
65 static void machine_ip PARAMS ((char *));
66 static void s_proc PARAMS ((int));
67 static void insert_sreg PARAMS ((char *, int));
68 static int hilo_modifier_ok PARAMS ((char *));
69 static int is_ldst_registers PARAMS ((char *));
70 static int match_sft_register PARAMS ((char *));
71 static void define_some_regs PARAMS ((void));
72 static char * dlx_parse_loadop PARAMS ((char *));
73 static char * dlx_parse_storeop PARAMS ((char *));
74 static char * fix_ld_st_operand PARAMS ((unsigned long, char *));
80 /* Some additional ops that are used by gcc-dlx. */
81 {"asciiz", stringer, 1},
86 {"endproc", s_proc, 1},
90 /* This array holds the chars that always start a comment. If the
91 pre-processor is disabled, these aren't very useful. */
92 const char comment_chars[] = ";";
94 /* This array holds the chars that only start a comment at the beginning of
95 a line. If the line seems to have the form '# 123 filename'
96 .line and .file directives will appear in the pre-processed output. */
97 /* Note that input_file.c hand checks for '#' at the beginning of the
98 first line of the input file. This is because the compiler outputs
99 #NO_APP at the beginning of its output. */
100 /* Also note that comments like this one will always work. */
101 const char line_comment_chars[] = "#";
103 /* We needed an unused char for line separation to work around the
104 lack of macros, using sed and such. */
105 const char line_separator_chars[] = "@";
107 /* Chars that can be used to separate mant from exp in floating point nums. */
108 const char EXP_CHARS[] = "eE";
110 /* Chars that mean this number is a floating point constant.
113 const char FLT_CHARS[] = "rRsSfFdDxXpP";
116 insert_sreg (regname, regnum)
120 /* Must be large enough to hold the names of the special registers. */
124 symbol_table_insert (symbol_new (regname, reg_section, (valueT) regnum,
125 &zero_address_frag));
126 for (i = 0; regname[i]; i++)
127 buf[i] = ISLOWER (regname[i]) ? TOUPPER (regname[i]) : regname[i];
130 symbol_table_insert (symbol_new (buf, reg_section, (valueT) regnum,
131 &zero_address_frag));
134 /* Install symbol definitions for assorted special registers.
135 See MIPS Assembly Language Programmer's Guide page 1-4 */
140 /* Software representation. */
141 insert_sreg ("zero", 0);
142 insert_sreg ("at", 1);
143 insert_sreg ("v0", 2);
144 insert_sreg ("v1", 3);
145 insert_sreg ("a0", 4);
146 insert_sreg ("a1", 5);
147 insert_sreg ("a2", 6);
148 insert_sreg ("a3", 7);
149 insert_sreg ("t0", 8);
150 insert_sreg ("t1", 9);
151 insert_sreg ("t2", 10);
152 insert_sreg ("t3", 11);
153 insert_sreg ("t4", 12);
154 insert_sreg ("t5", 13);
155 insert_sreg ("t6", 14);
156 insert_sreg ("t7", 15);
157 insert_sreg ("s0", 16);
158 insert_sreg ("s1", 17);
159 insert_sreg ("s2", 18);
160 insert_sreg ("s3", 19);
161 insert_sreg ("s4", 20);
162 insert_sreg ("s5", 21);
163 insert_sreg ("s6", 22);
164 insert_sreg ("s7", 23);
165 insert_sreg ("t8", 24);
166 insert_sreg ("t9", 25);
167 insert_sreg ("k0", 26);
168 insert_sreg ("k1", 27);
169 insert_sreg ("gp", 28);
170 insert_sreg ("sp", 29);
171 insert_sreg ("fp", 30);
172 insert_sreg ("ra", 31);
173 /* Special registers. */
174 insert_sreg ("pc", 0);
175 insert_sreg ("npc", 1);
176 insert_sreg ("iad", 2);
179 /* Subroutine check the string to match an register, */
182 match_sft_register (name)
185 #define MAX_REG_NO 35
186 /* Currently we have 35 software registers defined -
187 we borrowed from MIPS. */
188 static char *soft_reg[] =
190 "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
191 "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9",
192 "s0", "s1", "s2", "s3", "s4", "s5", "s7", "k0", "k1",
193 "gp", "sp", "fp", "ra", "pc", "npc", "iad",
194 "EndofTab" /* End of the Table indicator */
196 char low_name[21], *ptr;
199 for (ptr = name,idx = 0; *ptr != '\0'; ptr++)
200 low_name[idx++] = TOLOWER (*ptr);
202 low_name[idx] = '\0';
205 while (idx < MAX_REG_NO && strcmp (soft_reg[idx], & low_name [0]))
208 return idx < MAX_REG_NO;
211 /* Subroutine check the string to match an register. */
214 is_ldst_registers (name)
219 /* The first character of the register name got to be either %, $, r of R. */
220 if ((ptr[0] == '%' || ptr[0] == '$' || ptr[0] == 'r' || ptr[0] == 'R')
221 && ISDIGIT ((unsigned char) ptr[1]))
224 /* Now check the software register representation. */
225 return match_sft_register (ptr);
228 /* Subroutine of s_proc so targets can choose a different default prefix.
229 If DEFAULT_PREFIX is NULL, use the target's "leading char". */
235 /* Record the current function so that we can issue an error message for
236 misplaced .func,.endfunc, and also so that .endfunc needs no
238 static char *current_name;
239 static char *current_label;
243 if (current_name == NULL)
245 as_bad (_("missing .proc"));
246 ignore_rest_of_line ();
250 current_name = current_label = NULL;
252 while (!is_end_of_line[(unsigned char) *input_line_pointer])
253 input_line_pointer++;
260 if (current_name != NULL)
262 as_bad (_(".endfunc missing for previous .proc"));
263 ignore_rest_of_line ();
267 name = input_line_pointer;
268 delim1 = get_symbol_end ();
269 name = xstrdup (name);
270 *input_line_pointer = delim1;
273 if (*input_line_pointer != ',')
275 char leading_char = 0;
277 leading_char = bfd_get_symbol_leading_char (stdoutput);
278 /* Missing entry point, use function's name with the leading
281 asprintf (&label, "%c%s", leading_char, name);
287 ++input_line_pointer;
289 label = input_line_pointer;
290 delim2 = get_symbol_end ();
291 label = xstrdup (label);
292 *input_line_pointer = delim2;
296 current_label = label;
298 demand_empty_rest_of_line ();
301 /* This function is called once, at assembler startup time. It should
302 set up all the tables, etc., that the MD part of the assembler will
308 const char *retval = NULL;
312 /* Create a new hash table. */
313 op_hash = hash_new ();
315 /* Hash up all the opcodes for fast use later. */
316 for (i = 0; i < num_dlx_opcodes; i++)
318 const char *name = machine_opcodes[i].name;
320 retval = hash_insert (op_hash, name, (PTR) &machine_opcodes[i]);
324 fprintf (stderr, "internal error: can't hash `%s': %s\n",
325 machine_opcodes[i].name, retval);
331 as_fatal (_("Broken assembler. No assembly attempted."));
336 /* Assemble a single instruction. Its label has already been handled
337 by the generic front end. We just parse opcode and operands, and
338 produce the bytes of data and relocation. */
351 /* Put out the opcode. */
352 md_number_to_chars (toP, the_insn.opcode, 4);
354 /* Put out the symbol-dependent stuff. */
355 if (the_insn.reloc != NO_RELOC)
357 fixP = fix_new_exp (frag_now,
358 (toP - frag_now->fr_literal + the_insn.reloc_offset),
359 the_insn.size, & the_insn.exp, the_insn.pcrel,
362 /* Turn off complaints that the addend is
363 too large for things like foo+100000@ha. */
364 switch (the_insn.reloc)
368 fixP->fx_no_overflow = 1;
374 switch (fixP->fx_r_type)
376 case RELOC_DLX_REL26:
377 bitP = malloc (sizeof (bit_fixS));
378 bitP->fx_bit_size = 26;
379 bitP->fx_bit_offset = 25;
380 bitP->fx_bit_base = the_insn.opcode & 0xFC000000;
381 bitP->fx_bit_base_adj = 0;
382 bitP->fx_bit_max = 0;
383 bitP->fx_bit_min = 0;
384 bitP->fx_bit_add = 0x03FFFFFF;
385 fixP->fx_bit_fixP = bitP;
388 case RELOC_DLX_REL16:
389 bitP = malloc (sizeof (bit_fixS));
390 bitP->fx_bit_size = 16;
391 bitP->fx_bit_offset = 15;
392 bitP->fx_bit_base = the_insn.opcode & 0xFFFF0000;
393 bitP->fx_bit_base_adj = 0;
394 bitP->fx_bit_max = 0;
395 bitP->fx_bit_min = 0;
396 bitP->fx_bit_add = 0x0000FFFF;
397 fixP->fx_bit_fixP = bitP;
400 bitP = malloc (sizeof (bit_fixS));
401 bitP->fx_bit_size = 16;
402 bitP->fx_bit_offset = 15;
403 bitP->fx_bit_base = the_insn.opcode & 0xFFFF0000;
404 bitP->fx_bit_base_adj = 0;
405 bitP->fx_bit_max = 0;
406 bitP->fx_bit_min = 0;
407 bitP->fx_bit_add = 0x0000FFFF;
408 fixP->fx_bit_fixP = bitP;
411 fixP->fx_bit_fixP = (bit_fixS *)NULL;
427 for (idx = 1; ptr[idx] != '\0' && ptr[idx] != '[' && idx < 73; idx += 1)
439 return (count == 0) ? 1:0;
443 parse_operand (s, operandp)
445 expressionS *operandp;
447 char *save = input_line_pointer;
450 the_insn.HI = the_insn.LO = 0;
452 /* Search for %hi and %lo, make a mark and skip it. */
453 if (strncmp (s, "%hi", 3) == 0)
460 if (strncmp (s, "%lo", 3) == 0)
469 if (the_insn.HI || the_insn.LO)
471 if (!hilo_modifier_ok (s))
472 as_bad (_("Expression Error for operand modifier %%hi/%%lo\n"));
475 /* Check for the % and $ register representation */
476 if ((s[0] == '%' || s[0] == '$' || s[0] == 'r' || s[0] == 'R')
477 && ISDIGIT ((unsigned char) s[1]))
479 /* We have a numeric register expression. No biggy. */
481 input_line_pointer = s;
482 (void) expression (operandp);
483 if (operandp->X_op != O_constant
484 || operandp->X_add_number > 31)
485 as_bad (_("Invalid expression after %%%%\n"));
486 operandp->X_op = O_register;
490 /* Normal operand parsing. */
491 input_line_pointer = s;
492 (void) expression (operandp);
495 new = input_line_pointer;
496 input_line_pointer = save;
500 /* This function will check the opcode and return 1 if the opcode is one
501 of the load/store instruction, and it will fix the operand string to
502 the standard form so we can use the standard parse_operand routine. */
504 #define READ_OP 0x100
505 #define WRITE_OP 0x200
506 static char iBuf[81];
509 dlx_parse_loadop (str)
515 /* The last pair of ()/[] is the register, all other are the
516 reloc displacement, and if there is a register then it ought
517 to have a pair of ()/[]
518 This is not necessarily true, what if the load instruction come
519 without the register and with %hi/%lo modifier? */
520 for (idx = 0; idx < 72 && ptr[idx] != '\0'; idx++)
526 as_bad (_("Bad operand for a load instruction: <%s>"), str);
533 char rs1[7], rd[7], endm, match = '0';
548 /* No register indicated, fill in zero. */
559 /* Searching for (/[ which will match the ]/). */
560 for (pb = idx - 1; str[pb] != match; pb -= 1)
561 /* Match can only be either '[' or '(', if it is
562 '(' then this can be a normal expression, we'll treat
564 if (str[pb] == endm || pb < (idx - 5))
568 for (i = 0; (pb + i) < idx; i++)
573 if (is_ldst_registers (& rs1[0]))
574 /* Point to the last character of the imm. */
580 goto badoperand_load;
581 /* No register indicated, fill in zero and restore the imm. */
589 /* Duplicate the first register. */
590 for (i = 0; i < 7 && str[i] != ','; i++)
594 goto badoperand_load;
600 /* Put the '\0' back in. */
603 for (i++, m2 = 0; i < pb; m2++,i++)
608 /* Assemble the instruction to gas internal format. */
609 for (i = 0; rd[i] != '\0'; i++)
614 for (pb = 0 ; rs1[pb] != '\0'; i++, pb++)
619 for (pb = 0; imm[pb] != '\0'; i++, pb++)
628 dlx_parse_storeop (str)
634 /* Search for the ','. */
635 for (idx = 0; idx < 72 && ptr[idx] != ','; idx++)
641 as_bad (_("Bad operand for a store instruction: <%s>"), str);
646 /* idx now points to the ','. */
650 char rs1[7], rd[7], endm, match = '0';
653 /* Now parse the '(' and ')', and make idx point to ')'. */
666 /* No register indicated, fill in zero. */
677 /* Searching for (/[ which will match the ]/). */
678 for (pb = idx - 1; str[pb] != match; pb -= 1)
679 if (pb < (idx - 5) || str[pb] == endm)
683 for (i = 0; (pb + i) < idx; i++)
684 rs1[i] = str[pb + i];
688 if (is_ldst_registers (& rs1[0]))
689 /* Point to the last character of the imm. */
695 goto badoperand_store;
697 /* No register indicated, fill in zero and restore the imm. */
705 /* No register was specified. */
708 /* Duplicate the first register. */
709 for (i = comma + 1; (str[i] == ' ' || str[i] == '\t'); i++)
712 for (m2 = 0; (m2 < 7 && str[i] != '\0'); i++, m2++)
714 if (str[i] != ' ' && str[i] != '\t')
717 goto badoperand_store;
721 goto badoperand_store;
726 for (i = 0; i < pb; i++)
731 /* Assemble the instruction to gas internal format. */
732 for (i = 0; rd[i] != '\0'; i++)
735 for (pb = 0 ; rs1[pb] != '\0'; i++, pb++)
738 for (pb = 0; imm[pb] != '\0'; i++, pb++)
746 fix_ld_st_operand (opcode, str)
747 unsigned long opcode;
750 /* Check the opcode. */
751 switch ((int) opcode)
761 return dlx_parse_loadop (str);
765 return dlx_parse_storeop (str);
771 /* Instruction parsing. Takes a string containing the opcode.
772 Operands are at input_line_pointer. Output is in the_insn.
773 Warnings or errors are generated. */
781 struct machine_opcode *insn;
783 unsigned long opcode;
784 expressionS the_operand;
785 expressionS *operand = &the_operand;
786 unsigned int reg, reg_shift = 0;
788 /* Fixup the opcode string to all lower cases, and also
789 allow numerical digits. */
793 for (; ISALNUM (*s); ++s)
802 /* FIXME-SOMEDAY more whitespace. */
808 as_bad (_("Unknown opcode: `%s'"), str);
812 /* Hash the opcode, insn will have the string from opcode table.
813 also initialized the_insn struct. */
814 if ((insn = (struct machine_opcode *) hash_find (op_hash, str)) == NULL)
816 /* Handle the ret and return macro here. */
817 if ((strcmp (str, "ret") == 0) || (strcmp (str, "return") == 0))
819 memset (&the_insn, '\0', sizeof (the_insn));
820 the_insn.reloc = NO_RELOC;
823 (unsigned long)(JROP | 0x03e00000); /* 0x03e00000 = r31 << 21 */
826 as_bad (_("Unknown opcode `%s'."), str);
832 opcode = insn->opcode;
833 memset (&the_insn, '\0', sizeof (the_insn));
834 the_insn.reloc = NO_RELOC;
837 /* Set the sip reloc HI16 flag. */
838 if (!set_dlx_skip_hi16_flag (1))
839 as_bad (_("Can not set dlx_skip_hi16_flag"));
841 /* Fix the operand string if it is one of load store instructions. */
842 s = fix_ld_st_operand (opcode, s);
844 /* Build the opcode, checking as we go to make sure that the
846 If an operand matches, we modify the_insn or opcode appropriately,
847 and do a "continue". If an operand fails to match, we "break". */
848 if (insn->args[0] != '\0' && insn->args[0] != 'N')
850 /* Prime the pump. */
853 as_bad (_("Missing arguments for opcode <%s>."), str);
857 s = parse_operand (s, operand);
859 else if (insn->args[0] == 'N')
861 /* Clean up the insn and done! */
862 the_insn.opcode = opcode;
866 /* Parse through the args (this is from opcode table), *s point to
867 the current character of the instruction stream. */
868 for (args = insn->args;; ++args)
877 /* We are truly done. */
878 the_insn.opcode = opcode;
879 /* Clean up the HI and LO mark. */
887 as_bad (_("Too many operands: %s"), s);
890 /* ',' Args separator */
892 /* Must match a comma. */
895 /* Parse next operand. */
896 s = parse_operand (s, operand);
901 /* It can be a 'a' register or 'i' operand. */
903 /* Macro move operand/reg. */
904 if (operand->X_op == O_register)
906 /* Its a register. */
911 /* The immediate 16 bits literal, bit 0-15. */
913 /* offset, unsigned. */
915 /* offset, signed. */
916 if (operand->X_op == O_constant)
919 operand->X_add_number >>= 16;
921 opcode |= operand->X_add_number & 0xFFFF;
923 if (the_insn.HI && the_insn.LO)
924 as_bad (_("Both the_insn.HI and the_insn.LO are set : %s"), s);
933 the_insn.reloc = (the_insn.HI) ? RELOC_DLX_HI16
934 : (the_insn.LO ? RELOC_DLX_LO16 : RELOC_DLX_16);
935 the_insn.reloc_offset = 2;
938 the_insn.exp = * operand;
944 /* offset, signed. */
945 if (operand->X_op == O_constant)
947 opcode |= operand->X_add_number & 0xFFFF;
950 the_insn.reloc = RELOC_DLX_REL16;
951 the_insn.reloc_offset = 0; /* BIG-ENDIAN Byte 3 of insn. */
954 the_insn.exp = *operand;
957 /* The immediate 26 bits literal, bit 0-25. */
959 /* offset, signed. */
960 if (operand->X_op == O_constant)
962 opcode |= operand->X_add_number & 0x3FFFFFF;
965 the_insn.reloc = RELOC_DLX_REL26;
966 the_insn.reloc_offset = 0; /* BIG-ENDIAN Byte 3 of insn. */
969 the_insn.exp = *operand;
972 /* Type 'a' Register. */
974 /* A general register at bits 21-25, rs1. */
975 know (operand->X_op != O_register);
979 /* Type 'b' Register. */
981 /* A general register at bits 16-20, rs2/rd. */
982 know (operand->X_op != O_register);
986 /* Type 'c' Register. */
988 /* A general register at bits 11-15, rd. */
989 know (operand->X_op != O_register);
993 know (operand->X_add_symbol == 0);
994 know (operand->X_op_symbol == 0);
995 reg = operand->X_add_number;
996 if (reg & 0xffffffe0)
997 as_fatal (_("failed regnum sanity check."));
999 /* Got the register, now figure out where it goes in the opcode. */
1000 opcode |= reg << reg_shift;
1010 as_fatal (_("failed general register sanity check."));
1017 /* Types or values of args don't match. */
1018 as_bad ("Invalid operands");
1023 /* This is identical to the md_atof in m68k.c. I think this is right,
1026 Turn a string in input_line_pointer into a floating point constant
1027 of type TYPE, and store the appropriate bytes in *LITP. The number
1028 of LITTLENUMS emitted is stored in *SIZEP. An error message is
1029 returned, or NULL on OK. */
1030 /* Dlx will not use it anyway, so I just leave it here for now. */
1032 /* Equal to MAX_PRECISION in atof-ieee.c. */
1033 #define MAX_LITTLENUMS 6
1036 md_atof (type, litP, sizeP)
1042 LITTLENUM_TYPE words[MAX_LITTLENUMS];
1043 LITTLENUM_TYPE *wordP;
1074 return "Bad call to MD_ATOF()";
1077 t = atof_ieee (input_line_pointer, type, words);
1079 input_line_pointer = t;
1081 *sizeP = prec * sizeof (LITTLENUM_TYPE);
1083 for (wordP = words; prec--;)
1085 md_number_to_chars (litP, (valueT) (*wordP++), sizeof (LITTLENUM_TYPE));
1086 litP += sizeof (LITTLENUM_TYPE);
1092 /* Write out big-endian. */
1094 md_number_to_chars (buf, val, n)
1099 number_to_chars_bigendian (buf, val, n);
1102 /* md_chars_to_number: convert from target byte order to host byte order. */
1105 md_chars_to_number (val, n)
1106 unsigned char *val; /* Value in target byte order. */
1107 int n; /* Number of bytes in the input. */
1111 for (retval = 0; n--;)
1121 md_dlx_fix_adjustable (fixP)
1124 /* We need the symbol name for the VTABLE entries. */
1125 return (fixP->fx_r_type != BFD_RELOC_VTABLE_INHERIT
1126 && fixP->fx_r_type != BFD_RELOC_VTABLE_ENTRY);
1130 md_apply_fix3 (fixP, valP, seg)
1133 segT seg ATTRIBUTE_UNUSED;
1136 char *place = fixP->fx_where + fixP->fx_frag->fr_literal;
1138 know (fixP->fx_size == 4);
1139 know (fixP->fx_r_type < NO_RELOC);
1141 switch (fixP->fx_r_type)
1143 case RELOC_DLX_LO16:
1144 case RELOC_DLX_REL16:
1145 if (fixP->fx_bit_fixP != (bit_fixS *) NULL)
1147 val = (val & 0x0000FFFF) | fixP->fx_bit_fixP->fx_bit_base;
1148 free (fixP->fx_bit_fixP);
1149 fixP->fx_bit_fixP = (bit_fixS *) NULL;
1153 know ((fixP->fx_bit_fixP != (bit_fixS *) NULL));
1157 case RELOC_DLX_HI16:
1158 if (fixP->fx_bit_fixP != (bit_fixS *) NULL)
1160 val = (val >> 16) | fixP->fx_bit_fixP->fx_bit_base;
1161 free (fixP->fx_bit_fixP);
1162 fixP->fx_bit_fixP = (bit_fixS *)NULL;
1166 know ((fixP->fx_bit_fixP != (bit_fixS *) NULL));
1170 case RELOC_DLX_REL26:
1171 if (fixP->fx_bit_fixP != (bit_fixS *) NULL)
1173 val = (val & 0x03FFFFFF) | fixP->fx_bit_fixP->fx_bit_base;
1174 free (fixP->fx_bit_fixP);
1175 fixP->fx_bit_fixP = (bit_fixS *) NULL;
1179 know ((fixP->fx_bit_fixP != (bit_fixS *) NULL));
1183 case BFD_RELOC_VTABLE_INHERIT:
1184 /* This borrowed from tc-ppc.c on a whim. */
1187 && !S_IS_DEFINED (fixP->fx_addsy)
1188 && !S_IS_WEAK (fixP->fx_addsy))
1189 S_SET_WEAK (fixP->fx_addsy);
1192 case BFD_RELOC_VTABLE_ENTRY:
1200 number_to_chars_bigendian (place, val, fixP->fx_size);
1201 if (fixP->fx_addsy == NULL)
1205 const char *md_shortopts = "";
1207 struct option md_longopts[] =
1209 {NULL, no_argument, NULL, 0}
1212 size_t md_longopts_size = sizeof (md_longopts);
1215 md_parse_option (c, arg)
1216 int c ATTRIBUTE_UNUSED;
1217 char *arg ATTRIBUTE_UNUSED;
1223 md_show_usage (stream)
1224 FILE *stream ATTRIBUTE_UNUSED;
1228 /* This is called when a line is unrecognized. */
1231 dlx_unrecognized_line (c)
1237 if (c != '$' || ! ISDIGIT ((unsigned char) input_line_pointer[0]))
1240 s = input_line_pointer;
1243 while (ISDIGIT ((unsigned char) *s))
1245 lab = lab * 10 + *s - '0';
1251 /* Not a label definition. */
1255 if (dollar_label_defined (lab))
1257 as_bad (_("label \"$%d\" redefined"), lab);
1261 define_dollar_label (lab);
1262 colon (dollar_label_name (lab, 0));
1263 input_line_pointer = s + 1;
1268 /* Default the values of symbols known that should be "predefined". We
1269 don't bother to predefine them unless you actually use one, since there
1270 are a lot of them. */
1273 md_undefined_symbol (name)
1274 char *name ATTRIBUTE_UNUSED;
1280 /* Parse an operand that is machine-specific, the function was called
1281 in expr.c by operand() function, when everything failed before it
1285 md_operand (expressionP)
1286 expressionS* expressionP;
1288 /* Check for the #number representation */
1289 if (input_line_pointer[0] == '#' &&
1290 ISDIGIT ((unsigned char) input_line_pointer[1]))
1292 /* We have a numeric number expression. No biggy. */
1293 input_line_pointer += 1; /* Skip # */
1295 (void) expression (expressionP);
1297 if (expressionP->X_op != O_constant)
1298 as_bad (_("Invalid expression after # number\n"));
1304 /* Round up a section size to the appropriate boundary. */
1307 md_section_align (segment, size)
1308 segT segment ATTRIBUTE_UNUSED;
1311 /* Byte alignment is fine. */
1315 /* Exactly what point is a PC-relative offset relative TO?
1316 On the 29000, they're relative to the address of the instruction,
1317 which we have set up as the address of the fixup too. */
1320 md_pcrel_from (fixP)
1323 return 4 + fixP->fx_where + fixP->fx_frag->fr_address;
1326 /* Translate internal representation of relocation info to BFD target
1328 FIXME: To what extent can we get all relevant targets to use this?
1329 The above FIXME is from a29k, but I think it is also needed here. */
1332 tc_gen_reloc (section, fixP)
1333 asection *section ATTRIBUTE_UNUSED;
1338 reloc = (arelent *) xmalloc (sizeof (arelent));
1339 reloc->howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type);
1341 if (reloc->howto == (reloc_howto_type *) NULL)
1343 as_bad_where (fixP->fx_file, fixP->fx_line,
1344 "internal error: can't export reloc type %d (`%s')",
1346 bfd_get_reloc_code_name (fixP->fx_r_type));
1350 assert (!fixP->fx_pcrel == !reloc->howto->pc_relative);
1352 reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
1353 *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
1354 reloc->address = fixP->fx_frag->fr_address + fixP->fx_where;
1356 if (fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
1357 reloc->address = fixP->fx_offset;
1363 extern void pop_insert PARAMS ((const pseudo_typeS *));
1368 pop_insert (dlx_pseudo_table);