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
23 Written By Steve Chamberlain
32 #define h8_opcodes ops
33 #include "opcode/h8300.h"
36 const char comment_chars
[] = ";";
37 const char line_comment_chars
[] = "#";
38 const char line_separator_chars
[] = "";
40 /* This table describes all the machine specific pseudo-ops the assembler
41 has to support. The fields are:
42 pseudo-op name without dot
43 function to call to execute this pseudo-op
44 Integer arg to pass to the function
51 #define PSIZE (Hmode ? L_32 : L_16)
53 #define DSYMMODE (Hmode ? L_24 : L_16)
54 int bsize
= L_8
; /* default branch displacement */
83 const pseudo_typeS md_pseudo_table
[] =
85 {"h8300h", h8300hmode
, 0},
86 {"h8300s", h8300smode
, 0},
87 {"sbranch", sbranch
, L_8
},
88 {"lbranch", sbranch
, L_16
},
94 {"form", listing_psize
, 0},
95 {"heading", listing_title
, 0},
96 {"import", s_ignore
, 0},
97 {"page", listing_eject
, 0},
98 {"program", s_ignore
, 0},
102 const int md_reloc_size
;
104 const char EXP_CHARS
[] = "eE";
106 /* Chars that mean this number is a floating point constant */
109 const char FLT_CHARS
[] = "rRsSfFdDxXpP";
111 static struct hash_control
*opcode_hash_control
; /* Opcode mnemonics */
113 /* This function is called once, at assembler startup time. This
114 should set up all the tables, etc. that the MD part of the assembler
119 struct h8_opcode
*opcode
;
120 char prev_buffer
[100];
123 opcode_hash_control
= hash_new ();
126 for (opcode
= h8_opcodes
; opcode
->name
; opcode
++)
128 /* Strip off any . part when inserting the opcode and only enter
129 unique codes into the hash table. */
130 char *src
= opcode
->name
;
131 unsigned int len
= strlen (src
);
132 char *dst
= malloc (len
+ 1);
147 if (strcmp (buffer
, prev_buffer
))
149 hash_insert (opcode_hash_control
, buffer
, (char *) opcode
);
150 strcpy (prev_buffer
, buffer
);
155 /* Find the number of operands. */
156 opcode
->noperands
= 0;
157 while (opcode
->args
.nib
[opcode
->noperands
] != E
)
160 /* Find the length of the opcode in bytes. */
162 while (opcode
->data
.nib
[opcode
->length
* 2] != E
)
177 int opsize
; /* Set when a register size is seen */
188 WREG r0,r1,r2,r3,r4,r5,r6,r7,fp,sp
197 /* Try and parse a reg name, returns number of chars consumed. */
199 parse_reg (src
, mode
, reg
, direction
)
209 /* Cribbed from get_symbol_end. */
210 if (!is_name_beginner (*src
) || *src
== '\001')
213 while (is_part_of_name (*end
) || *end
== '\001')
217 if (len
== 2 && src
[0] == 's' && src
[1] == 'p')
219 *mode
= PSIZE
| REG
| direction
;
223 if (len
== 3 && src
[0] == 'c' && src
[1] == 'c' && src
[2] == 'r')
229 if (len
== 3 && src
[0] == 'e' && src
[1] == 'x' && src
[2] == 'r')
235 if (len
== 2 && src
[0] == 'f' && src
[1] == 'p')
237 *mode
= PSIZE
| REG
| direction
;
241 if (len
== 3 && src
[0] == 'e' && src
[1] == 'r'
242 && src
[2] >= '0' && src
[2] <= '7')
244 *mode
= L_32
| REG
| direction
;
247 as_warn (_("Reg not valid for H8/300"));
250 if (len
== 2 && src
[0] == 'e' && src
[1] >= '0' && src
[1] <= '7')
252 *mode
= L_16
| REG
| direction
;
253 *reg
= src
[1] - '0' + 8;
255 as_warn (_("Reg not valid for H8/300"));
261 if (src
[1] >= '0' && src
[1] <= '7')
263 if (len
== 3 && src
[2] == 'l')
265 *mode
= L_8
| REG
| direction
;
266 *reg
= (src
[1] - '0') + 8;
269 if (len
== 3 && src
[2] == 'h')
271 *mode
= L_8
| REG
| direction
;
272 *reg
= (src
[1] - '0');
277 *mode
= L_16
| REG
| direction
;
278 *reg
= (src
[1] - '0');
292 char *save
= input_line_pointer
;
295 input_line_pointer
= s
;
297 if (op
->X_op
== O_absent
)
298 as_bad (_("missing operand"));
299 new = input_line_pointer
;
300 input_line_pointer
= save
;
305 skip_colonthing (ptr
, exp
, mode
)
307 expressionS
*exp ATTRIBUTE_UNUSED
;
317 /* ff fill any 8 bit quantity */
318 /* exp->X_add_number -= 0x100; */
327 else if (*ptr
== '3')
331 else if (*ptr
== '1')
335 while (isdigit (*ptr
))
342 /* The many forms of operand:
345 @Rn Register indirect
346 @(exp[:16], Rn) Register indirect with displacement
350 @aa:16 absolute 16 bit
353 #xx[:size] immediate data
354 @(exp:[8], pc) pc rel
355 @@aa[:8] memory indirect
366 src
= skip_colonthing (src
, &op
->exp
, &mode
);
370 /* Choose a default mode. */
371 if (op
->exp
.X_add_number
< -32768
372 || op
->exp
.X_add_number
> 32767)
379 else if (op
->exp
.X_add_symbol
380 || op
->exp
.X_op_symbol
)
391 get_operand (ptr
, op
, dst
, direction
)
394 unsigned int dst ATTRIBUTE_UNUSED
;
404 /* Gross. Gross. ldm and stm have a format not easily handled
405 by get_operand. We deal with it explicitly here. */
406 if (src
[0] == 'e' && src
[1] == 'r' && isdigit (src
[2])
407 && src
[3] == '-' && src
[4] == 'e' && src
[5] == 'r' && isdigit (src
[6]))
415 as_bad (_("Invalid register list for ldm/stm\n"));
418 as_bad (_("Invalid register list for ldm/stm\n"));
421 as_bad (_("Invalid register list for ldm/stm\n"));
425 as_bad (_("Invalid register list for ldm/stm\n"));
427 /* Even sicker. We encode two registers into op->reg. One
428 for the low register to save, the other for the high
429 register to save; we also set the high bit in op->reg
430 so we know this is "very special". */
431 op
->reg
= 0x80000000 | (high
<< 8) | low
;
437 len
= parse_reg (src
, &op
->mode
, &op
->reg
, direction
);
450 src
= parse_exp (src
, &op
->exp
);
452 src
= skip_colonthing (src
, &op
->exp
, &op
->mode
);
463 len
= parse_reg (src
, &mode
, &num
, direction
);
466 /* Oops, not a reg after all, must be ordinary exp. */
468 /* Must be a symbol. */
469 op
->mode
= ABS
| PSIZE
| direction
;
470 *ptr
= skip_colonthing (parse_exp (src
, &op
->exp
),
471 &op
->exp
, &op
->mode
);
476 if ((mode
& SIZE
) != PSIZE
)
477 as_bad (_("Wrong size pointer register for architecture."));
488 /* Start off assuming a 16 bit offset. */
490 src
= parse_exp (src
, &op
->exp
);
492 src
= colonmod24 (op
, src
);
497 op
->mode
|= ABS
| direction
;
504 as_bad (_("expected @(exp, reg16)"));
510 len
= parse_reg (src
, &mode
, &op
->reg
, direction
);
511 if (len
== 0 || !(mode
& REG
))
513 as_bad (_("expected @(exp, reg16)"));
516 op
->mode
|= DISP
| direction
;
519 src
= skip_colonthing (src
, &op
->exp
, &op
->mode
);
521 if (*src
!= ')' && '(')
523 as_bad (_("expected @(exp, reg16)"));
530 len
= parse_reg (src
, &mode
, &num
, direction
);
538 if ((mode
& SIZE
) != PSIZE
)
539 as_bad (_("Wrong size pointer register for architecture."));
545 if ((mode
& SIZE
) != PSIZE
)
546 as_bad (_("Wrong size pointer register for architecture."));
548 op
->mode
= direction
| IND
| PSIZE
;
556 /* must be a symbol */
558 op
->mode
= ABS
| direction
;
559 src
= parse_exp (src
, &op
->exp
);
561 *ptr
= colonmod24 (op
, src
);
571 src
= parse_exp (src
, &op
->exp
);
572 *ptr
= skip_colonthing (src
, &op
->exp
, &op
->mode
);
576 else if (strncmp (src
, "mach", 4) == 0
577 || strncmp (src
, "macl", 4) == 0)
579 op
->reg
= src
[3] == 'l';
586 src
= parse_exp (src
, &op
->exp
);
587 /* Trailing ':' size ? */
590 if (src
[1] == '1' && src
[2] == '6')
592 op
->mode
= PCREL
| L_16
;
595 else if (src
[1] == '8')
597 op
->mode
= PCREL
| L_8
;
602 as_bad (_("expect :8 or :16 here"));
607 op
->mode
= PCREL
| bsize
;
614 get_operands (noperands
, op_end
, operand
)
615 unsigned int noperands
;
617 struct h8_op
*operand
;
630 get_operand (&ptr
, operand
+ 0, 0, SRC
);
634 get_operand (&ptr
, operand
+ 1, 1, DST
);
644 get_operand (&ptr
, operand
+ 0, 0, SRC
);
647 get_operand (&ptr
, operand
+ 1, 1, DST
);
657 /* Passed a pointer to a list of opcodes which use different
658 addressing modes, return the opcode which matches the opcodes
660 static struct h8_opcode
*
661 get_specific (opcode
, operands
, size
)
662 struct h8_opcode
*opcode
;
663 struct h8_op
*operands
;
666 struct h8_opcode
*this_try
= opcode
;
669 unsigned int this_index
= opcode
->idx
;
671 /* There's only one ldm/stm and it's easier to just
672 get out quick for them. */
673 if (strcmp (opcode
->name
, "stm.l") == 0
674 || strcmp (opcode
->name
, "ldm.l") == 0)
677 while (this_index
== opcode
->idx
&& !found
)
682 if (this_try
->noperands
== 0)
686 this_size
= this_try
->how
& SN
;
687 if (this_size
!= size
&& (this_size
!= SB
|| size
!= SN
))
694 for (i
= 0; i
< this_try
->noperands
&& found
; i
++)
696 op_type op
= this_try
->args
.nib
[i
];
697 int x
= operands
[i
].mode
;
699 if ((op
& (DISP
| REG
)) == (DISP
| REG
)
700 && ((x
& (DISP
| REG
)) == (DISP
| REG
)))
702 dispreg
= operands
[i
].reg
;
710 x
= (x
& ~L_P
) | (Hmode
? L_32
: L_16
);
712 op
= (op
& ~L_P
) | (Hmode
? L_32
: L_16
);
716 /* The size of the reg is v important. */
717 if ((op
& SIZE
) != (x
& SIZE
))
720 else if ((op
& ABSJMP
) && (x
& ABS
))
722 operands
[i
].mode
&= ~ABS
;
723 operands
[i
].mode
|= ABSJMP
;
724 /* But it may not be 24 bits long. */
727 operands
[i
].mode
&= ~SIZE
;
728 operands
[i
].mode
|= L_16
;
731 else if ((op
& (KBIT
| DBIT
)) && (x
& IMM
))
733 /* This is ok if the immediate value is sensible. */
737 /* The size of the displacement is important. */
738 if ((op
& SIZE
) != (x
& SIZE
))
741 else if ((op
& (DISP
| IMM
| ABS
))
742 && (op
& (DISP
| IMM
| ABS
)) == (x
& (DISP
| IMM
| ABS
)))
744 /* Promote a L_24 to L_32 if it makes us match. */
745 if ((x
& L_24
) && (op
& L_32
))
750 /* Promote an L8 to L_16 if it makes us match. */
751 if (op
& ABS
&& op
& L_8
&& op
& DISP
)
756 else if ((x
& SIZE
) != 0
757 && ((op
& SIZE
) != (x
& SIZE
)))
760 else if ((op
& MACREG
) != (x
& MACREG
))
764 else if ((op
& MODE
) != (x
& MODE
))
778 check_operand (operand
, width
, string
)
779 struct h8_op
*operand
;
783 if (operand
->exp
.X_add_symbol
== 0
784 && operand
->exp
.X_op_symbol
== 0)
786 /* No symbol involved, let's look at offset, it's dangerous if
787 any of the high bits are not 0 or ff's, find out by oring or
788 anding with the width and seeing if the answer is 0 or all
791 if ((operand
->exp
.X_add_number
& ~width
) != 0 &&
792 (operand
->exp
.X_add_number
| width
) != (~0))
795 && (operand
->exp
.X_add_number
& 0xff00) == 0xff00)
797 /* Just ignore this one - which happens when trying to
798 fit a 16 bit address truncated into an 8 bit address
799 of something like bset. */
803 as_warn (_("operand %s0x%lx out of range."), string
,
804 (unsigned long) operand
->exp
.X_add_number
);
810 /* RELAXMODE has one of 3 values:
812 0 Output a "normal" reloc, no relaxing possible for this insn/reloc
814 1 Output a relaxable 24bit absolute mov.w address relocation
815 (may relax into a 16bit absolute address).
817 2 Output a relaxable 16/24 absolute mov.b address relocation
818 (may relax into an 8bit absolute address). */
821 do_a_fix_imm (offset
, operand
, relaxmode
)
823 struct h8_op
*operand
;
830 char *t
= operand
->mode
& IMM
? "#" : "@";
832 if (operand
->exp
.X_add_symbol
== 0)
834 char *bytes
= frag_now
->fr_literal
+ offset
;
835 switch (operand
->mode
& SIZE
)
838 check_operand (operand
, 0x3, t
);
839 bytes
[0] |= (operand
->exp
.X_add_number
) << 4;
842 check_operand (operand
, 0x7, t
);
843 bytes
[0] |= (operand
->exp
.X_add_number
) << 4;
846 check_operand (operand
, 0xff, t
);
847 bytes
[0] = operand
->exp
.X_add_number
;
850 check_operand (operand
, 0xffff, t
);
851 bytes
[0] = operand
->exp
.X_add_number
>> 8;
852 bytes
[1] = operand
->exp
.X_add_number
>> 0;
855 check_operand (operand
, 0xffffff, t
);
856 bytes
[0] = operand
->exp
.X_add_number
>> 16;
857 bytes
[1] = operand
->exp
.X_add_number
>> 8;
858 bytes
[2] = operand
->exp
.X_add_number
>> 0;
862 /* This should be done with bfd. */
863 bytes
[0] = operand
->exp
.X_add_number
>> 24;
864 bytes
[1] = operand
->exp
.X_add_number
>> 16;
865 bytes
[2] = operand
->exp
.X_add_number
>> 8;
866 bytes
[3] = operand
->exp
.X_add_number
>> 0;
869 idx
= (relaxmode
== 2) ? R_MOV24B1
: R_MOVL1
;
870 fix_new_exp (frag_now
, offset
, 4, &operand
->exp
, 0, idx
);
877 switch (operand
->mode
& SIZE
)
882 where
= (operand
->mode
& SIZE
) == L_24
? -1 : 0;
885 else if (relaxmode
== 1)
891 as_bad (_("Can't work out size of operand.\n"));
899 operand
->exp
.X_add_number
=
900 ((operand
->exp
.X_add_number
& 0xffff) ^ 0x8000) - 0x8000;
906 operand
->exp
.X_add_number
=
907 ((operand
->exp
.X_add_number
& 0xff) ^ 0x80) - 0x80;
910 fix_new_exp (frag_now
,
919 /* Now we know what sort of opcodes it is, let's build the bytes. */
921 build_bytes (this_try
, operand
)
922 struct h8_opcode
*this_try
;
923 struct h8_op
*operand
;
927 char *output
= frag_more (this_try
->length
);
928 op_type
*nibble_ptr
= this_try
->data
.nib
;
930 unsigned int nibble_count
= 0;
938 if (!(this_try
->inbase
|| Hmode
))
939 as_warn (_("Opcode `%s' with these operand types not available in H8/300 mode"),
942 while (*nibble_ptr
!= E
)
947 d
= (c
& (DST
| SRC_IN_DST
)) != 0;
955 if (c
& (REG
| IND
| INC
| DEC
))
957 nib
= operand
[d
].reg
;
959 else if ((c
& DISPREG
) == (DISPREG
))
966 absat
= nibble_count
/ 2;
969 else if (c
& (IMM
| PCREL
| ABS
| ABSJMP
| DISP
))
972 immat
= nibble_count
/ 2;
981 switch (operand
[0].exp
.X_add_number
)
990 as_bad (_("Need #1 or #2 here"));
995 switch (operand
[0].exp
.X_add_number
)
1005 as_warn (_("#4 not valid on H8/300."));
1010 as_bad (_("Need #1 or #2 here"));
1013 /* Stop it making a fix. */
1014 operand
[0].mode
= 0;
1019 operand
[d
].mode
|= MEMRELAX
;
1029 if (operand
[0].mode
== MACREG
)
1030 /* stmac has mac[hl] as the first operand. */
1031 nib
= 2 + operand
[0].reg
;
1033 /* ldmac has mac[hl] as the second operand. */
1034 nib
= 2 + operand
[1].reg
;
1042 /* Disgusting. Why, oh why didn't someone ask us for advice
1043 on the assembler format. */
1044 if (strcmp (this_try
->name
, "stm.l") == 0
1045 || strcmp (this_try
->name
, "ldm.l") == 0)
1048 high
= (operand
[this_try
->name
[0] == 'l' ? 1 : 0].reg
>> 8) & 0xf;
1049 low
= operand
[this_try
->name
[0] == 'l' ? 1 : 0].reg
& 0xf;
1051 asnibbles
[2] = high
- low
;
1052 asnibbles
[7] = (this_try
->name
[0] == 'l') ? high
: low
;
1055 for (i
= 0; i
< this_try
->length
; i
++)
1057 output
[i
] = (asnibbles
[i
* 2] << 4) | asnibbles
[i
* 2 + 1];
1060 /* Note if this is a movb instruction -- there's a special relaxation
1061 which only applies to them. */
1062 if (strcmp (this_try
->name
, "mov.b") == 0)
1065 /* Output any fixes. */
1066 for (i
= 0; i
< 2; i
++)
1068 int x
= operand
[i
].mode
;
1070 if (x
& (IMM
| DISP
))
1072 do_a_fix_imm (output
- frag_now
->fr_literal
+ immat
,
1073 operand
+ i
, x
& MEMRELAX
!= 0);
1077 do_a_fix_imm (output
- frag_now
->fr_literal
+ absat
,
1078 operand
+ i
, x
& MEMRELAX
? movb
+ 1 : 0);
1082 int size16
= x
& L_16
;
1083 int where
= size16
? 2 : 1;
1084 int size
= size16
? 2 : 1;
1085 int type
= size16
? R_PCRWORD
: R_PCRBYTE
;
1087 check_operand (operand
+ i
, size16
? 0x7fff : 0x7f, "@");
1089 if (operand
[i
].exp
.X_add_number
& 1)
1091 as_warn (_("branch operand has odd offset (%lx)\n"),
1092 (unsigned long) operand
->exp
.X_add_number
);
1095 operand
[i
].exp
.X_add_number
-= 1;
1096 operand
[i
].exp
.X_add_number
=
1097 ((operand
[i
].exp
.X_add_number
& 0xff) ^ 0x80) - 0x80;
1099 fix_new_exp (frag_now
,
1100 output
- frag_now
->fr_literal
+ where
,
1106 else if (x
& MEMIND
)
1108 check_operand (operand
+ i
, 0xff, "@@");
1109 fix_new_exp (frag_now
,
1110 output
- frag_now
->fr_literal
+ 1,
1116 else if (x
& ABSJMP
)
1118 /* This jmp may be a jump or a branch. */
1120 check_operand (operand
+ i
, Hmode
? 0xffffff : 0xffff, "@");
1121 if (operand
[i
].exp
.X_add_number
& 1)
1123 as_warn (_("branch operand has odd offset (%lx)\n"),
1124 (unsigned long) operand
->exp
.X_add_number
);
1127 operand
[i
].exp
.X_add_number
=
1128 ((operand
[i
].exp
.X_add_number
& 0xffff) ^ 0x8000) - 0x8000;
1129 fix_new_exp (frag_now
,
1130 output
- frag_now
->fr_literal
,
1139 /* Try to give an intelligent error message for common and simple to
1142 clever_message (opcode
, operand
)
1143 struct h8_opcode
*opcode
;
1144 struct h8_op
*operand
;
1146 /* Find out if there was more than one possible opcode. */
1148 if ((opcode
+ 1)->idx
!= opcode
->idx
)
1152 /* Only one opcode of this flavour, try to guess which operand
1154 for (argn
= 0; argn
< opcode
->noperands
; argn
++)
1156 switch (opcode
->args
.nib
[argn
])
1159 if (operand
[argn
].mode
!= RD16
)
1161 as_bad (_("destination operand must be 16 bit register"));
1168 if (operand
[argn
].mode
!= RS8
)
1170 as_bad (_("source operand must be 8 bit register"));
1176 if (operand
[argn
].mode
!= ABS16DST
)
1178 as_bad (_("destination operand must be 16bit absolute address"));
1183 if (operand
[argn
].mode
!= RD8
)
1185 as_bad (_("destination operand must be 8 bit register"));
1191 if (operand
[argn
].mode
!= ABS16SRC
)
1193 as_bad (_("source operand must be 16bit absolute address"));
1201 as_bad (_("invalid operands"));
1204 /* This is the guts of the machine-dependent assembler. STR points to
1205 a machine dependent instruction. This function is supposed to emit
1206 the frags/bytes it assembles. */
1213 struct h8_op operand
[2];
1214 struct h8_opcode
*opcode
;
1215 struct h8_opcode
*prev_opcode
;
1221 /* Drop leading whitespace. */
1225 /* Find the op code end. */
1226 for (op_start
= op_end
= str
;
1227 *op_end
!= 0 && *op_end
!= ' ';
1239 if (op_end
== op_start
)
1241 as_bad (_("can't find opcode "));
1247 opcode
= (struct h8_opcode
*) hash_find (opcode_hash_control
,
1252 as_bad (_("unknown opcode"));
1256 /* We used to set input_line_pointer to the result of get_operands,
1257 but that is wrong. Our caller assumes we don't change it. */
1259 (void) get_operands (opcode
->noperands
, op_end
, operand
);
1261 prev_opcode
= opcode
;
1281 opcode
= get_specific (opcode
, operand
, size
);
1285 /* Couldn't find an opcode which matched the operands. */
1286 char *where
= frag_more (2);
1290 clever_message (prev_opcode
, operand
);
1294 if (opcode
->size
&& dot
)
1296 if (opcode
->size
!= *dot
)
1298 as_warn (_("mismatch between opcode size and operand size"));
1302 build_bytes (opcode
, operand
);
1306 tc_crawl_symbol_chain (headers
)
1307 object_headers
*headers ATTRIBUTE_UNUSED
;
1309 printf (_("call to tc_crawl_symbol_chain \n"));
1313 md_undefined_symbol (name
)
1314 char *name ATTRIBUTE_UNUSED
;
1320 tc_headers_hook (headers
)
1321 object_headers
*headers ATTRIBUTE_UNUSED
;
1323 printf (_("call to tc_headers_hook \n"));
1326 /* Various routines to kill one day */
1327 /* Equal to MAX_PRECISION in atof-ieee.c */
1328 #define MAX_LITTLENUMS 6
1330 /* Turn a string in input_line_pointer into a floating point constant
1331 of type TYPE, and store the appropriate bytes in *LITP. The number
1332 of LITTLENUMS emitted is stored in *SIZEP . An error message is
1333 returned, or NULL on OK. */
1335 md_atof (type
, litP
, sizeP
)
1341 LITTLENUM_TYPE words
[MAX_LITTLENUMS
];
1342 LITTLENUM_TYPE
*wordP
;
1374 return _("Bad call to MD_ATOF()");
1376 t
= atof_ieee (input_line_pointer
, type
, words
);
1378 input_line_pointer
= t
;
1380 *sizeP
= prec
* sizeof (LITTLENUM_TYPE
);
1381 for (wordP
= words
; prec
--;)
1383 md_number_to_chars (litP
, (long) (*wordP
++), sizeof (LITTLENUM_TYPE
));
1384 litP
+= sizeof (LITTLENUM_TYPE
);
1389 CONST
char *md_shortopts
= "";
1390 struct option md_longopts
[] = {
1391 {NULL
, no_argument
, NULL
, 0}
1394 size_t md_longopts_size
= sizeof (md_longopts
);
1397 md_parse_option (c
, arg
)
1398 int c ATTRIBUTE_UNUSED
;
1399 char *arg ATTRIBUTE_UNUSED
;
1405 md_show_usage (stream
)
1406 FILE *stream ATTRIBUTE_UNUSED
;
1411 tc_aout_fix_to_chars ()
1413 printf (_("call to tc_aout_fix_to_chars \n"));
1418 md_convert_frag (headers
, seg
, fragP
)
1419 object_headers
*headers ATTRIBUTE_UNUSED
;
1420 segT seg ATTRIBUTE_UNUSED
;
1421 fragS
*fragP ATTRIBUTE_UNUSED
;
1423 printf (_("call to md_convert_frag \n"));
1428 md_section_align (seg
, size
)
1432 return ((size
+ (1 << section_alignment
[(int) seg
]) - 1)
1433 & (-1 << section_alignment
[(int) seg
]));
1437 md_apply_fix (fixP
, val
)
1441 char *buf
= fixP
->fx_where
+ fixP
->fx_frag
->fr_literal
;
1443 switch (fixP
->fx_size
)
1449 *buf
++ = (val
>> 8);
1453 *buf
++ = (val
>> 24);
1454 *buf
++ = (val
>> 16);
1455 *buf
++ = (val
>> 8);
1464 md_estimate_size_before_relax (fragP
, segment_type
)
1465 register fragS
*fragP ATTRIBUTE_UNUSED
;
1466 register segT segment_type ATTRIBUTE_UNUSED
;
1468 printf (_("call tomd_estimate_size_before_relax \n"));
1472 /* Put number into target byte order. */
1474 md_number_to_chars (ptr
, use
, nbytes
)
1479 number_to_chars_bigendian (ptr
, use
, nbytes
);
1483 md_pcrel_from (fixP
)
1484 fixS
*fixP ATTRIBUTE_UNUSED
;
1490 tc_reloc_mangle (fix_ptr
, intr
, base
)
1492 struct internal_reloc
*intr
;
1496 symbolS
*symbol_ptr
;
1498 symbol_ptr
= fix_ptr
->fx_addsy
;
1500 /* If this relocation is attached to a symbol then it's ok
1502 if (fix_ptr
->fx_r_type
== TC_CONS_RELOC
)
1504 /* cons likes to create reloc32's whatever the size of the reloc..
1506 switch (fix_ptr
->fx_size
)
1509 intr
->r_type
= R_RELLONG
;
1512 intr
->r_type
= R_RELWORD
;
1515 intr
->r_type
= R_RELBYTE
;
1523 intr
->r_type
= fix_ptr
->fx_r_type
;
1526 intr
->r_vaddr
= fix_ptr
->fx_frag
->fr_address
+ fix_ptr
->fx_where
+ base
;
1527 intr
->r_offset
= fix_ptr
->fx_offset
;
1531 if (symbol_ptr
->sy_number
!= -1)
1532 intr
->r_symndx
= symbol_ptr
->sy_number
;
1537 /* This case arises when a reference is made to `.'. */
1538 segsym
= seg_info (S_GET_SEGMENT (symbol_ptr
))->dot
;
1540 intr
->r_symndx
= -1;
1543 intr
->r_symndx
= segsym
->sy_number
;
1544 intr
->r_offset
+= S_GET_VALUE (symbol_ptr
);
1549 intr
->r_symndx
= -1;