2 /* tc-h8500.c -- Assemble code for the Hitachi H8/500
3 Copyright (C) 1993 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
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
22 Written By Steve Chamberlain
31 #include "../opcodes/h8500-opc.h"
34 const char comment_chars
[] =
36 const char line_separator_chars
[] =
38 const char line_comment_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
49 const pseudo_typeS md_pseudo_table
[] =
55 {"form", listing_psize
, 0},
56 {"heading", listing_title
, 0},
57 {"import", s_ignore
, 0},
58 {"page", listing_eject
, 0},
59 {"program", s_ignore
, 0},
65 const char EXP_CHARS
[] = "eE";
67 /* Chars that mean this number is a floating point constant */
70 const char FLT_CHARS
[] = "rRsSfFdDxXpP";
72 #define C(a,b) ENCODE_RELAX(a,b)
73 #define ENCODE_RELAX(what,length) (((what) << 2) + (length))
75 #define GET_WHAT(x) ((x>>2))
79 #define UNDEF_BYTE_DISP 0
80 #define UNDEF_WORD_DISP 3
92 relax_typeS md_relax_table
[C (END
, 0)];
94 static struct hash_control
*opcode_hash_control
; /* Opcode mnemonics */
97 This function is called once, at assembler startup time. This should
98 set up all the tables, etc that the MD part of the assembler needs
104 h8500_opcode_info
*opcode
;
105 char prev_buffer
[100];
108 opcode_hash_control
= hash_new ();
111 /* Insert unique names into hash table */
112 for (opcode
= h8500_table
; opcode
->name
; opcode
++)
114 if (idx
!= opcode
->idx
)
116 hash_insert (opcode_hash_control
, opcode
->name
, (char *) opcode
);
121 /* Initialize the relax table */
122 md_relax_table
[C (BRANCH
, BYTE_DISP
)].rlx_forward
= BYTE_F
;
123 md_relax_table
[C (BRANCH
, BYTE_DISP
)].rlx_backward
= BYTE_B
;
124 md_relax_table
[C (BRANCH
, BYTE_DISP
)].rlx_length
= 2;
125 md_relax_table
[C (BRANCH
, BYTE_DISP
)].rlx_more
= C (BRANCH
, WORD_DISP
);
127 md_relax_table
[C (BRANCH
, WORD_DISP
)].rlx_forward
= WORD_F
;
128 md_relax_table
[C (BRANCH
, WORD_DISP
)].rlx_backward
= WORD_B
;
129 md_relax_table
[C (BRANCH
, WORD_DISP
)].rlx_length
= 3;
130 md_relax_table
[C (BRANCH
, WORD_DISP
)].rlx_more
= 0;
132 md_relax_table
[C (SCB_F
, BYTE_DISP
)].rlx_forward
= BYTE_F
;
133 md_relax_table
[C (SCB_F
, BYTE_DISP
)].rlx_backward
= BYTE_B
;
134 md_relax_table
[C (SCB_F
, BYTE_DISP
)].rlx_length
= 3;
135 md_relax_table
[C (SCB_F
, BYTE_DISP
)].rlx_more
= C (SCB_F
, WORD_DISP
);
137 md_relax_table
[C (SCB_F
, WORD_DISP
)].rlx_forward
= WORD_F
;
138 md_relax_table
[C (SCB_F
, WORD_DISP
)].rlx_backward
= WORD_B
;
139 md_relax_table
[C (SCB_F
, WORD_DISP
)].rlx_length
= 8;
140 md_relax_table
[C (SCB_F
, WORD_DISP
)].rlx_more
= 0;
142 md_relax_table
[C (SCB_TST
, BYTE_DISP
)].rlx_forward
= BYTE_F
;
143 md_relax_table
[C (SCB_TST
, BYTE_DISP
)].rlx_backward
= BYTE_B
;
144 md_relax_table
[C (SCB_TST
, BYTE_DISP
)].rlx_length
= 3;
145 md_relax_table
[C (SCB_TST
, BYTE_DISP
)].rlx_more
= C (SCB_TST
, WORD_DISP
);
147 md_relax_table
[C (SCB_TST
, WORD_DISP
)].rlx_forward
= WORD_F
;
148 md_relax_table
[C (SCB_TST
, WORD_DISP
)].rlx_backward
= WORD_B
;
149 md_relax_table
[C (SCB_TST
, WORD_DISP
)].rlx_length
= 10;
150 md_relax_table
[C (SCB_TST
, WORD_DISP
)].rlx_more
= 0;
154 int rn
; /* register number used by RN */
155 int rs
; /* register number used by RS */
156 int rd
; /* register number used by RD */
157 int crb
; /* byte size cr */
158 int crw
; /* word sized cr */
160 expressionS displacement
; /* displacement expression */
161 int displacement_size
; /* and size if given */
163 int immediate_inpage
;
164 expressionS immediate
; /* immediate expression */
165 int immediate_size
; /* and size if given */
167 expressionS absolute
; /* absolute expression */
168 int absolute_size
; /* and size if given */
180 /* try and parse a reg name, returns number of chars consumed */
182 parse_reg (src
, mode
, reg
)
189 if (src
[1] >= '0' && src
[1] <= '7')
192 *reg
= (src
[1] - '0');
197 if (src
[0] == 's' && src
[1] == 'p')
203 if (src
[0] == 'c' && src
[1] == 'c' && src
[2] == 'r')
209 if (src
[0] == 's' && src
[1] == 'r')
216 if (src
[0] == 'b' && src
[1] == 'r')
223 if (src
[0] == 'e' && src
[1] == 'p')
230 if (src
[0] == 'd' && src
[1] == 'p')
237 if (src
[0] == 't' && src
[1] == 'p')
244 if (src
[0] == 'f' && src
[1] == 'p')
254 parse_exp (s
, op
, page
)
263 save
= input_line_pointer
;
268 if (s
[1] == 'p' && s
[2] == 'a' && s
[3] == 'g' && s
[4] == 'e') {
273 else if (s
[1] == 'o' && s
[2] == 'f' && s
[3] == 'f') {
278 input_line_pointer
= s
;
281 new = input_line_pointer
;
282 input_line_pointer
= save
;
283 if (SEG_NORMAL (seg
))
294 as_bad ("Missing operand");
297 as_bad ("Don't understand operand of type %s", segment_name (seg
));
303 skip_colonthing (ptr
, exp
, def
, size8
, size16
, size24
)
305 h8500_operand_info
*exp
;
311 ptr
= parse_exp (ptr
, &exp
->exp
, &exp
->page
);
320 else if (ptr
[0] == '1' & ptr
[1] == '6')
325 else if (ptr
[0] == '2' & ptr
[1] == '4')
329 as_bad (":24 not valid for this opcode");
336 as_bad ("expect :8,:16 or :24");
346 /* Let's work out the size from the context */
348 && exp
->exp
.X_seg
== SEG_ABSOLUTE
349 && exp
->exp
.X_add_number
>= -128
350 && exp
->exp
.X_add_number
<= 127)
364 parse_reglist(src
, op
)
366 h8500_operand_info
*op
;
372 int idx
= 1; /* skip ( */
373 while (src
[idx
] && src
[idx
] != ')')
375 int done
= parse_reg(src
+idx
, &mode
, &rn
);
383 as_bad("syntax error in reg list");
389 done
= parse_reg(src
+idx
, &mode
, &rm
);
398 as_bad("missing final register in range");
405 op
->exp
.X_add_symbol
= 0;
406 op
->exp
.X_subtract_symbol
= 0;
407 op
->exp
.X_add_number
= mask
;
408 op
->exp
.X_seg
= SEG_ABSOLUTE
;
413 /* The many forms of operand:
416 @Rn Register indirect
417 @(disp[:size], Rn) Register indirect with displacement
421 #xx[:size] immediate data
426 get_operand (ptr
, op
)
428 h8500_operand_info
*op
;
436 if (src
[0] == '(' && src
[1] == 'r')
438 /* This is a register list */
439 *ptr
= src
+ parse_reglist(src
, op
);
443 len
= parse_reg (src
, &op
->type
, &op
->reg
);
457 len
= parse_reg (src
, &mode
, &num
);
460 /* Oops, not a reg after all, must be ordinary exp */
462 /* must be a symbol */
463 *ptr
= skip_colonthing (src
, op
, ABS16
, ABS8
, ABS16
, ABS24
);
477 src
= skip_colonthing (src
, op
, RNIND_D16
, RNIND_D8
, RNIND_D16
, 0);
481 as_bad ("expected @(exp, Rn)");
485 len
= parse_reg (src
, &mode
, &op
->reg
);
486 if (len
== 0 || mode
!= RN
)
488 as_bad ("expected @(exp, Rn)");
494 as_bad ("expected @(exp, Rn)");
500 len
= parse_reg (src
, &mode
, &num
);
510 as_bad ("@Rn+ needs word register");
520 as_bad ("@Rn needs word register");
530 /* must be a symbol */
531 *ptr
= skip_colonthing (src
, op
, ABS16
, ABS8
, ABS16
, 0);
539 *ptr
= skip_colonthing (src
, op
, IMM16
, IMM8
, IMM16
, 0);
544 *ptr
= skip_colonthing (src
, op
, PCREL8
, PCREL8
, PCREL16
, 0);
550 get_operands (info
, args
, operand
)
551 h8500_opcode_info
*info
;
553 h8500_operand_info
*operand
;
567 get_operand (&ptr
, operand
+ 0, 0);
573 get_operand (&ptr
, operand
+ 0, 0);
576 get_operand (&ptr
, operand
+ 1, 1);
586 /* Passed a pointer to a list of opcodes which use different
587 addressing modes, return the opcode which matches the opcodes
595 get_specific (opcode
, operands
)
596 h8500_opcode_info
*opcode
;
597 h8500_operand_info
*operands
;
599 h8500_opcode_info
*this_try
= opcode
;
601 unsigned int noperands
= opcode
->nargs
;
603 unsigned int dispreg
;
604 unsigned int this_index
= opcode
->idx
;
606 while (this_index
== opcode
->idx
&& !found
)
612 /* look at both operands needed by the opcodes and provided by
614 for (i
= 0; i
< noperands
; i
++)
616 h8500_operand_info
*user
= operands
+ i
;
618 switch (this_try
->arg_type
[i
])
621 /* Opcode needs (disp:16,fp) */
622 if (user
->type
== DISP16
&& user
->reg
== 6)
624 displacement
= user
->exp
;
629 /* Opcode needs (disp:8,fp) */
630 if (user
->type
== DISP8
&& user
->reg
== 6)
632 displacement
= user
->exp
;
637 if (user
->type
== RNIND_D16
)
639 displacement
= user
->exp
;
645 if (user
->type
== RNIND_D8
)
647 displacement
= user
->exp
;
654 if (user
->type
== this_try
->arg_type
[i
])
656 displacement
= user
->exp
;
662 if (user
->type
== RNDEC
&& user
->reg
== 7)
668 if (user
->type
== ABS16
)
670 absolute
= user
->exp
;
675 if (user
->type
== ABS8
)
677 absolute
= user
->exp
;
682 if (user
->type
== ABS24
)
684 absolute
= user
->exp
;
689 if (user
->type
== CRB
)
696 if (user
->type
== CRW
)
703 if (user
->type
== DISP16
)
705 displacement
= user
->exp
;
710 if (user
->type
== DISP8
)
712 displacement
= user
->exp
;
717 if (user
->type
== RN
&& user
->reg
== 6)
723 if (user
->type
== PCREL16
)
725 displacement
= user
->exp
;
730 if (user
->type
== PCREL8
)
732 displacement
= user
->exp
;
739 if (user
->type
== IMM16
740 || user
->type
== IMM8
)
742 immediate_inpage
= user
->page
;
743 immediate
= user
->exp
;
749 if (user
->type
== IMM8
)
751 immediate_inpage
= user
->page
;
752 immediate
= user
->exp
;
757 if (user
->type
== IMM8
)
759 immediate_inpage
= user
->page
;
760 immediate
= user
->exp
;
765 if (user
->type
== IMM8
766 && user
->exp
.X_seg
== SEG_ABSOLUTE
768 (user
->exp
.X_add_number
== -2
769 || user
->exp
.X_add_number
== -1
770 || user
->exp
.X_add_number
== 1
771 || user
->exp
.X_add_number
== 2))
773 immediate_inpage
= user
->page
;
774 immediate
= user
->exp
;
779 if (user
->type
== RN
)
786 if (user
->type
== RN
)
793 if (user
->type
== RNIND
)
804 if (user
->type
== this_try
->arg_type
[i
])
811 if (user
->type
== RN
&& user
->reg
== 7)
817 printf ("unhandled %d\n", this_try
->arg_type
[i
]);
821 /* If we get here this didn't work out */
836 check (operand
, low
, high
)
837 expressionS
*operand
;
841 if (operand
->X_seg
!= SEG_ABSOLUTE
842 || operand
->X_add_number
< low
843 || operand
->X_add_number
> high
)
845 as_bad ("operand must be absolute in range %d..%d", low
, high
);
847 return operand
->X_add_number
;
852 DEFUN (check_operand
, (operand
, width
, string
),
853 struct h8_op
*operand AND
854 unsigned int width AND
857 if (operand
->exp
.X_add_symbol
== 0
858 && operand
->exp
.X_subtract_symbol
== 0)
861 /* No symbol involved, let's look at offset, it's dangerous if any of
862 the high bits are not 0 or ff's, find out by oring or anding with
863 the width and seeing if the answer is 0 or all fs*/
864 if ((operand
->exp
.X_add_number
& ~width
) != 0 &&
865 (operand
->exp
.X_add_number
| width
) != (~0))
867 as_warn ("operand %s0x%x out of range.", string
, operand
->exp
.X_add_number
);
875 insert (size
, output
, index
, exp
, reloc
, opcode
)
881 md_number_to_chars (output
+ index
, exp
->X_add_number
, size
);
882 exp
->X_add_number
= 0;
883 if (exp
->X_add_symbol
|| exp
->X_subtract_symbol
)
886 output
- frag_now
->fr_literal
+ index
,
889 exp
->X_subtract_symbol
,
890 (short) (exp
->X_add_number
),
897 build_relaxable_instruction (opcode
, operand
)
898 h8500_opcode_info
*opcode
;
899 h8500_operand_info
*operand
;
901 /* All relaxable instructions start life as two bytes but can become
902 three bytes long if a lonely branch and up to 9 bytes if long scb
908 if (opcode
->bytes
[0].contents
== 0x01)
912 else if (opcode
->bytes
[0].contents
== 0x06
913 || opcode
->bytes
[0].contents
== 0x07)
922 p
= frag_var (rs_machine_dependent
,
923 md_relax_table
[C (type
, WORD_DISP
)].rlx_length
,
924 len
= md_relax_table
[C (type
, BYTE_DISP
)].rlx_length
,
925 C (type
, UNDEF_BYTE_DISP
),
926 displacement
.X_add_symbol
,
927 displacement
.X_add_number
,
930 p
[0] = opcode
->bytes
[0].contents
;
933 p
[1] = opcode
->bytes
[1].contents
| rs
;
937 /* Now we know what sort of opcodes it is, lets build the bytes -
940 build_bytes (opcode
, operand
)
941 h8500_opcode_info
*opcode
;
942 h8500_operand_info
*operand
;
956 build_relaxable_instruction (opcode
, operand
);
960 char *output
= frag_more (opcode
->length
);
962 memset (output
, 0, opcode
->length
);
963 for (index
= 0; index
< opcode
->length
; index
++)
965 output
[index
] = opcode
->bytes
[index
].contents
;
967 switch (opcode
->bytes
[index
].insert
)
970 printf ("failed for %d\n", opcode
->bytes
[index
].insert
);
985 insert (2, output
, index
, &displacement
, R_H8500_IMM16
);
990 insert (1, output
, index
, &displacement
, R_H8500_IMM8
);
993 insert (2, output
, index
, &immediate
, R_H8500_IMM16
);
998 insert (1, output
, index
, &immediate
, immediate_inpage
?
999 R_H8500_HIGH8
: R_H8500_IMM8
);
1002 insert (2, output
, index
, &displacement
, R_H8500_PCREL16
);
1006 insert (1, output
, index
, &displacement
, R_H8500_PCREL8
, output
);
1009 output
[index
] |= check (&immediate
, 0, 15);
1012 output
[index
] |= crb
;
1015 output
[index
] |= crw
;
1018 insert (2, output
, index
, absolute
, R_H8500_IMM16
);
1022 insert (1, output
, index
, absolute
, R_H8500_IMM8
);
1025 switch (immediate
.X_add_number
)
1028 output
[index
] |= 0x5;
1031 output
[index
] |= 0x4;
1046 /* This is the guts of the machine-dependent assembler. STR points to a
1047 machine dependent instruction. This funciton is supposed to emit
1048 the frags/bytes it assembles to.
1052 DEFUN (md_assemble
, (str
),
1058 h8500_operand_info operand
[2];
1059 h8500_opcode_info
*opcode
;
1060 h8500_opcode_info
*prev_opcode
;
1067 /* Drop leading whitespace */
1071 /* find the op code end */
1072 for (op_start
= op_end
= str
;
1073 *op_end
!= 0 && *op_end
!= ' ';
1080 name
[nlen
++] = *op_end
;
1085 if (op_end
== op_start
)
1087 as_bad ("can't find opcode ");
1090 opcode
= (h8500_opcode_info
*) hash_find (opcode_hash_control
, name
);
1094 as_bad ("unknown opcode");
1098 input_line_pointer
= get_operands (opcode
, op_end
, operand
);
1099 prev_opcode
= opcode
;
1101 opcode
= get_specific (opcode
, operand
);
1105 /* Couldn't find an opcode which matched the operands */
1106 char *where
= frag_more (2);
1110 as_bad ("invalid operands for opcode");
1114 build_bytes (opcode
, operand
);
1119 DEFUN (tc_crawl_symbol_chain
, (headers
),
1120 object_headers
* headers
)
1122 printf ("call to tc_crawl_symbol_chain \n");
1126 DEFUN (md_undefined_symbol
, (name
),
1133 DEFUN (tc_headers_hook
, (headers
),
1134 object_headers
* headers
)
1136 printf ("call to tc_headers_hook \n");
1144 /* Various routines to kill one day */
1145 /* Equal to MAX_PRECISION in atof-ieee.c */
1146 #define MAX_LITTLENUMS 6
1148 /* Turn a string in input_line_pointer into a floating point constant of type
1149 type, and store the appropriate bytes in *litP. The number of LITTLENUMS
1150 emitted is stored in *sizeP . An error message is returned, or NULL on OK.
1153 md_atof (type
, litP
, sizeP
)
1159 LITTLENUM_TYPE words
[MAX_LITTLENUMS
];
1160 LITTLENUM_TYPE
*wordP
;
1192 return "Bad call to MD_ATOF()";
1194 t
= atof_ieee (input_line_pointer
, type
, words
);
1196 input_line_pointer
= t
;
1198 *sizeP
= prec
* sizeof (LITTLENUM_TYPE
);
1199 for (wordP
= words
; prec
--;)
1201 md_number_to_chars (litP
, (long) (*wordP
++), sizeof (LITTLENUM_TYPE
));
1202 litP
+= sizeof (LITTLENUM_TYPE
);
1204 return ""; /* Someone should teach Dean about null pointers */
1208 md_parse_option (argP
, cntP
, vecP
)
1218 int md_short_jump_size
;
1221 tc_aout_fix_to_chars ()
1223 printf ("call to tc_aout_fix_to_chars \n");
1228 md_create_short_jump (ptr
, from_addr
, to_addr
, frag
, to_symbol
)
1235 as_fatal ("failed sanity check.");
1239 md_create_long_jump (ptr
, from_addr
, to_addr
, frag
, to_symbol
)
1241 long from_addr
, to_addr
;
1245 as_fatal ("failed sanity check.");
1250 wordify_scb (buffer
, disp_size
, inst_size
)
1255 int rn
= buffer
[1] & 0x7;
1259 case 0x0e: /* BSR */
1292 *buffer
++ = 0x26; /* bne + 8 */
1298 *buffer
++ = 0x27; /* bne + 8 */
1303 *buffer
++ = 0xa8 | rn
; /* addq -1,rn */
1305 *buffer
++ = 0x04; /* cmp #0xff:8, rn */
1307 *buffer
++ = 0x70 | rn
;
1308 *buffer
++ = 0x36; /* bne ... */
1314 called after relaxing, change the frags so they know how big they are
1317 md_convert_frag (headers
, fragP
)
1318 object_headers
*headers
;
1325 char *buffer
= fragP
->fr_fix
+ fragP
->fr_literal
;
1327 switch (fragP
->fr_subtype
)
1329 case C (BRANCH
, BYTE_DISP
):
1334 case C (SCB_F
, BYTE_DISP
):
1335 case C (SCB_TST
, BYTE_DISP
):
1340 /* Branches to a known 16 bit displacement */
1342 /* Turn on the 16bit bit */
1343 case C (BRANCH
, WORD_DISP
):
1344 case C (SCB_F
, WORD_DISP
):
1345 case C (SCB_TST
, WORD_DISP
):
1346 wordify_scb (buffer
, &disp_size
, &inst_size
);
1349 case C (BRANCH
, UNDEF_WORD_DISP
):
1350 case C (SCB_F
, UNDEF_WORD_DISP
):
1351 case C (SCB_TST
, UNDEF_WORD_DISP
):
1352 /* This tried to be relaxed, but didn't manage it, it now needs a
1354 wordify_scb (buffer
, &disp_size
, &inst_size
);
1357 fixP
= fix_new (fragP
,
1358 fragP
->fr_fix
+ inst_size
,
1366 fragP
->fr_fix
+= disp_size
+ inst_size
;
1375 /* Get the address of the end of the instruction */
1376 int next_inst
= fragP
->fr_fix
+ fragP
->fr_address
+ disp_size
+ inst_size
;
1377 int targ_addr
= (S_GET_VALUE (fragP
->fr_symbol
) +
1379 int disp
= targ_addr
- next_inst
;
1381 md_number_to_chars (buffer
+ inst_size
, disp
, disp_size
);
1382 fragP
->fr_fix
+= disp_size
+ inst_size
;
1389 DEFUN (md_section_align
, (seg
, size
),
1393 return ((size
+ (1 << section_alignment
[(int) seg
]) - 1) & (-1 << section_alignment
[(int) seg
]));
1398 md_apply_fix (fixP
, val
)
1402 char *buf
= fixP
->fx_where
+ fixP
->fx_frag
->fr_literal
;
1404 switch (fixP
->fx_size
)
1410 *buf
++ = (val
>> 8);
1414 *buf
++ = (val
>> 24);
1415 *buf
++ = (val
>> 16);
1416 *buf
++ = (val
>> 8);
1426 DEFUN (md_operand
, (expressionP
), expressionS
* expressionP
)
1430 int md_long_jump_size
;
1433 called just before address relaxation, return the length
1434 by which a fragment must grow to reach it's destination
1437 md_estimate_size_before_relax (fragP
, segment_type
)
1438 register fragS
*fragP
;
1439 register segT segment_type
;
1442 char *buffer
= fragP
->fr_fix
+ fragP
->fr_literal
;
1443 int what
= GET_WHAT (fragP
->fr_subtype
);
1445 switch (fragP
->fr_subtype
)
1449 case C (BRANCH
, UNDEF_BYTE_DISP
):
1450 case C (SCB_F
, UNDEF_BYTE_DISP
):
1451 case C (SCB_TST
, UNDEF_BYTE_DISP
):
1452 /* used to be a branch to somewhere which was unknown */
1453 if (S_GET_SEGMENT (fragP
->fr_symbol
) == segment_type
)
1455 /* Got a symbol and it's defined in this segment, become byte
1456 sized - maybe it will fix up */
1457 fragP
->fr_subtype
= C (what
, BYTE_DISP
);
1461 /* Its got a segment, but its not ours, so it will always be long */
1462 fragP
->fr_subtype
= C (what
, UNDEF_WORD_DISP
);
1463 fragP
->fr_var
= md_relax_table
[C(what
, WORD_DISP
)].rlx_length
;
1464 return md_relax_table
[C(what
, WORD_DISP
)].rlx_length
;
1467 return fragP
->fr_var
+ fragP
->fr_fix
;
1470 /* Put number into target byte order */
1473 md_number_to_chars (ptr
, use
, nbytes
)
1481 *ptr
++ = (use
>> 24) & 0xff;
1483 *ptr
++ = (use
>> 16) & 0xff;
1485 *ptr
++ = (use
>> 8) & 0xff;
1487 *ptr
++ = (use
>> 0) & 0xff;
1494 md_pcrel_from (fixP
)
1498 return fixP
->fx_size
+ fixP
->fx_where
+ fixP
->fx_frag
->fr_address
;
1502 tc_coff_symbol_emit_hook ()
1507 tc_reloc_mangle (fix_ptr
, intr
, base
)
1509 struct internal_reloc
*intr
;
1513 symbolS
*symbol_ptr
;
1515 symbol_ptr
= fix_ptr
->fx_addsy
;
1517 /* If this relocation is attached to a symbol then it's ok
1519 if (fix_ptr
->fx_r_type
== RELOC_32
)
1521 /* cons likes to create reloc32's whatever the size of the reloc..
1523 switch (fix_ptr
->fx_size
)
1526 intr
->r_type
= R_IMM16
;
1529 intr
->r_type
= R_IMM8
;
1537 intr
->r_type
= fix_ptr
->fx_r_type
;
1540 intr
->r_vaddr
= fix_ptr
->fx_frag
->fr_address
+ fix_ptr
->fx_where
+ base
;
1541 intr
->r_offset
= fix_ptr
->fx_offset
;
1544 intr
->r_symndx
= symbol_ptr
->sy_number
;
1546 intr
->r_symndx
= -1;
1550 /* end of tc-h8500.c */