diff options
author | Nick Clifton <nickc@redhat.com> | 2013-03-21 16:08:07 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2013-03-21 16:08:07 +0000 |
commit | 81f5558e3d93654ed79b6ea28850a4798ea1404f (patch) | |
tree | 09a020b2f58cf3b34739e07297561af0184b61ba /gas | |
parent | b2f83c08372136fe9fe7d1df2feb5566c8b883fb (diff) | |
download | binutils-81f5558e3d93654ed79b6ea28850a4798ea1404f.zip binutils-81f5558e3d93654ed79b6ea28850a4798ea1404f.tar.gz binutils-81f5558e3d93654ed79b6ea28850a4798ea1404f.tar.bz2 |
* elf32-h8300 (h8_relax_section): Add new relaxation of mov
@(disp:32,ERx) to mov @(disp:16,ERx).
(R_H8_DISP32A16): New reloc.
Comments added and corrected.
* reloc.c (BFD_RELOC_H8_DISP32A16): New reloc.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
* ld.texinfo (H8/300): Add description of relaxation of
mov @(disp:32,ERx) to mov @(disp:16,ERx).
* ld-h8300/h8300.exp: Add new relax-7 test on ELF.
* ld-h8300/relax-2.s: Add other direction and .w/.l variants of
mov insns.
* ld-h8300/relax-2.d: Update expected disassembly.
* ld-h8300/relax-7a.s: New: tests for mov @(disp:32,ERx) -> mov
@(disp:16,ERx).
* ld-h8300/relax-7b.s: New: Likewise.
* ld-h8300/relax-7.d: New: expected disassembly.
* config/tc-h8300.c (do_a_fix_imm): Add relaxation of mov
@(disp:32,ERx) to mov @(disp:16,ERx) insns by new reloc
R_H8_DISP32A16.
* config/tc-h8300.h: Remove duplicated defines.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 7 | ||||
-rw-r--r-- | gas/config/tc-h8300.c | 33 | ||||
-rw-r--r-- | gas/config/tc-h8300.h | 6 |
3 files changed, 32 insertions, 14 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 4e09946..c36941a 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2013-03-21 Michael Schewe <michael.schewe@gmx.net> + + * config/tc-h8300.c (do_a_fix_imm): Add relaxation of mov + @(disp:32,ERx) to mov @(disp:16,ERx) insns by new reloc + R_H8_DISP32A16. + * config/tc-h8300.h: Remove duplicated defines. + 2013-03-21 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com> PR gas/15282 diff --git a/gas/config/tc-h8300.c b/gas/config/tc-h8300.c index bbf8c0e..032831b 100644 --- a/gas/config/tc-h8300.c +++ b/gas/config/tc-h8300.c @@ -1,7 +1,5 @@ /* tc-h8300.c -- Assemble code for the Renesas H8/300 - Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, - 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 - Free Software Foundation, Inc. + Copyright 1991-2013 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -1396,7 +1394,12 @@ do_a_fix_imm (int offset, int nibble, struct h8_op *operand, int relaxmode, cons bytes[3] |= operand->exp.X_add_number >> 0; if (relaxmode != 0) { - idx = (relaxmode == 2) ? R_MOV24B1 : R_MOVL1; +#ifdef OBJ_ELF + if ((operand->mode & MODE) == DISP && relaxmode == 1) + idx = BFD_RELOC_H8_DISP32A16; + else +#endif + idx = (relaxmode == 2) ? R_MOV24B1 : R_MOVL1; fix_new_exp (frag_now, offset, 4, &operand->exp, 0, idx); } break; @@ -1410,6 +1413,11 @@ do_a_fix_imm (int offset, int nibble, struct h8_op *operand, int relaxmode, cons case L_32: size = 4; where = (operand->mode & SIZE) == L_24 ? -1 : 0; +#ifdef OBJ_ELF + if ((operand->mode & MODE) == DISP && relaxmode == 1) + idx = BFD_RELOC_H8_DISP32A16; + else +#endif if (relaxmode == 2) idx = R_MOV24B1; else if (relaxmode == 1) @@ -1616,7 +1624,7 @@ build_bytes (const struct h8_instruction *this_try, struct h8_op *operand) for (i = 0; i < this_try->length; i++) output[i] = (asnibbles[i * 2] << 4) | asnibbles[i * 2 + 1]; - /* Note if this is a movb or a bit manipulation instruction + /* Note if this is a mov.b or a bit manipulation instruction there is a special relaxation which only applies. */ if ( this_try->opcode->how == O (O_MOV, SB) || this_try->opcode->how == O (O_BCLR, SB) @@ -1642,10 +1650,17 @@ build_bytes (const struct h8_instruction *this_try, struct h8_op *operand) int x_mode = x & MODE; if (x_mode == IMM || x_mode == DISP) - do_a_fix_imm (output - frag_now->fr_literal + op_at[i] / 2, - op_at[i] & 1, operand + i, (x & MEMRELAX) != 0, - this_try); - + { +#ifndef OBJ_ELF + /* Remove MEMRELAX flag added in h8300.h on mov with + addressing mode "register indirect with displacement". */ + if (x_mode == DISP) + x &= ~MEMRELAX; +#endif + do_a_fix_imm (output - frag_now->fr_literal + op_at[i] / 2, + op_at[i] & 1, operand + i, (x & MEMRELAX) != 0, + this_try); + } else if (x_mode == ABS) do_a_fix_imm (output - frag_now->fr_literal + op_at[i] / 2, op_at[i] & 1, operand + i, diff --git a/gas/config/tc-h8300.h b/gas/config/tc-h8300.h index f86cf94..0a2e828 100644 --- a/gas/config/tc-h8300.h +++ b/gas/config/tc-h8300.h @@ -1,7 +1,5 @@ /* This file is tc-h8300.h - Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, - 1997, 1998, 2000, 2001, 2002, 2003, 2005, 2007, 2008 - Free Software Foundation, Inc. + Copyright 1987-2013 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -60,8 +58,6 @@ struct internal_reloc; ports. */ #define R_MOV24B1 BFD_RELOC_H8_DIR24A8 #define R_MOVL1 BFD_RELOC_H8_DIR32A16 -#define R_MOV24B1 BFD_RELOC_H8_DIR24A8 -#define R_MOVL1 BFD_RELOC_H8_DIR32A16 #define R_RELLONG BFD_RELOC_32 #define R_MOV16B1 BFD_RELOC_H8_DIR16A8 #define R_RELWORD BFD_RELOC_16 |