From: Jeff Law Date: Thu, 6 Mar 1997 20:58:22 +0000 (+0000) Subject: * config/tc-mn10300.c (md_assemble): Don't use any MN10300 specific X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a405bb3eb00de021827910e07382536631540183;p=binutils-gdb.git * config/tc-mn10300.c (md_assemble): Don't use any MN10300 specific relocs anymore. Tweak fx_offset for pc-relative relocs. Cleanup/simplification of mn10300 port. Bring over changes from mn10200 port. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 2fbf962e86b..e0a14687732 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +Thu Mar 6 13:55:32 1997 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10300.c (md_assemble): Don't use any MN10300 specific + relocs anymore. Tweak fx_offset for pc-relative relocs. + Wed Mar 5 15:46:16 1997 Ian Lance Taylor * cond.c (s_ifc): Call mri_comment_field and mri_comment_end when diff --git a/gas/config/tc-mn10300.c b/gas/config/tc-mn10300.c index 756e3c5660a..a86b2db847f 100644 --- a/gas/config/tc-mn10300.c +++ b/gas/config/tc-mn10300.c @@ -893,6 +893,7 @@ keep_going: else { int reloc, pcrel, reloc_size, offset; + fixS *fixP; reloc = BFD_RELOC_NONE; /* How big is the reloc? Remember SPLIT relocs are @@ -927,11 +928,7 @@ keep_going: /* Choose a proper BFD relocation type. */ if (pcrel) { - if (size == 6) - reloc = BFD_RELOC_MN10300_32_PCREL; - else if (size == 4) - reloc = BFD_RELOC_MN10300_16_PCREL; - else if (reloc_size == 32) + if (reloc_size == 32) reloc = BFD_RELOC_32_PCREL; else if (reloc_size == 16) reloc = BFD_RELOC_16_PCREL; @@ -943,9 +940,9 @@ keep_going: else { if (reloc_size == 32) - reloc = BFD_RELOC_32 + reloc = BFD_RELOC_32; else if (reloc_size == 16) - reloc = BFD_RELOC_16 + reloc = BFD_RELOC_16; else if (reloc_size == 8) reloc = BFD_RELOC_8; else @@ -961,9 +958,12 @@ keep_going: else if (reloc_size == 32) reloc_size = 2; - fix_new_exp (frag_now, f - frag_now->fr_literal + offset, reloc_size, - &fixups[i].exp, pcrel, - ((bfd_reloc_code_real_type) reloc)); + fixP = fix_new_exp (frag_now, f - frag_now->fr_literal + offset, + reloc_size, &fixups[i].exp, pcrel, + ((bfd_reloc_code_real_type) reloc)); + + if (pcrel) + fixP->fx_offset += offset; } } } @@ -979,17 +979,28 @@ tc_gen_reloc (seg, fixp) { arelent *reloc; reloc = (arelent *) bfd_alloc_by_size_t (stdoutput, sizeof (arelent)); - reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym; - reloc->address = fixp->fx_frag->fr_address + fixp->fx_where; + reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type); if (reloc->howto == (reloc_howto_type *) NULL) { as_bad_where (fixp->fx_file, fixp->fx_line, - "reloc %d not supported by object file format", (int)fixp->fx_r_type); + "reloc %d not supported by object file format", + (int)fixp->fx_r_type); return NULL; } - reloc->addend = fixp->fx_offset; - /* printf("tc_gen_reloc: addr=%x addend=%x\n", reloc->address, reloc->addend); */ + reloc->address = fixp->fx_frag->fr_address + fixp->fx_where; + + if (fixp->fx_addsy && fixp->fx_subsy) + { + reloc->sym_ptr_ptr = &bfd_abs_symbol; + reloc->addend = (S_GET_VALUE (fixp->fx_addsy) + - S_GET_VALUE (fixp->fx_subsy) + fixp->fx_offset); + } + else + { + reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym; + reloc->addend = fixp->fx_offset; + } return reloc; }