From owner-svn-src-head@FreeBSD.ORG Mon Apr 9 01:37:07 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1D960106566C for ; Mon, 9 Apr 2012 01:37:07 +0000 (UTC) (envelope-from juli@clockworksquid.com) Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 9F7F48FC08 for ; Mon, 9 Apr 2012 01:37:06 +0000 (UTC) Received: by wgbds12 with SMTP id ds12so3802750wgb.31 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=AAEDVUH96nc9HWxW2FCxYGdxfgU3EbhT1aiLJRTQ7KgtrHIid8igIbalUkxPehMfsD 9H8amg1QPJW9lMlnq6EImSbJs6vnWAla1t1wkolV6YM6JuzlruVTDfxb9m8CZhT4PO5p d4RE6eOyOAMAKOATSUBdY2/r4ABYXT/anPNfYH/F2+tDMGr5J5uqhVNhPNaLhe0nwhrV z7F2KD3EuMgJ2LZf6ofm+Pz8M1LnEfAGQy034dw9XuzdbWPEu2mSNoXfoQZL9GKzJWLZ DixZ8vza8u4vwfBOlFuVyQo8O3BiQsm1HoTuD9EYi7BZ/RAz9xcxt8G9gHaqFTHnbOLT HrnA== 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: ALoCoQm34gNPqWCUVHBUcEkASmlVyzih0x0A7+85wAwuuK8lRfF0p1cUzuEPVaQWMMtMwoYHFPmj 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-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current 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.