From: Jeff Law Date: Fri, 31 Jan 1997 22:23:10 +0000 (+0000) Subject: * config/tc-mn10200.c (md_relax_table): Add entries to allow X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f5d7f6fb5384776235305c363bab41c8c261779e;p=binutils-gdb.git * config/tc-mn10200.c (md_relax_table): Add entries to allow jmp -> bra relaxing. (md_convert_frag): Handle jmp->bra relaxing. (md_assemble): Handle jmp->bra relaxing. (md_estimate_size_before_relax): Likewise. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 6c5982bfb29..c917491f9af 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,11 @@ +Fri Jan 31 15:21:02 1997 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10200.c (md_relax_table): Add entries to allow + jmp -> bra relaxing. + (md_convert_frag): Handle jmp->bra relaxing. + (md_assemble): Handle jmp->bra relaxing. + (md_estimate_size_before_relax): Likewise. + Fri Jan 31 13:15:05 1997 Alan Modra * config/tc-i386.c (i386_align_code): Add comments explaining the diff --git a/gas/config/tc-mn10200.c b/gas/config/tc-mn10200.c index 3046a2981ee..2fd17849d91 100644 --- a/gas/config/tc-mn10200.c +++ b/gas/config/tc-mn10200.c @@ -62,9 +62,13 @@ const relax_typeS md_relax_table[] = { {0x7f, -0x80, 3, 4}, {0x7fff, -0x8000, 6, 5}, {0x7fffff, -0x8000000, 8, 0}, - /* jmp/jsr relaxing, could have a bra variant too! */ + /* jsr relaxing */ {0x7fff, -0x8000, 3, 7}, {0x7fffff, -0x8000000, 5, 0}, + /* jmp relaxing */ + {0x7f, -0x80, 2, 9}, + {0x7fff, -0x8000, 3, 10}, + {0x7fffff, -0x8000000, 5, 0}, }; /* local functions */ @@ -667,20 +671,37 @@ md_convert_frag (abfd, sec, fragP) else if (fragP->fr_subtype == 7) { int offset = fragP->fr_fix; - int opcode = fragP->fr_literal[offset] & 0xff; + fragP->fr_literal[offset] = 0xf4; + fragP->fr_literal[offset + 1] = 0xe1; - if (opcode == 0xfc) - { - fragP->fr_literal[offset] = 0xf4; - fragP->fr_literal[offset + 1] = 0xe0; - } - else if (opcode == 0xfd) - { - fragP->fr_literal[offset] = 0xf4; - fragP->fr_literal[offset + 1] = 0xe1; - } - else - abort (); + fix_new (fragP, fragP->fr_fix + 2, 4, fragP->fr_symbol, + fragP->fr_offset + 2, 1, BFD_RELOC_24_PCREL); + fragP->fr_var = 0; + fragP->fr_fix += 5; + } + else if (fragP->fr_subtype == 8) + { + fragP->fr_literal[fragP->fr_fix] = 0xea; + fix_new (fragP, fragP->fr_fix + 1, 1, fragP->fr_symbol, + fragP->fr_offset + 1, 1, BFD_RELOC_8_PCREL); + fragP->fr_var = 0; + fragP->fr_fix += 2; + } + else if (fragP->fr_subtype == 9) + { + int offset = fragP->fr_fix; + fragP->fr_literal[offset] = 0xfc; + + fix_new (fragP, fragP->fr_fix + 1, 4, fragP->fr_symbol, + fragP->fr_offset + 1, 1, BFD_RELOC_16_PCREL); + fragP->fr_var = 0; + fragP->fr_fix += 3; + } + else if (fragP->fr_subtype == 10) + { + int offset = fragP->fr_fix; + fragP->fr_literal[offset] = 0xf4; + fragP->fr_literal[offset + 1] = 0xe0; fix_new (fragP, fragP->fr_fix + 2, 4, fragP->fr_symbol, fragP->fr_offset + 2, 1, BFD_RELOC_24_PCREL); @@ -1019,13 +1040,19 @@ keep_going: { int type; - if (size == 2) + /* bCC */ + if (size == 2 && opcode->opcode != 0xfc0000) type = 0; - else if (size == 3 - && opcode->opcode != 0xfd0000 && opcode->opcode != 0xfc0000) - type = 3; - else + /* jsr */ + else if (size == 3 && opcode->opcode == 0xfd0000) type = 6; + /* jmp */ + else if (size == 3 && opcode->opcode == 0xfc0000) + type = 8; + /* bCCx */ + else + type = 3; + f = frag_var (rs_machine_dependent, 8, 8 - size, type, fixups[0].exp.X_add_symbol, fixups[0].exp.X_add_number, @@ -1208,8 +1235,17 @@ md_estimate_size_before_relax (fragp, seg) fragp->fr_subtype = 7; return 5; } + return 3; + } + if (fragp->fr_subtype == 8) + { + if (!S_IS_DEFINED (fragp->fr_symbol)) + { + fragp->fr_subtype = 10; + return 5; + } + return 2; } - return 3; } long