Subject: Re: linux-next: triage for March 18, 2012

From: David Howells <[email-masked]>
Date: Mon, 19 Mar 2012 15:21:31 +0000

David Howells <[email-masked]> wrote:

> Tony Breeds <[email-masked]> wrote:
> 
> > > 	frv:defconfig  (arch/frv/kernel/head.S operand out of range)
> 
> What binutils are you using?  I suspect this is fixed by a patch that only
> went upstream very recently.  Are you using a 64-bit machine to do your
> compilation?

Here's a patch I got from Nick Clifton to fix 64-bit binutils to handle
representing things like 0xfffffff1 as a 32-bit negative immediate argument.
It has been applied upstream.

David
---
Index: opcodes/cgen-asm.c
===================================================================
RCS file: /cvs/src/src/opcodes/cgen-asm.c,v
retrieving revision 1.14
diff -c -3 -p -r1.14 cgen-asm.c
*** opcodes/cgen-asm.c	2 Sep 2009 07:20:29 -0000	1.14
--- opcodes/cgen-asm.c	15 Dec 2011 08:27:02 -0000
*************** cgen_parse_signed_integer (CGEN_CPU_DESC
*** 268,274 ****
       &result, &value);
    /* FIXME: Examine `result'.  */
    if (!errmsg)
!     *valuep = value;
    return errmsg;
  }
  
--- 268,291 ----
       &result, &value);
    /* FIXME: Examine `result'.  */
    if (!errmsg)
!     {
! #if 1
!       /* Handle the case where a hex value is parsed on a 64-bit host.
! 	 A value like 0xffffe000 is clearly intended to be a negative
! 	 16-bit value, but on a 64-bit host it will be parsed by gas
! 	 as 0x00000000ffffe000.
! 
! 	 The shifts below are designed not to produce compile time
! 	 warnings when compiled on a 32-bit host.  */
!       if (sizeof (value) > 4
! 	  && result == CGEN_PARSE_OPERAND_RESULT_NUMBER
! 	  && value > 0
! 	  && (value & 0x80000000)
! 	  && ((value >> 31) == 1))
! 	value |= -1 << 31;
! #endif
!       *valuep = value;
!     }
    return errmsg;
  }
  
Index: opcodes/frv-asm.c
===================================================================
RCS file: /cvs/src/src/opcodes/frv-asm.c,v
retrieving revision 1.19
diff -c -3 -p -r1.19 frv-asm.c
*** opcodes/frv-asm.c	27 Jun 2010 04:07:55 -0000	1.19
--- opcodes/frv-asm.c	15 Dec 2011 08:27:02 -0000
*************** parse_uhi16 (CGEN_CPU_DESC cd,
*** 465,475 ****
  	  if (errmsg == NULL
  	      && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
  	    {
! 	      /* If bfd_vma is wider than 32 bits, but we have a sign-
! 		 or zero-extension, truncate it.  */
! 	      if (value >= - ((bfd_vma)1 << 31)
! 		  || value <= ((bfd_vma)1 << 31) - (bfd_vma)1)
  		value &= (((bfd_vma)1 << 16) << 16) - 1;
  	      value >>= 16;
  	    }
  	  *valuep = value;
--- 465,475 ----
  	  if (errmsg == NULL
  	      && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
  	    {
! 	      /* If value is wider than 32 bits then be
! 		 careful about how we extract bits 16-31.  */
! 	      if (sizeof (value) > 4)
  		value &= (((bfd_vma)1 << 16) << 16) - 1;
+ 
  	      value >>= 16;
  	    }
  	  *valuep = value;