Fix PR 17135 (whilst keeping PR14827 fixed) by prefering register names over
[deliverable/binutils-gdb.git] / gas / cgen.c
CommitLineData
841eff9e 1/* GAS interface for targets using CGEN: Cpu tools GENerator.
95effc2b 2 Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
841eff9e
DE
3
4This file is part of GAS, the GNU Assembler.
5
6GAS is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GAS is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GAS; see the file COPYING. If not, write to the Free Software
18Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19
1002d8ed 20#include <setjmp.h>
841eff9e
DE
21#include "ansidecl.h"
22#include "bfd.h"
48401fcf 23#include "symcat.h"
841eff9e
DE
24#include "cgen-opc.h"
25#include "as.h"
26#include "subsegs.h"
defc70bf 27#include "cgen.h"
841eff9e
DE
28
29/* Callback to insert a register into the symbol table.
30 A target may choose to let GAS parse the registers.
31 ??? Not currently used. */
32
33void
34cgen_asm_record_register (name, number)
ebde3f62 35 char * name;
defc70bf 36 int number;
841eff9e
DE
37{
38 /* Use symbol_create here instead of symbol_new so we don't try to
39 output registers into the object file's symbol table. */
40 symbol_table_insert (symbol_create (name, reg_section,
ebde3f62 41 number, & zero_address_frag));
841eff9e
DE
42}
43
44/* We need to keep a list of fixups. We can't simply generate them as
45 we go, because that would require us to first create the frag, and
46 that would screw up references to ``.''.
47
48 This is used by cpu's with simple operands. It keeps knowledge of what
49 an `expressionS' is and what a `fixup' is out of CGEN which for the time
50 being is preferable.
51
52 OPINDEX is the index in the operand table.
53 OPINFO is something the caller chooses to help in reloc determination. */
54
55struct fixup
56{
defc70bf
DE
57 int opindex;
58 int opinfo;
841eff9e
DE
59 expressionS exp;
60};
61
defc70bf
DE
62static struct fixup fixups [CGEN_MAX_FIXUPS];
63static int num_fixups;
841eff9e 64
f3f00e94
DE
65/* Prepare to parse an instruction.
66 ??? May wish to make this static and delete calls in md_assemble. */
67
841eff9e
DE
68void
69cgen_asm_init_parse ()
70{
71 num_fixups = 0;
72}
73
74/* Queue a fixup. */
75
95effc2b 76static void
841eff9e 77cgen_queue_fixup (opindex, opinfo, expP)
ebde3f62
NC
78 int opindex;
79 expressionS * expP;
841eff9e
DE
80{
81 /* We need to generate a fixup for this expression. */
defc70bf 82 if (num_fixups >= CGEN_MAX_FIXUPS)
48401fcf 83 as_fatal (_("too many fixups"));
ebde3f62 84 fixups[num_fixups].exp = * expP;
841eff9e 85 fixups[num_fixups].opindex = opindex;
ebde3f62
NC
86 fixups[num_fixups].opinfo = opinfo;
87 ++ num_fixups;
841eff9e
DE
88}
89
95effc2b
DE
90/* The following three functions allow a backup of the fixup chain to be made,
91 and to have this backup be swapped with the current chain. This allows
92 certain ports, eg the m32r, to swap two instructions and swap their fixups
93 at the same time. */
defc70bf
DE
94static struct fixup saved_fixups [CGEN_MAX_FIXUPS];
95static int saved_num_fixups;
95effc2b
DE
96
97void
98cgen_save_fixups ()
99{
100 saved_num_fixups = num_fixups;
101
102 memcpy (saved_fixups, fixups, sizeof (fixups[0]) * num_fixups);
103
104 num_fixups = 0;
105}
106
107void
108cgen_restore_fixups ()
109{
110 num_fixups = saved_num_fixups;
111
112 memcpy (fixups, saved_fixups, sizeof (fixups[0]) * num_fixups);
113
114 saved_num_fixups = 0;
115}
116
117void
118cgen_swap_fixups ()
119{
defc70bf 120 int tmp;
95effc2b
DE
121 struct fixup tmp_fixup;
122
123 if (num_fixups == 0)
124 {
125 cgen_restore_fixups ();
126 }
127 else if (saved_num_fixups == 0)
128 {
129 cgen_save_fixups ();
130 }
131 else
132 {
133 tmp = saved_num_fixups;
134 saved_num_fixups = num_fixups;
135 num_fixups = tmp;
136
defc70bf 137 for (tmp = CGEN_MAX_FIXUPS; tmp--;)
95effc2b
DE
138 {
139 tmp_fixup = saved_fixups [tmp];
140 saved_fixups [tmp] = fixups [tmp];
141 fixups [tmp] = tmp_fixup;
142 }
143 }
144}
145
841eff9e
DE
146/* Default routine to record a fixup.
147 This is a cover function to fix_new.
148 It exists because we record INSN with the fixup.
149
150 FRAG and WHERE are their respective arguments to fix_new_exp.
151 LENGTH is in bits.
152 OPINFO is something the caller chooses to help in reloc determination.
153
154 At this point we do not use a bfd_reloc_code_real_type for
155 operands residing in the insn, but instead just use the
156 operand index. This lets us easily handle fixups for any
157 operand type. We pick a BFD reloc type in md_apply_fix. */
158
159fixS *
160cgen_record_fixup (frag, where, insn, length, operand, opinfo, symbol, offset)
ebde3f62
NC
161 fragS * frag;
162 int where;
163 const CGEN_INSN * insn;
164 int length;
165 const CGEN_OPERAND * operand;
166 int opinfo;
167 symbolS * symbol;
168 offsetT offset;
841eff9e 169{
ebde3f62 170 fixS * fixP;
841eff9e
DE
171
172 /* It may seem strange to use operand->attrs and not insn->attrs here,
173 but it is the operand that has a pc relative relocation. */
174
175 fixP = fix_new (frag, where, length / 8, symbol, offset,
176 CGEN_OPERAND_ATTR (operand, CGEN_OPERAND_PCREL_ADDR) != 0,
177 (bfd_reloc_code_real_type) ((int) BFD_RELOC_UNUSED + CGEN_OPERAND_INDEX (operand)));
ebde3f62 178 fixP->tc_fix_data.insn = (PTR) insn;
841eff9e
DE
179 fixP->tc_fix_data.opinfo = opinfo;
180
181 return fixP;
182}
183
184/* Default routine to record a fixup given an expression.
185 This is a cover function to fix_new_exp.
186 It exists because we record INSN with the fixup.
187
188 FRAG and WHERE are their respective arguments to fix_new_exp.
189 LENGTH is in bits.
190 OPINFO is something the caller chooses to help in reloc determination.
191
192 At this point we do not use a bfd_reloc_code_real_type for
193 operands residing in the insn, but instead just use the
194 operand index. This lets us easily handle fixups for any
195 operand type. We pick a BFD reloc type in md_apply_fix. */
196
197fixS *
198cgen_record_fixup_exp (frag, where, insn, length, operand, opinfo, exp)
ebde3f62
NC
199 fragS * frag;
200 int where;
201 const CGEN_INSN * insn;
202 int length;
203 const CGEN_OPERAND * operand;
204 int opinfo;
205 expressionS * exp;
841eff9e 206{
ebde3f62 207 fixS * fixP;
841eff9e
DE
208
209 /* It may seem strange to use operand->attrs and not insn->attrs here,
210 but it is the operand that has a pc relative relocation. */
211
212 fixP = fix_new_exp (frag, where, length / 8, exp,
213 CGEN_OPERAND_ATTR (operand, CGEN_OPERAND_PCREL_ADDR) != 0,
214 (bfd_reloc_code_real_type) ((int) BFD_RELOC_UNUSED + CGEN_OPERAND_INDEX (operand)));
215 fixP->tc_fix_data.insn = (PTR) insn;
216 fixP->tc_fix_data.opinfo = opinfo;
217
218 return fixP;
219}
220
1002d8ed
DE
221/* Used for communication between the next two procedures. */
222static jmp_buf expr_jmp_buf;
223
841eff9e
DE
224/* Callback for cgen interface. Parse the expression at *STRP.
225 The result is an error message or NULL for success (in which case
226 *STRP is advanced past the parsed text).
f3f00e94
DE
227 WANT is an indication of what the caller is looking for.
228 If WANT == CGEN_ASM_PARSE_INIT the caller is beginning to try to match
229 a table entry with the insn, reset the queued fixups counter.
230 An enum cgen_parse_operand_result is stored in RESULTP.
231 OPINDEX is the operand's table entry index.
841eff9e
DE
232 OPINFO is something the caller chooses to help in reloc determination.
233 The resulting value is stored in VALUEP. */
234
235const char *
f3f00e94 236cgen_parse_operand (want, strP, opindex, opinfo, resultP, valueP)
defc70bf
DE
237 enum cgen_parse_operand_type want;
238 const char ** strP;
239 int opindex;
240 int opinfo;
ebde3f62 241 enum cgen_parse_operand_result * resultP;
defc70bf 242 bfd_vma * valueP;
841eff9e 243{
1002d8ed 244#ifdef __STDC__
defc70bf
DE
245 /* These are volatile to survive the setjmp. */
246 char * volatile hold;
1002d8ed
DE
247 enum cgen_parse_operand_result * volatile resultP_1;
248#else
defc70bf
DE
249 static char * hold;
250 static enum cgen_parse_operand_result * resultP_1;
1002d8ed 251#endif
defc70bf
DE
252 const char * errmsg = NULL;
253 expressionS exp;
841eff9e 254
f3f00e94
DE
255 if (want == CGEN_PARSE_OPERAND_INIT)
256 {
257 cgen_asm_init_parse ();
258 return NULL;
259 }
260
1002d8ed 261 resultP_1 = resultP;
841eff9e 262 hold = input_line_pointer;
ebde3f62 263 input_line_pointer = (char *) * strP;
1002d8ed
DE
264
265 /* We rely on md_operand to longjmp back to us.
266 This is done via cgen_md_operand. */
267 if (setjmp (expr_jmp_buf) != 0)
268 {
269 input_line_pointer = (char *) hold;
ebde3f62 270 * resultP_1 = CGEN_PARSE_OPERAND_RESULT_ERROR;
1002d8ed
DE
271 return "illegal operand";
272 }
273
ebde3f62 274 expression (& exp);
1002d8ed 275
ebde3f62 276 * strP = input_line_pointer;
841eff9e
DE
277 input_line_pointer = hold;
278
f3f00e94
DE
279 /* FIXME: Need to check `want'. */
280
841eff9e
DE
281 switch (exp.X_op)
282 {
283 case O_illegal :
48401fcf 284 errmsg = _("illegal operand");
ebde3f62 285 * resultP = CGEN_PARSE_OPERAND_RESULT_ERROR;
841eff9e
DE
286 break;
287 case O_absent :
48401fcf 288 errmsg = _("missing operand");
ebde3f62 289 * resultP = CGEN_PARSE_OPERAND_RESULT_ERROR;
841eff9e
DE
290 break;
291 case O_constant :
ebde3f62
NC
292 * valueP = exp.X_add_number;
293 * resultP = CGEN_PARSE_OPERAND_RESULT_NUMBER;
841eff9e
DE
294 break;
295 case O_register :
ebde3f62
NC
296 * valueP = exp.X_add_number;
297 * resultP = CGEN_PARSE_OPERAND_RESULT_REGISTER;
841eff9e
DE
298 break;
299 default :
ebde3f62
NC
300 cgen_queue_fixup (opindex, opinfo, & exp);
301 * valueP = 0;
302 * resultP = CGEN_PARSE_OPERAND_RESULT_QUEUED;
841eff9e
DE
303 break;
304 }
305
306 return errmsg;
307}
308
1002d8ed
DE
309/* md_operand handler to catch unrecognized expressions and halt the
310 parsing process so the next entry can be tried.
311
312 ??? This could be done differently by adding code to `expression'. */
313
314void
315cgen_md_operand (expressionP)
ebde3f62 316 expressionS * expressionP;
1002d8ed
DE
317{
318 longjmp (expr_jmp_buf, 1);
319}
320
841eff9e
DE
321/* Finish assembling instruction INSN.
322 BUF contains what we've built up so far.
95effc2b 323 LENGTH is the size of the insn in bits.
defc70bf
DE
324 RELAX_P is non-zero if relaxable insns should be emitted as such.
325 Otherwise they're emitted in non-relaxable forms.
b817384c 326 The "result" is stored in RESULT if non-NULL. */
841eff9e 327
defc70bf
DE
328void
329cgen_asm_finish_insn (insn, buf, length, relax_p, result)
ebde3f62 330 const CGEN_INSN * insn;
defc70bf
DE
331 cgen_insn_t * buf;
332 unsigned int length;
333 int relax_p;
b70d5374 334 finished_insnS * result;
841eff9e 335{
defc70bf
DE
336 int i;
337 int relax_operand;
338 char * f;
841eff9e
DE
339 unsigned int byte_len = length / 8;
340
341 /* ??? Target foo issues various warnings here, so one might want to provide
342 a hook here. However, our caller is defined in tc-foo.c so there
343 shouldn't be a need for a hook. */
95effc2b 344
841eff9e
DE
345 /* Write out the instruction.
346 It is important to fetch enough space in one call to `frag_more'.
347 We use (f - frag_now->fr_literal) to compute where we are and we
348 don't want frag_now to change between calls.
349
350 Relaxable instructions: We need to ensure we allocate enough
351 space for the largest insn. */
352
353 if (CGEN_INSN_ATTR (insn, CGEN_INSN_RELAX) != 0)
354 abort (); /* These currently shouldn't get here. */
355
356 /* Is there a relaxable insn with the relaxable operand needing a fixup? */
357
358 relax_operand = -1;
defc70bf 359 if (relax_p && CGEN_INSN_ATTR (insn, CGEN_INSN_RELAXABLE) != 0)
841eff9e
DE
360 {
361 /* Scan the fixups for the operand affected by relaxing
362 (i.e. the branch address). */
363
ebde3f62 364 for (i = 0; i < num_fixups; ++ i)
841eff9e
DE
365 {
366 if (CGEN_OPERAND_ATTR (& CGEN_SYM (operand_table) [fixups[i].opindex],
367 CGEN_OPERAND_RELAX) != 0)
368 {
369 relax_operand = i;
370 break;
371 }
372 }
373 }
374
375 if (relax_operand != -1)
376 {
defc70bf 377 int max_len;
ebde3f62 378 fragS * old_frag;
841eff9e
DE
379
380#ifdef TC_CGEN_MAX_RELAX
381 max_len = TC_CGEN_MAX_RELAX (insn, byte_len);
382#else
383 max_len = CGEN_MAX_INSN_SIZE;
384#endif
385 /* Ensure variable part and fixed part are in same fragment. */
386 /* FIXME: Having to do this seems like a hack. */
387 frag_grow (max_len);
ebde3f62 388
841eff9e
DE
389 /* Allocate space for the fixed part. */
390 f = frag_more (byte_len);
ebde3f62 391
841eff9e
DE
392 /* Create a relaxable fragment for this instruction. */
393 old_frag = frag_now;
95effc2b 394
841eff9e
DE
395 frag_var (rs_machine_dependent,
396 max_len - byte_len /* max chars */,
397 0 /* variable part already allocated */,
398 /* FIXME: When we machine generate the relax table,
399 machine generate a macro to compute subtype. */
400 1 /* subtype */,
401 fixups[relax_operand].exp.X_add_symbol,
402 fixups[relax_operand].exp.X_add_number,
403 f);
ebde3f62 404
841eff9e
DE
405 /* Record the operand number with the fragment so md_convert_frag
406 can use cgen_md_record_fixup to record the appropriate reloc. */
ebde3f62 407 old_frag->fr_cgen.insn = insn;
1002d8ed 408 old_frag->fr_cgen.opindex = fixups[relax_operand].opindex;
ebde3f62 409 old_frag->fr_cgen.opinfo = fixups[relax_operand].opinfo;
defc70bf
DE
410 if (result)
411 result->frag = old_frag;
841eff9e
DE
412 }
413 else
defc70bf
DE
414 {
415 f = frag_more (byte_len);
416 if (result)
417 result->frag = frag_now;
418 }
841eff9e
DE
419
420 /* If we're recording insns as numbers (rather than a string of bytes),
421 target byte order handling is deferred until now. */
422#if 0 /*def CGEN_INT_INSN*/
423 switch (length)
424 {
425 case 16:
426 if (cgen_big_endian_p)
ebde3f62 427 bfd_putb16 ((bfd_vma) * buf, f);
841eff9e 428 else
ebde3f62 429 bfd_putl16 ((bfd_vma) * buf, f);
841eff9e
DE
430 break;
431 case 32:
432 if (cgen_big_endian_p)
ebde3f62 433 bfd_putb32 ((bfd_vma) * buf, f);
841eff9e 434 else
ebde3f62 435 bfd_putl32 ((bfd_vma) * buf, f);
841eff9e
DE
436 break;
437 default:
438 abort ();
439 }
440#else
441 memcpy (f, buf, byte_len);
442#endif
443
444 /* Create any fixups. */
445 for (i = 0; i < num_fixups; ++i)
446 {
defc70bf
DE
447 fixS * fixP;
448
841eff9e
DE
449 /* Don't create fixups for these. That's done during relaxation.
450 We don't need to test for CGEN_INSN_RELAX as they can't get here
451 (see above). */
defc70bf
DE
452 if (relax_p
453 && CGEN_INSN_ATTR (insn, CGEN_INSN_RELAXABLE) != 0
841eff9e
DE
454 && CGEN_OPERAND_ATTR (& CGEN_SYM (operand_table) [fixups[i].opindex],
455 CGEN_OPERAND_RELAX) != 0)
456 continue;
457
458#ifndef md_cgen_record_fixup_exp
459#define md_cgen_record_fixup_exp cgen_record_fixup_exp
460#endif
461
defc70bf
DE
462 fixP = md_cgen_record_fixup_exp (frag_now, f - frag_now->fr_literal,
463 insn, length,
464 & CGEN_SYM (operand_table) [fixups[i].opindex],
465 fixups[i].opinfo,
466 & fixups[i].exp);
467 if (result)
468 result->fixups[i] = fixP;
841eff9e 469 }
95effc2b 470
defc70bf
DE
471 if (result)
472 {
473 result->num_fixups = num_fixups;
474 result->addr = f;
475 }
841eff9e
DE
476}
477
478/* Apply a fixup to the object code. This is called for all the
479 fixups we generated by the call to fix_new_exp, above. In the call
480 above we used a reloc code which was the largest legal reloc code
481 plus the operand index. Here we undo that to recover the operand
482 index. At this point all symbol values should be fully resolved,
483 and we attempt to completely resolve the reloc. If we can not do
484 that, we determine the correct reloc code and put it back in the fixup. */
485
486/* FIXME: This function handles some of the fixups and bfd_install_relocation
487 handles the rest. bfd_install_relocation (or some other bfd function)
488 should handle them all. */
489
490int
491cgen_md_apply_fix3 (fixP, valueP, seg)
ebde3f62
NC
492 fixS * fixP;
493 valueT * valueP;
494 segT seg;
841eff9e 495{
48401fcf
TT
496 char * where = fixP->fx_frag->fr_literal + fixP->fx_where;
497 valueT value;
841eff9e
DE
498
499 /* FIXME FIXME FIXME: The value we are passed in *valuep includes
500 the symbol values. Since we are using BFD_ASSEMBLER, if we are
501 doing this relocation the code in write.c is going to call
502 bfd_install_relocation, which is also going to use the symbol
503 value. That means that if the reloc is fully resolved we want to
504 use *valuep since bfd_install_relocation is not being used.
505 However, if the reloc is not fully resolved we do not want to use
506 *valuep, and must use fx_offset instead. However, if the reloc
507 is PC relative, we do want to use *valuep since it includes the
508 result of md_pcrel_from. This is confusing. */
509
510 if (fixP->fx_addsy == (symbolS *) NULL)
511 {
ebde3f62 512 value = * valueP;
841eff9e
DE
513 fixP->fx_done = 1;
514 }
515 else if (fixP->fx_pcrel)
ebde3f62 516 value = * valueP;
841eff9e
DE
517 else
518 {
519 value = fixP->fx_offset;
520 if (fixP->fx_subsy != (symbolS *) NULL)
521 {
522 if (S_GET_SEGMENT (fixP->fx_subsy) == absolute_section)
523 value -= S_GET_VALUE (fixP->fx_subsy);
524 else
525 {
526 /* We don't actually support subtracting a symbol. */
527 as_bad_where (fixP->fx_file, fixP->fx_line,
48401fcf 528 _("expression too complex"));
841eff9e
DE
529 }
530 }
531 }
532
533 if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
534 {
ebde3f62
NC
535 int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
536 const CGEN_OPERAND * operand = & CGEN_SYM (operand_table) [opindex];
537 const char * errmsg;
841eff9e 538 bfd_reloc_code_real_type reloc_type;
ebde3f62
NC
539 CGEN_FIELDS fields;
540 const CGEN_INSN * insn = (CGEN_INSN *) fixP->tc_fix_data.insn;
841eff9e
DE
541
542 /* If the reloc has been fully resolved finish the operand here. */
543 /* FIXME: This duplicates the capabilities of code in BFD. */
544 if (fixP->fx_done
545 /* FIXME: If partial_inplace isn't set bfd_install_relocation won't
546 finish the job. Testing for pcrel is a temporary hack. */
547 || fixP->fx_pcrel)
548 {
ebde3f62 549 CGEN_FIELDS_BITSIZE (& fields) = CGEN_INSN_BITSIZE (insn);
b817384c
DE
550 CGEN_SYM (set_vma_operand) (opindex, & fields, (bfd_vma) value);
551 /* ??? 0 is passed for `pc' */
552 errmsg = CGEN_SYM (insert_operand) (opindex, & fields, where,
553 (bfd_vma) 0);
841eff9e 554 if (errmsg)
b817384c 555 as_warn_where (fixP->fx_file, fixP->fx_line, "%s", errmsg);
841eff9e
DE
556 }
557
558 if (fixP->fx_done)
559 return 1;
560
561 /* The operand isn't fully resolved. Determine a BFD reloc value
562 based on the operand information and leave it to
563 bfd_install_relocation. Note that this doesn't work when
564 partial_inplace == false. */
565
566 reloc_type = CGEN_SYM (lookup_reloc) (insn, operand, fixP);
567 if (reloc_type != BFD_RELOC_NONE)
568 {
569 fixP->fx_r_type = reloc_type;
570 }
571 else
572 {
573 as_bad_where (fixP->fx_file, fixP->fx_line,
48401fcf 574 _("unresolved expression that must be resolved"));
841eff9e
DE
575 fixP->fx_done = 1;
576 return 1;
577 }
578 }
579 else if (fixP->fx_done)
580 {
581 /* We're finished with this fixup. Install it because
582 bfd_install_relocation won't be called to do it. */
583 switch (fixP->fx_r_type)
584 {
585 case BFD_RELOC_8:
586 md_number_to_chars (where, value, 1);
587 break;
588 case BFD_RELOC_16:
589 md_number_to_chars (where, value, 2);
590 break;
591 case BFD_RELOC_32:
592 md_number_to_chars (where, value, 4);
593 break;
594 /* FIXME: later add support for 64 bits. */
595 default:
596 abort ();
597 }
598 }
599 else
600 {
601 /* bfd_install_relocation will be called to finish things up. */
602 }
603
604 /* Tuck `value' away for use by tc_gen_reloc.
605 See the comment describing fx_addnumber in write.h.
606 This field is misnamed (or misused :-). */
607 fixP->fx_addnumber = value;
608
609 return 1;
610}
611
612/* Translate internal representation of relocation info to BFD target format.
613
614 FIXME: To what extent can we get all relevant targets to use this? */
615
616arelent *
617cgen_tc_gen_reloc (section, fixP)
ebde3f62
NC
618 asection * section;
619 fixS * fixP;
841eff9e 620{
ebde3f62 621 arelent * reloc;
841eff9e 622
1002d8ed 623 reloc = (arelent *) bfd_alloc (stdoutput, sizeof (arelent));
841eff9e
DE
624
625 reloc->howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type);
626 if (reloc->howto == (reloc_howto_type *) NULL)
627 {
628 as_bad_where (fixP->fx_file, fixP->fx_line,
48401fcf 629 _("internal error: can't export reloc type %d (`%s')"),
841eff9e
DE
630 fixP->fx_r_type, bfd_get_reloc_code_name (fixP->fx_r_type));
631 return NULL;
632 }
633
634 assert (!fixP->fx_pcrel == !reloc->howto->pc_relative);
635
ebde3f62
NC
636 reloc->sym_ptr_ptr = & fixP->fx_addsy->bsym;
637 reloc->address = fixP->fx_frag->fr_address + fixP->fx_where;
638 reloc->addend = fixP->fx_addnumber;
841eff9e
DE
639
640 return reloc;
641}
This page took 0.089734 seconds and 4 git commands to generate.