1 /* tc-h8300.c -- Assemble code for the Hitachi H8/300
2 Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 2000
3 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 2, 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, 59 Temple Place - Suite 330, Boston, MA
22 /* Written By Steve Chamberlain <sac@cygnus.com>. */
29 #define h8_opcodes ops
30 #include "opcode/h8300.h"
33 const char comment_chars
[] = ";";
34 const char line_comment_chars
[] = "#";
35 const char line_separator_chars
[] = "";
37 /* This table describes all the machine specific pseudo-ops the assembler
38 has to support. The fields are:
39 pseudo-op name without dot
40 function to call to execute this pseudo-op
41 Integer arg to pass to the function
48 #define PSIZE (Hmode ? L_32 : L_16)
50 #define DSYMMODE (Hmode ? L_24 : L_16)
51 int bsize
= L_8
; /* default branch displacement */
80 const pseudo_typeS md_pseudo_table
[] =
82 {"h8300h", h8300hmode
, 0},
83 {"h8300s", h8300smode
, 0},
84 {"sbranch", sbranch
, L_8
},
85 {"lbranch", sbranch
, L_16
},
91 {"form", listing_psize
, 0},
92 {"heading", listing_title
, 0},
93 {"import", s_ignore
, 0},
94 {"page", listing_eject
, 0},
95 {"program", s_ignore
, 0},
99 const int md_reloc_size
;
101 const char EXP_CHARS
[] = "eE";
103 /* Chars that mean this number is a floating point constant */
106 const char FLT_CHARS
[] = "rRsSfFdDxXpP";
108 static struct hash_control
*opcode_hash_control
; /* Opcode mnemonics */
110 /* This function is called once, at assembler startup time. This
111 should set up all the tables, etc. that the MD part of the assembler
116 struct h8_opcode
*opcode
;
117 char prev_buffer
[100];
120 opcode_hash_control
= hash_new ();
123 for (opcode
= h8_opcodes
; opcode
->name
; opcode
++)
125 /* Strip off any . part when inserting the opcode and only enter
126 unique codes into the hash table. */
127 char *src
= opcode
->name
;
128 unsigned int len
= strlen (src
);
129 char *dst
= malloc (len
+ 1);
144 if (strcmp (buffer
, prev_buffer
))
146 hash_insert (opcode_hash_control
, buffer
, (char *) opcode
);
147 strcpy (prev_buffer
, buffer
);
152 /* Find the number of operands. */
153 opcode
->noperands
= 0;
154 while (opcode
->args
.nib
[opcode
->noperands
] != E
)
157 /* Find the length of the opcode in bytes. */
159 while (opcode
->data
.nib
[opcode
->length
* 2] != E
)
174 int opsize
; /* Set when a register size is seen */
185 WREG r0,r1,r2,r3,r4,r5,r6,r7,fp,sp
194 /* Try to parse a reg name. Return the number of chars consumed. */
197 parse_reg (src
, mode
, reg
, direction
)
207 /* Cribbed from get_symbol_end. */
208 if (!is_name_beginner (*src
) || *src
== '\001')
211 while (is_part_of_name (*end
) || *end
== '\001')
215 if (len
== 2 && src
[0] == 's' && src
[1] == 'p')
217 *mode
= PSIZE
| REG
| direction
;
221 if (len
== 3 && src
[0] == 'c' && src
[1] == 'c' && src
[2] == 'r')
227 if (len
== 3 && src
[0] == 'e' && src
[1] == 'x' && src
[2] == 'r')
233 if (len
== 2 && src
[0] == 'f' && src
[1] == 'p')
235 *mode
= PSIZE
| REG
| direction
;
239 if (len
== 3 && src
[0] == 'e' && src
[1] == 'r'
240 && src
[2] >= '0' && src
[2] <= '7')
242 *mode
= L_32
| REG
| direction
;
245 as_warn (_("Reg not valid for H8/300"));
248 if (len
== 2 && src
[0] == 'e' && src
[1] >= '0' && src
[1] <= '7')
250 *mode
= L_16
| REG
| direction
;
251 *reg
= src
[1] - '0' + 8;
253 as_warn (_("Reg not valid for H8/300"));
259 if (src
[1] >= '0' && src
[1] <= '7')
261 if (len
== 3 && src
[2] == 'l')
263 *mode
= L_8
| REG
| direction
;
264 *reg
= (src
[1] - '0') + 8;
267 if (len
== 3 && src
[2] == 'h')
269 *mode
= L_8
| REG
| direction
;
270 *reg
= (src
[1] - '0');
275 *mode
= L_16
| REG
| direction
;
276 *reg
= (src
[1] - '0');
290 char *save
= input_line_pointer
;
293 input_line_pointer
= s
;
295 if (op
->X_op
== O_absent
)
296 as_bad (_("missing operand"));
297 new = input_line_pointer
;
298 input_line_pointer
= save
;
303 skip_colonthing (ptr
, exp
, mode
)
305 expressionS
*exp ATTRIBUTE_UNUSED
;
315 /* ff fill any 8 bit quantity */
316 /* exp->X_add_number -= 0x100; */
325 else if (*ptr
== '3')
329 else if (*ptr
== '1')
333 while (isdigit (*ptr
))
340 /* The many forms of operand:
343 @Rn Register indirect
344 @(exp[:16], Rn) Register indirect with displacement
348 @aa:16 absolute 16 bit
351 #xx[:size] immediate data
352 @(exp:[8], pc) pc rel
353 @@aa[:8] memory indirect
364 src
= skip_colonthing (src
, &op
->exp
, &mode
);
368 /* Choose a default mode. */
369 if (op
->exp
.X_add_number
< -32768
370 || op
->exp
.X_add_number
> 32767)
377 else if (op
->exp
.X_add_symbol
378 || op
->exp
.X_op_symbol
)
389 get_operand (ptr
, op
, dst
, direction
)
392 unsigned int dst ATTRIBUTE_UNUSED
;
402 /* Gross. Gross. ldm and stm have a format not easily handled
403 by get_operand. We deal with it explicitly here. */
404 if (src
[0] == 'e' && src
[1] == 'r' && isdigit (src
[2])
405 && src
[3] == '-' && src
[4] == 'e' && src
[5] == 'r' && isdigit (src
[6]))
413 as_bad (_("Invalid register list for ldm/stm\n"));
416 as_bad (_("Invalid register list for ldm/stm\n"));
419 as_bad (_("Invalid register list for ldm/stm\n"));
423 as_bad (_("Invalid register list for ldm/stm\n"));
425 /* Even sicker. We encode two registers into op->reg. One
426 for the low register to save, the other for the high
427 register to save; we also set the high bit in op->reg
428 so we know this is "very special". */
429 op
->reg
= 0x80000000 | (high
<< 8) | low
;
435 len
= parse_reg (src
, &op
->mode
, &op
->reg
, direction
);
448 src
= parse_exp (src
, &op
->exp
);
450 src
= skip_colonthing (src
, &op
->exp
, &op
->mode
);
461 len
= parse_reg (src
, &mode
, &num
, direction
);
464 /* Oops, not a reg after all, must be ordinary exp. */
466 /* Must be a symbol. */
467 op
->mode
= ABS
| PSIZE
| direction
;
468 *ptr
= skip_colonthing (parse_exp (src
, &op
->exp
),
469 &op
->exp
, &op
->mode
);
474 if ((mode
& SIZE
) != PSIZE
)
475 as_bad (_("Wrong size pointer register for architecture."));
486 /* Start off assuming a 16 bit offset. */
488 src
= parse_exp (src
, &op
->exp
);
490 src
= colonmod24 (op
, src
);
495 op
->mode
|= ABS
| direction
;
502 as_bad (_("expected @(exp, reg16)"));
508 len
= parse_reg (src
, &mode
, &op
->reg
, direction
);
509 if (len
== 0 || !(mode
& REG
))
511 as_bad (_("expected @(exp, reg16)"));
514 op
->mode
|= DISP
| direction
;
517 src
= skip_colonthing (src
, &op
->exp
, &op
->mode
);
519 if (*src
!= ')' && '(')
521 as_bad (_("expected @(exp, reg16)"));
528 len
= parse_reg (src
, &mode
, &num
, direction
);
536 if ((mode
& SIZE
) != PSIZE
)
537 as_bad (_("Wrong size pointer register for architecture."));
543 if ((mode
& SIZE
) != PSIZE
)
544 as_bad (_("Wrong size pointer register for architecture."));
546 op
->mode
= direction
| IND
| PSIZE
;
554 /* must be a symbol */
556 op
->mode
= ABS
| direction
;
557 src
= parse_exp (src
, &op
->exp
);
559 *ptr
= colonmod24 (op
, src
);
569 src
= parse_exp (src
, &op
->exp
);
570 *ptr
= skip_colonthing (src
, &op
->exp
, &op
->mode
);
574 else if (strncmp (src
, "mach", 4) == 0
575 || strncmp (src
, "macl", 4) == 0)
577 op
->reg
= src
[3] == 'l';
584 src
= parse_exp (src
, &op
->exp
);
585 /* Trailing ':' size ? */
588 if (src
[1] == '1' && src
[2] == '6')
590 op
->mode
= PCREL
| L_16
;
593 else if (src
[1] == '8')
595 op
->mode
= PCREL
| L_8
;
600 as_bad (_("expect :8 or :16 here"));
605 op
->mode
= PCREL
| bsize
;
612 get_operands (noperands
, op_end
, operand
)
613 unsigned int noperands
;
615 struct h8_op
*operand
;
628 get_operand (&ptr
, operand
+ 0, 0, SRC
);
632 get_operand (&ptr
, operand
+ 1, 1, DST
);
642 get_operand (&ptr
, operand
+ 0, 0, SRC
);
645 get_operand (&ptr
, operand
+ 1, 1, DST
);
655 /* Passed a pointer to a list of opcodes which use different
656 addressing modes, return the opcode which matches the opcodes
658 static struct h8_opcode
*
659 get_specific (opcode
, operands
, size
)
660 struct h8_opcode
*opcode
;
661 struct h8_op
*operands
;
664 struct h8_opcode
*this_try
= opcode
;
667 unsigned int this_index
= opcode
->idx
;
669 /* There's only one ldm/stm and it's easier to just
670 get out quick for them. */
671 if (strcmp (opcode
->name
, "stm.l") == 0
672 || strcmp (opcode
->name
, "ldm.l") == 0)
675 while (this_index
== opcode
->idx
&& !found
)
680 if (this_try
->noperands
== 0)
684 this_size
= this_try
->how
& SN
;
685 if (this_size
!= size
&& (this_size
!= SB
|| size
!= SN
))
692 for (i
= 0; i
< this_try
->noperands
&& found
; i
++)
694 op_type op
= this_try
->args
.nib
[i
];
695 int x
= operands
[i
].mode
;
697 if ((op
& (DISP
| REG
)) == (DISP
| REG
)
698 && ((x
& (DISP
| REG
)) == (DISP
| REG
)))
700 dispreg
= operands
[i
].reg
;
708 x
= (x
& ~L_P
) | (Hmode
? L_32
: L_16
);
710 op
= (op
& ~L_P
) | (Hmode
? L_32
: L_16
);
714 /* The size of the reg is v important. */
715 if ((op
& SIZE
) != (x
& SIZE
))
718 else if ((op
& ABSJMP
) && (x
& ABS
))
720 operands
[i
].mode
&= ~ABS
;
721 operands
[i
].mode
|= ABSJMP
;
722 /* But it may not be 24 bits long. */
725 operands
[i
].mode
&= ~SIZE
;
726 operands
[i
].mode
|= L_16
;
729 else if ((op
& (KBIT
| DBIT
)) && (x
& IMM
))
731 /* This is ok if the immediate value is sensible. */
735 /* The size of the displacement is important. */
736 if ((op
& SIZE
) != (x
& SIZE
))
739 else if ((op
& (DISP
| IMM
| ABS
))
740 && (op
& (DISP
| IMM
| ABS
)) == (x
& (DISP
| IMM
| ABS
)))
742 /* Promote a L_24 to L_32 if it makes us match. */
743 if ((x
& L_24
) && (op
& L_32
))
748 /* Promote an L8 to L_16 if it makes us match. */
749 if (op
& ABS
&& op
& L_8
&& op
& DISP
)
754 else if ((x
& SIZE
) != 0
755 && ((op
& SIZE
) != (x
& SIZE
)))
758 else if ((op
& MACREG
) != (x
& MACREG
))
762 else if ((op
& MODE
) != (x
& MODE
))
776 check_operand (operand
, width
, string
)
777 struct h8_op
*operand
;
781 if (operand
->exp
.X_add_symbol
== 0
782 && operand
->exp
.X_op_symbol
== 0)
784 /* No symbol involved, let's look at offset, it's dangerous if
785 any of the high bits are not 0 or ff's, find out by oring or
786 anding with the width and seeing if the answer is 0 or all
789 if ((operand
->exp
.X_add_number
& ~width
) != 0 &&
790 (operand
->exp
.X_add_number
| width
) != (~0))
793 && (operand
->exp
.X_add_number
& 0xff00) == 0xff00)
795 /* Just ignore this one - which happens when trying to
796 fit a 16 bit address truncated into an 8 bit address
797 of something like bset. */
801 as_warn (_("operand %s0x%lx out of range."), string
,
802 (unsigned long) operand
->exp
.X_add_number
);
808 /* RELAXMODE has one of 3 values:
810 0 Output a "normal" reloc, no relaxing possible for this insn/reloc
812 1 Output a relaxable 24bit absolute mov.w address relocation
813 (may relax into a 16bit absolute address).
815 2 Output a relaxable 16/24 absolute mov.b address relocation
816 (may relax into an 8bit absolute address). */
819 do_a_fix_imm (offset
, operand
, relaxmode
)
821 struct h8_op
*operand
;
828 char *t
= operand
->mode
& IMM
? "#" : "@";
830 if (operand
->exp
.X_add_symbol
== 0)
832 char *bytes
= frag_now
->fr_literal
+ offset
;
833 switch (operand
->mode
& SIZE
)
836 check_operand (operand
, 0x3, t
);
837 bytes
[0] |= (operand
->exp
.X_add_number
) << 4;
840 check_operand (operand
, 0x7, t
);
841 bytes
[0] |= (operand
->exp
.X_add_number
) << 4;
844 check_operand (operand
, 0xff, t
);
845 bytes
[0] = operand
->exp
.X_add_number
;
848 check_operand (operand
, 0xffff, t
);
849 bytes
[0] = operand
->exp
.X_add_number
>> 8;
850 bytes
[1] = operand
->exp
.X_add_number
>> 0;
853 check_operand (operand
, 0xffffff, t
);
854 bytes
[0] = operand
->exp
.X_add_number
>> 16;
855 bytes
[1] = operand
->exp
.X_add_number
>> 8;
856 bytes
[2] = operand
->exp
.X_add_number
>> 0;
860 /* This should be done with bfd. */
861 bytes
[0] = operand
->exp
.X_add_number
>> 24;
862 bytes
[1] = operand
->exp
.X_add_number
>> 16;
863 bytes
[2] = operand
->exp
.X_add_number
>> 8;
864 bytes
[3] = operand
->exp
.X_add_number
>> 0;
867 idx
= (relaxmode
== 2) ? R_MOV24B1
: R_MOVL1
;
868 fix_new_exp (frag_now
, offset
, 4, &operand
->exp
, 0, idx
);
875 switch (operand
->mode
& SIZE
)
880 where
= (operand
->mode
& SIZE
) == L_24
? -1 : 0;
883 else if (relaxmode
== 1)
889 as_bad (_("Can't work out size of operand.\n"));
897 operand
->exp
.X_add_number
=
898 ((operand
->exp
.X_add_number
& 0xffff) ^ 0x8000) - 0x8000;
904 operand
->exp
.X_add_number
=
905 ((operand
->exp
.X_add_number
& 0xff) ^ 0x80) - 0x80;
908 fix_new_exp (frag_now
,
917 /* Now we know what sort of opcodes it is, let's build the bytes. */
919 build_bytes (this_try
, operand
)
920 struct h8_opcode
*this_try
;
921 struct h8_op
*operand
;
925 char *output
= frag_more (this_try
->length
);
926 op_type
*nibble_ptr
= this_try
->data
.nib
;
928 unsigned int nibble_count
= 0;
936 if (!(this_try
->inbase
|| Hmode
))
937 as_warn (_("Opcode `%s' with these operand types not available in H8/300 mode"),
940 while (*nibble_ptr
!= E
)
945 d
= (c
& (DST
| SRC_IN_DST
)) != 0;
953 if (c
& (REG
| IND
| INC
| DEC
))
955 nib
= operand
[d
].reg
;
957 else if ((c
& DISPREG
) == (DISPREG
))
964 absat
= nibble_count
/ 2;
967 else if (c
& (IMM
| PCREL
| ABS
| ABSJMP
| DISP
))
970 immat
= nibble_count
/ 2;
979 switch (operand
[0].exp
.X_add_number
)
988 as_bad (_("Need #1 or #2 here"));
993 switch (operand
[0].exp
.X_add_number
)
1003 as_warn (_("#4 not valid on H8/300."));
1008 as_bad (_("Need #1 or #2 here"));
1011 /* Stop it making a fix. */
1012 operand
[0].mode
= 0;
1017 operand
[d
].mode
|= MEMRELAX
;
1027 if (operand
[0].mode
== MACREG
)
1028 /* stmac has mac[hl] as the first operand. */
1029 nib
= 2 + operand
[0].reg
;
1031 /* ldmac has mac[hl] as the second operand. */
1032 nib
= 2 + operand
[1].reg
;
1040 /* Disgusting. Why, oh why didn't someone ask us for advice
1041 on the assembler format. */
1042 if (strcmp (this_try
->name
, "stm.l") == 0
1043 || strcmp (this_try
->name
, "ldm.l") == 0)
1046 high
= (operand
[this_try
->name
[0] == 'l' ? 1 : 0].reg
>> 8) & 0xf;
1047 low
= operand
[this_try
->name
[0] == 'l' ? 1 : 0].reg
& 0xf;
1049 asnibbles
[2] = high
- low
;
1050 asnibbles
[7] = (this_try
->name
[0] == 'l') ? high
: low
;
1053 for (i
= 0; i
< this_try
->length
; i
++)
1055 output
[i
] = (asnibbles
[i
* 2] << 4) | asnibbles
[i
* 2 + 1];
1058 /* Note if this is a movb instruction -- there's a special relaxation
1059 which only applies to them. */
1060 if (strcmp (this_try
->name
, "mov.b") == 0)
1063 /* Output any fixes. */
1064 for (i
= 0; i
< 2; i
++)
1066 int x
= operand
[i
].mode
;
1068 if (x
& (IMM
| DISP
))
1070 do_a_fix_imm (output
- frag_now
->fr_literal
+ immat
,
1071 operand
+ i
, x
& MEMRELAX
!= 0);
1075 do_a_fix_imm (output
- frag_now
->fr_literal
+ absat
,
1076 operand
+ i
, x
& MEMRELAX
? movb
+ 1 : 0);
1080 int size16
= x
& L_16
;
1081 int where
= size16
? 2 : 1;
1082 int size
= size16
? 2 : 1;
1083 int type
= size16
? R_PCRWORD
: R_PCRBYTE
;
1085 check_operand (operand
+ i
, size16
? 0x7fff : 0x7f, "@");
1087 if (operand
[i
].exp
.X_add_number
& 1)
1089 as_warn (_("branch operand has odd offset (%lx)\n"),
1090 (unsigned long) operand
->exp
.X_add_number
);
1093 operand
[i
].exp
.X_add_number
-= 1;
1094 operand
[i
].exp
.X_add_number
=
1095 ((operand
[i
].exp
.X_add_number
& 0xff) ^ 0x80) - 0x80;
1097 fix_new_exp (frag_now
,
1098 output
- frag_now
->fr_literal
+ where
,
1104 else if (x
& MEMIND
)
1106 check_operand (operand
+ i
, 0xff, "@@");
1107 fix_new_exp (frag_now
,
1108 output
- frag_now
->fr_literal
+ 1,
1114 else if (x
& ABSJMP
)
1116 /* This jmp may be a jump or a branch. */
1118 check_operand (operand
+ i
, Hmode
? 0xffffff : 0xffff, "@");
1119 if (operand
[i
].exp
.X_add_number
& 1)
1121 as_warn (_("branch operand has odd offset (%lx)\n"),
1122 (unsigned long) operand
->exp
.X_add_number
);
1125 operand
[i
].exp
.X_add_number
=
1126 ((operand
[i
].exp
.X_add_number
& 0xffff) ^ 0x8000) - 0x8000;
1127 fix_new_exp (frag_now
,
1128 output
- frag_now
->fr_literal
,
1137 /* Try to give an intelligent error message for common and simple to
1140 clever_message (opcode
, operand
)
1141 struct h8_opcode
*opcode
;
1142 struct h8_op
*operand
;
1144 /* Find out if there was more than one possible opcode. */
1146 if ((opcode
+ 1)->idx
!= opcode
->idx
)
1150 /* Only one opcode of this flavour, try to guess which operand
1152 for (argn
= 0; argn
< opcode
->noperands
; argn
++)
1154 switch (opcode
->args
.nib
[argn
])
1157 if (operand
[argn
].mode
!= RD16
)
1159 as_bad (_("destination operand must be 16 bit register"));
1166 if (operand
[argn
].mode
!= RS8
)
1168 as_bad (_("source operand must be 8 bit register"));
1174 if (operand
[argn
].mode
!= ABS16DST
)
1176 as_bad (_("destination operand must be 16bit absolute address"));
1181 if (operand
[argn
].mode
!= RD8
)
1183 as_bad (_("destination operand must be 8 bit register"));
1189 if (operand
[argn
].mode
!= ABS16SRC
)
1191 as_bad (_("source operand must be 16bit absolute address"));
1199 as_bad (_("invalid operands"));
1202 /* This is the guts of the machine-dependent assembler. STR points to
1203 a machine dependent instruction. This function is supposed to emit
1204 the frags/bytes it assembles. */
1211 struct h8_op operand
[2];
1212 struct h8_opcode
*opcode
;
1213 struct h8_opcode
*prev_opcode
;
1219 /* Drop leading whitespace. */
1223 /* Find the op code end. */
1224 for (op_start
= op_end
= str
;
1225 *op_end
!= 0 && *op_end
!= ' ';
1237 if (op_end
== op_start
)
1239 as_bad (_("can't find opcode "));
1245 opcode
= (struct h8_opcode
*) hash_find (opcode_hash_control
,
1250 as_bad (_("unknown opcode"));
1254 /* We used to set input_line_pointer to the result of get_operands,
1255 but that is wrong. Our caller assumes we don't change it. */
1257 (void) get_operands (opcode
->noperands
, op_end
, operand
);
1259 prev_opcode
= opcode
;
1279 opcode
= get_specific (opcode
, operand
, size
);
1283 /* Couldn't find an opcode which matched the operands. */
1284 char *where
= frag_more (2);
1288 clever_message (prev_opcode
, operand
);
1292 if (opcode
->size
&& dot
)
1294 if (opcode
->size
!= *dot
)
1296 as_warn (_("mismatch between opcode size and operand size"));
1300 build_bytes (opcode
, operand
);
1304 tc_crawl_symbol_chain (headers
)
1305 object_headers
*headers ATTRIBUTE_UNUSED
;
1307 printf (_("call to tc_crawl_symbol_chain \n"));
1311 md_undefined_symbol (name
)
1312 char *name ATTRIBUTE_UNUSED
;
1318 tc_headers_hook (headers
)
1319 object_headers
*headers ATTRIBUTE_UNUSED
;
1321 printf (_("call to tc_headers_hook \n"));
1324 /* Various routines to kill one day */
1325 /* Equal to MAX_PRECISION in atof-ieee.c */
1326 #define MAX_LITTLENUMS 6
1328 /* Turn a string in input_line_pointer into a floating point constant
1329 of type TYPE, and store the appropriate bytes in *LITP. The number
1330 of LITTLENUMS emitted is stored in *SIZEP. An error message is
1331 returned, or NULL on OK. */
1334 md_atof (type
, litP
, sizeP
)
1340 LITTLENUM_TYPE words
[MAX_LITTLENUMS
];
1341 LITTLENUM_TYPE
*wordP
;
1373 return _("Bad call to MD_ATOF()");
1375 t
= atof_ieee (input_line_pointer
, type
, words
);
1377 input_line_pointer
= t
;
1379 *sizeP
= prec
* sizeof (LITTLENUM_TYPE
);
1380 for (wordP
= words
; prec
--;)
1382 md_number_to_chars (litP
, (long) (*wordP
++), sizeof (LITTLENUM_TYPE
));
1383 litP
+= sizeof (LITTLENUM_TYPE
);
1388 CONST
char *md_shortopts
= "";
1389 struct option md_longopts
[] = {
1390 {NULL
, no_argument
, NULL
, 0}
1393 size_t md_longopts_size
= sizeof (md_longopts
);
1396 md_parse_option (c
, arg
)
1397 int c ATTRIBUTE_UNUSED
;
1398 char *arg ATTRIBUTE_UNUSED
;
1404 md_show_usage (stream
)
1405 FILE *stream ATTRIBUTE_UNUSED
;
1410 tc_aout_fix_to_chars ()
1412 printf (_("call to tc_aout_fix_to_chars \n"));
1417 md_convert_frag (headers
, seg
, fragP
)
1418 object_headers
*headers ATTRIBUTE_UNUSED
;
1419 segT seg ATTRIBUTE_UNUSED
;
1420 fragS
*fragP ATTRIBUTE_UNUSED
;
1422 printf (_("call to md_convert_frag \n"));
1427 md_section_align (seg
, size
)
1431 return ((size
+ (1 << section_alignment
[(int) seg
]) - 1)
1432 & (-1 << section_alignment
[(int) seg
]));
1436 md_apply_fix (fixP
, val
)
1440 char *buf
= fixP
->fx_where
+ fixP
->fx_frag
->fr_literal
;
1442 switch (fixP
->fx_size
)
1448 *buf
++ = (val
>> 8);
1452 *buf
++ = (val
>> 24);
1453 *buf
++ = (val
>> 16);
1454 *buf
++ = (val
>> 8);
1463 md_estimate_size_before_relax (fragP
, segment_type
)
1464 register fragS
*fragP ATTRIBUTE_UNUSED
;
1465 register segT segment_type ATTRIBUTE_UNUSED
;
1467 printf (_("call tomd_estimate_size_before_relax \n"));
1471 /* Put number into target byte order. */
1473 md_number_to_chars (ptr
, use
, nbytes
)
1478 number_to_chars_bigendian (ptr
, use
, nbytes
);
1482 md_pcrel_from (fixP
)
1483 fixS
*fixP ATTRIBUTE_UNUSED
;
1489 tc_reloc_mangle (fix_ptr
, intr
, base
)
1491 struct internal_reloc
*intr
;
1495 symbolS
*symbol_ptr
;
1497 symbol_ptr
= fix_ptr
->fx_addsy
;
1499 /* If this relocation is attached to a symbol then it's ok
1501 if (fix_ptr
->fx_r_type
== TC_CONS_RELOC
)
1503 /* cons likes to create reloc32's whatever the size of the reloc..
1505 switch (fix_ptr
->fx_size
)
1508 intr
->r_type
= R_RELLONG
;
1511 intr
->r_type
= R_RELWORD
;
1514 intr
->r_type
= R_RELBYTE
;
1522 intr
->r_type
= fix_ptr
->fx_r_type
;
1525 intr
->r_vaddr
= fix_ptr
->fx_frag
->fr_address
+ fix_ptr
->fx_where
+ base
;
1526 intr
->r_offset
= fix_ptr
->fx_offset
;
1530 if (symbol_ptr
->sy_number
!= -1)
1531 intr
->r_symndx
= symbol_ptr
->sy_number
;
1536 /* This case arises when a reference is made to `.'. */
1537 segsym
= seg_info (S_GET_SEGMENT (symbol_ptr
))->dot
;
1539 intr
->r_symndx
= -1;
1542 intr
->r_symndx
= segsym
->sy_number
;
1543 intr
->r_offset
+= S_GET_VALUE (symbol_ptr
);
1548 intr
->r_symndx
= -1;