Received: from resqmta-po-06v.sys.comcast.net ([96.114.154.165]:33524 "EHLO resqmta-po-06v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S27009482AbaIVJbrdBq0k (ORCPT ); Mon, 22 Sep 2014 11:31:47 +0200 Message-ID: <541FEC77.3010905@gentoo.org> Date: Mon, 22 Sep 2014 05:31:35 -0400 From: Joshua Kinard MIME-Version: 1.0 Subject: Re: gcc-4.8+ and R10000+ References: <540C165F.7030307@gentoo.org> <540D7A7B.9090905@gentoo.org> In-Reply-To: <540D7A7B.9090905@gentoo.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Return-Path: Sender: linux-mips-bounce@linux-mips.org Errors-to: linux-mips-bounce@linux-mips.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-subscribe: List-owner: List-post: List-archive: To: linux-mips@linux-mips.org Message-ID: <20140922093135.Mhgt3iymA5Q70a1V4Vq4KJY-_Gy4HpgFanBpqsljRh0@z> On 09/08/2014 05:44, Joshua Kinard wrote: > On 09/08/2014 04:11, Miod Vallat wrote: >>> Disassembling a statically-built copy of the "sln" binary generated by >>> glibc's compile phase, there are slight differences in how gcc-4.7 and >>> gcc-4.8 are compiling the __lll_lock_wait_private function. The key >>> differences in the output asm are >>> this: >> >> [...] >> >>> gcc-4.8: >>> x+4 >>> ... >>> x+24 bne v1,v0, >>> ... >>> x+32 0x7c03e83b /* rdhwr */ >>> x+36 li a2,2 >>> x+40 lw a1,-29832(v1) >>> x+44 move a3,zero >>> x+48 li v0,4238 >>> x+52 syscall >>> * x+56 ll v0,0(s0) >>> * x+60 li at,2 >>> * x+64 sc at,0 >> >> Note how the sc address is no longer 0(s0). Since the address does >> not match the address used in the ll instruction, sc will always >> fail on the R10k. > > That would be a typo on my part. I typed that out by hand and just missed it. It should read: > > gcc-4.8: > x+4 > ... > x+24 bne v1,v0, > ... > x+32 0x7c03e83b /* rdhwr */ > x+36 li a2,2 > x+40 lw a1,-29832(v1) > x+44 move a3,zero > x+48 li v0,4238 > x+52 syscall > * x+56 ll v0,0(s0) > * x+60 li at,2 > * x+64 sc at,0(s0) > x+68 beqzl at, > x+72 nop > x+76 sync > x+80 bnez v0, I did some more tracing. It seems the issue with glibc itself stems from the addition of __atomic_* builtins added generally in gcc-4.7 and MIPS-specifically in gcc-4.8: