From owner-svn-src-all@FreeBSD.ORG Mon Apr 9 01:37:07 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 55A441065670 for ; Mon, 9 Apr 2012 01:37:07 +0000 (UTC) (envelope-from juli@clockworksquid.com) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id D7D5C8FC0A for ; Mon, 9 Apr 2012 01:37:06 +0000 (UTC) Received: by wern13 with SMTP id n13so3101666wer.13 for ; Sun, 08 Apr 2012 18:37:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding:x-gm-message-state; bh=Hnp3kBBlhfBfUNWX6QjauueMiGYAxaMOAzIs2YVCTL8=; b=arqcMYuWWNf/BLuygDj0gqHBu6kD8sti3o/YW9luRhdjuVK90awPWqUBxkKnEh29TS GXB/KKe0/ZHEReHsDQdzJ9Le1zfXuDHlkAEiJRLChvv8m6kdaaL4NDIiHrL4SvDDfACn O1yk+dlxEdkDmQdAAZcqH6cFaGa7okRqB727SmvSiK1OUKJU0lFtHMpt/EdRGlgOvsbq yswLdA0aqJIq1FMsrlwBz/MM4RdqQRY2T3WgDF6k0C8L+6Ua5GpwkvOI98LW9UlqlNvB EIs9Nhjr7/ZpHY+LOhN6o2Kqw9rBFG0pYCO+JaPahD7otvAQhuQdsE7fRUYtv8Kb8xPk J0iQ== Received: by 10.180.97.4 with SMTP id dw4mr12259560wib.18.1333935425813; Sun, 08 Apr 2012 18:37:05 -0700 (PDT) MIME-Version: 1.0 Sender: juli@clockworksquid.com Received: by 10.180.86.37 with HTTP; Sun, 8 Apr 2012 18:36:45 -0700 (PDT) In-Reply-To: <20120408164521.55aecdd1@fubar.geek.nz> References: <201204080436.q384aRXS093116@svn.freebsd.org> <20120408164521.55aecdd1@fubar.geek.nz> From: Juli Mallett Date: Sun, 8 Apr 2012 18:36:45 -0700 X-Google-Sender-Auth: 0dIQqujAo5z_lSAIwXfikYL5m3g Message-ID: To: Andrew Turner Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQl1Snf6m0jX6LYpakB/WHdcU0VA9jDckEyrdMjwcXfIHiIAzM+4GRLBFGN5Dz1cyOQUj2N5 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r234014 - head/lib/libc/arm/gen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Apr 2012 01:37:07 -0000 On Sat, Apr 7, 2012 at 21:45, Andrew Turner wrote: > On Sun, 8 Apr 2012 04:36:27 +0000 (UTC) > Andrew Turner wrote: > >> Author: andrew >> Date: Sun Apr =C2=A08 04:36:27 2012 >> New Revision: 234014 >> URL: http://svn.freebsd.org/changeset/base/234014 >> >> Log: >> =C2=A0 Unlike other functions __aeabi_read_tp function must preserve >> r1-r3. The currently generated code clobbers r3. Fix this by loading >> ARM_TP_ADDRESS using inline assembly. >> >> =C2=A0 Approved by: =C2=A0 =C2=A0 =C2=A0 =C2=A0imp (mentor) > > This fixes thread local storage on ARM in cases when the compiler loads > the offset of the variable in r3 before calling __aeabi_read_tp as has > been observed when the variable is in a shared library. I don't believe this is safe unless you specify __attribute__ ((__naked__)) in the declaration =E2=80=94 currently the compiler is free t= o clobber registers that the calling convention/ABI allows it to clobber. I don't see the benefit of implementing this in C over using an assembly file, that said, although GCC does have this attribute precisely to allow one to write assembly in a C source file without having to worry about unexpected behavior. How do you know GCC won't allocate r2 to be used as a temporary in between the assembly and the return? I tried to raise this concern on IRC previously, but hopefully it's clearer= now. Thanks, Juli.