From: kkojima Date: Sat, 29 Aug 2009 10:38:32 +0000 (+0000) Subject: * config/tc-sh.c (md_apply_fix): Extend sign of the offset value X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=f01e72c5c4642572732114d3df3ae3c8977f6263;p=pf3gnuchains%2Fpf3gnuchains3x.git * config/tc-sh.c (md_apply_fix): Extend sign of the offset value for 64-bit host. * gas/sh/sign-extension.d: New file. * gas/sh/sign-extension.s: New file. * gas/sh/basic.exp: Run new test. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 70d17e44a2..2de1fe870a 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2009-08-29 Matt Fleming + + * config/tc-sh.c (md_apply_fix): Extend sign of the offset value + for 64-bit host. + 2009-08-28 H.J. Lu * config/tc-i386.c (cpu_arch): Use PROCESSOR_L1OM on "l1om". diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c index 24a295484b..4bc5ee66de 100644 --- a/gas/config/tc-sh.c +++ b/gas/config/tc-sh.c @@ -1,6 +1,6 @@ /* tc-sh.c -- Assemble code for the Renesas / SuperH SH Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. + 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -4183,6 +4183,9 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) val = ((val >> shift) | ((long) -1 & ~ ((long) -1 >> shift))); } + + /* Extend sign for 64-bit host. */ + val = ((val & 0xffffffff) ^ 0x80000000) - 0x80000000; if (max != 0 && (val < min || val > max)) as_bad_where (fixP->fx_file, fixP->fx_line, _("offset out of range")); else if (max != 0) diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 529e323c13..ab53121480 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2009-08-29 Matt Fleming + + * gas/sh/sign-extension.d: New file. + * gas/sh/sign-extension.s: New file. + * gas/sh/basic.exp: Run new test. + 2009-08-28 H.J. Lu * gas/i386/l1om.d: Check elf64-l1om format. diff --git a/gas/testsuite/gas/sh/basic.exp b/gas/testsuite/gas/sh/basic.exp index ffa895216f..ab4e1903a1 100644 --- a/gas/testsuite/gas/sh/basic.exp +++ b/gas/testsuite/gas/sh/basic.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1995, 1996, 1997, 2002, 2003, 2004, 2007 +# Copyright (C) 1995, 1996, 1997, 2002, 2003, 2004, 2007, 2009 # Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify @@ -169,6 +169,8 @@ if [istarget sh*-*-*] then { run_dump_test "reg-prefix" run_dump_test "too_large" + + run_dump_test "sign-extension" } } diff --git a/gas/testsuite/gas/sh/sign-extension.d b/gas/testsuite/gas/sh/sign-extension.d new file mode 100644 index 0000000000..eeae7bddf6 --- /dev/null +++ b/gas/testsuite/gas/sh/sign-extension.d @@ -0,0 +1,11 @@ +#as: -little +#objdump: -drj.text +#name: Sign-extended immediate + +.*: file format .*sh.* + +Disassembly of section \.text: + +00000000 : + 0: f0 e0 mov #-16,r0 + 2: 09 00 nop diff --git a/gas/testsuite/gas/sh/sign-extension.s b/gas/testsuite/gas/sh/sign-extension.s new file mode 100644 index 0000000000..73d0167941 --- /dev/null +++ b/gas/testsuite/gas/sh/sign-extension.s @@ -0,0 +1,3 @@ + .align 2 +foo: + mov #0xfffffff0, r0