From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50394) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWitL-0002WY-RJ for qemu-devel@nongnu.org; Thu, 17 Oct 2013 04:25:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VWitF-0003Wa-7H for qemu-devel@nongnu.org; Thu, 17 Oct 2013 04:25:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41511) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWitE-0003NZ-Ux for qemu-devel@nongnu.org; Thu, 17 Oct 2013 04:25:05 -0400 Date: Thu, 17 Oct 2013 11:27:37 +0300 From: "Michael S. Tsirkin" Message-ID: <20131017082737.GA14218@redhat.com> References: <20131016194653.GA10517@redhat.com> <20131017062751.GK15657@redhat.com> <20131017081231.GA13975@redhat.com> <20131017082027.GA16998@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20131017082027.GA16998@redhat.com> Subject: Re: [Qemu-devel] [PATCH] kvm-unittest: fix build with gcc 4.3.X and older List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gleb Natapov Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, kvm@vger.kernel.org On Thu, Oct 17, 2013 at 11:20:27AM +0300, Gleb Natapov wrote: > On Thu, Oct 17, 2013 at 11:12:31AM +0300, Michael S. Tsirkin wrote: > > On Thu, Oct 17, 2013 at 09:27:51AM +0300, Gleb Natapov wrote: > > > On Wed, Oct 16, 2013 at 10:46:53PM +0300, Michael S. Tsirkin wrote: > > > > Old GCC didn't let you reference variable by > > > > number if it is listed with a specific register > > > > constraint, on the assumption you can just > > > > use the register name explicitly. > > > > > > > > Build fails with errors like this: > > > > a.c:6: error: invalid 'asm': invalid operand code 'd' > > > > > > > Is it worth to support such ancient compiler? Nobody complained till > > > now. > > > > Well it's not as widely used as kvm itself yet :) > > The patch seems simple enough though. > > > > > BTW with your patch I still cannot compile with 4.2: > > > > > > x86/s3.c: In function 'main': > > > x86/s3.c:145: error: inconsistent operand constraints in an 'asm' > > > > OK that's easy to fix. > > > > > > To fix, let's just use %eax %al etc. > > > > > > > Only %d0 does not work and dropping "d" fixes it since compiler can > > > figure out correct register from variable size. The patch bellow fixes > > > compilation for 4.2. > > > > It does produce warnings with -Wall though: > > Assembler messages: > > Warning: using `%ax' instead of `%eax' due to `w' suffix > > Warning: using `%al' instead of `%eax' due to `b' suffix > > > Not for me. No warning with 4.7.3 and 4.2. .s file produced by gcc shows > correct assembly with my patch. 4.3 doesn't. We have the "a" constraint there anyway - so what's the issue with just writing %eax etc? I think it's safer than relying on compiler to do the right thing. > -- > Gleb.