Message ID | 5316B1E5.5070100@redhat.com |
---|---|
State | Committed |
Headers |
Return-Path: <x14307373@homiemail-mx20.g.dreamhost.com> X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx20.g.dreamhost.com (caibbdcaaahc.dreamhost.com [208.113.200.72]) by wilcox.dreamhost.com (Postfix) with ESMTP id 070AA3600B2 for <siddhesh@wilcox.dreamhost.com>; Thu, 6 Mar 2014 11:00:59 -0800 (PST) Received: by homiemail-mx20.g.dreamhost.com (Postfix, from userid 14307373) id AC5D040DDDA08; Thu, 6 Mar 2014 11:00:59 -0800 (PST) X-Original-To: glibc@patchwork.siddhesh.in Delivered-To: x14307373@homiemail-mx20.g.dreamhost.com Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by homiemail-mx20.g.dreamhost.com (Postfix) with ESMTP id 7C20440D4FBC5 for <glibc@patchwork.siddhesh.in>; Thu, 6 Mar 2014 11:00:59 -0800 (PST) Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s26J0wjh020423 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for <glibc@patchwork.siddhesh.in>; Thu, 6 Mar 2014 14:00:59 -0500 Received: from spoyarek.pnq.redhat.com (ovpn-113-102.phx2.redhat.com [10.3.113.102]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s26J0Gp1007936 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for <glibc@patchwork.siddhesh.in>; Thu, 6 Mar 2014 14:00:22 -0500 Resent-From: Siddhesh Poyarekar <siddhesh@redhat.com> Resent-Date: Fri, 7 Mar 2014 00:30:54 +0530 Resent-Message-ID: <20140306190054.GX1722@spoyarek.pnq.redhat.com> Resent-To: glibc@patchwork.siddhesh.in Received: from zmta06.collab.prod.int.phx2.redhat.com (LHLO zmta06.collab.prod.int.phx2.redhat.com) (10.5.81.13) by zmail09.collab.prod.int.phx2.redhat.com with LMTP; Wed, 5 Mar 2014 00:11:16 -0500 (EST) Received: from zmta06.collab.prod.int.phx2.redhat.com (localhost [127.0.0.1]) by zmta06.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 8F5A5166942 for <spoyarek@redhat.com>; Wed, 5 Mar 2014 00:11:16 -0500 (EST) Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by zmta06.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 8A75A16651E for <spoyarek@mail.corp.redhat.com>; Wed, 5 Mar 2014 00:11:16 -0500 (EST) Received: from mx1.redhat.com (ext-mx12.extmail.prod.ext.phx2.redhat.com [10.5.110.17]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s255BE0l019717 for <siddhesh@redhat.com>; Wed, 5 Mar 2014 00:11:14 -0500 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s255BAtP021561 for <siddhesh@redhat.com>; Wed, 5 Mar 2014 00:11:11 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :content-type:content-transfer-encoding; q=dns; s=default; b=Z+N UqXI94x8t4lDicROrf8k0OPajZCND9QgYsoPlhKr8atMF9EFg1TBvBgZ5vkUkfJB khjAle3SSo4JVediTFBmoLss7cS9qB/MAT2pER0H//0jaghn2zqN4B1Ux6hGrMD2 +Bn2JJrkZXuF8hBOu09g/xcigDGHWJ7pFqLc1qzQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :content-type:content-transfer-encoding; s=default; bh=T1h19f9ZP PK7QEDp5CBBa183vYE=; b=mgyh4c4m20sxPRrFi4PV98cm7D6ayLfVj2plP1XUN qevpM0b4CNwDQrsgca7u1PqdHC0v8ot6QBufuDMIbjcsiCu7J5ze9FMrnxsG3xVF Wo5/qy7XHcf3OjGW+iw0E8SdTp5PZPtzTeSPAb69N93+AmD3NshUFAOWcuBxh4xv 50= Received: (qmail 13632 invoked by alias); 5 Mar 2014 05:11:09 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <libc-alpha.sourceware.org> List-Unsubscribe: <mailto:libc-alpha-unsubscribe-siddhesh=redhat.com@sourceware.org> List-Subscribe: <mailto:libc-alpha-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 13616 invoked by uid 89); 5 Mar 2014 05:11:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Message-ID: <5316B1E5.5070100@redhat.com> Date: Wed, 05 Mar 2014 00:11:01 -0500 From: "Carlos O'Donell" <carlos@redhat.com> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: GNU C Library <libc-alpha@sourceware.org> Subject: [PATCH] hppa: Add _STACK_GROWS_* cases to pthread_attr_[sg]etstack. Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-RedHat-Spam-Score: -4.203 (BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.17 X-DH-Original-To: glibc@patchwork.siddhesh.in |
Commit Message
Carlos O'Donell
March 5, 2014, 5:11 a.m. UTC
This is one of a several NPTL patches to build glibc on hppa. The pthread_attr_[sg]etstack functions are defined by POSIX as taking a stackaddr that is the lowest addressable byte of the storage used for the stack. However, the internal iattr variable of the same name in NPTL is actually the final stack address as usable in the stack pointer for the machine. Therefore the NPTL implementation must add and subtract stacksize for _STACK_GROWS_DOWN architectures. HPPA is a _STACK_GROWS_UP architecture and doesn't need to add or subtract anything, the stack address *is* the lowest addressable byte of the storage. Tested on hppa-linux-gnu, with no regressions. Can't impact any other targets because of the conditionals. If nobody objects I'll check this in at the end of the week. I can't see there being any objections to this patch except that it introduces more code to maintain for an old architecture (perhaps we'll get another _S_G_U target in the future?). 2014-03-05 Carlos O'Donell <carlos@redhat.com> * nptl/pthread_attr_setstack.c (__pthread_attr_setstack) [!_STACK_GROWS_DOWN]: Don't add stacksize to stackaddr. (__old_pthread_attr_setstack): Likewise. * nptl/pthread_attr_getstack.c (__pthread_attr_getstack) [!_STACK_GROWS_DOWN]: Likewise. diff --git a/nptl/pthread_attr_setstack.c b/nptl/pthread_attr_setstack.c index 19a5b54..4785501 100644 --- a/nptl/pthread_attr_setstack.cDon't add stacksize to stackaddr. +++ b/nptl/pthread_attr_setstack.c @@ -48,7 +48,11 @@ __pthread_attr_setstack (attr, stackaddr, stacksize) #endif iattr->stacksize = stacksize; +#if _STACK_GROWS_DOWN iattr->stackaddr = (char *) stackaddr + stacksize; +#else + iattr->stackaddr = (char *) stackaddr; +#endif iattr->flags |= ATTR_FLAG_STACKADDR; return 0; @@ -81,7 +85,11 @@ __old_pthread_attr_setstack (pthread_attr_t *attr, void *stackaddr, # endif iattr->stacksize = stacksize; +#if _STACK_GROWS_DOWN iattr->stackaddr = (char *) stackaddr + stacksize; +#else + iattr->stackaddr = (char *) stackaddr; +#endif iattr->flags |= ATTR_FLAG_STACKADDR; return 0; --- Cheers, Carlos.
Comments
On Wed 05 Mar 2014 00:11:01 Carlos O'Donell wrote: > This is one of a several NPTL patches to build glibc on hppa. > > The pthread_attr_[sg]etstack functions are defined by POSIX as > taking a stackaddr that is the lowest addressable byte of the > storage used for the stack. However, the internal iattr variable > of the same name in NPTL is actually the final stack address > as usable in the stack pointer for the machine. Therefore the > NPTL implementation must add and subtract stacksize for > _STACK_GROWS_DOWN architectures. HPPA is a _STACK_GROWS_UP > architecture and doesn't need to add or subtract anything, > the stack address *is* the lowest addressable byte of the > storage. > > Tested on hppa-linux-gnu, with no regressions. > > Can't impact any other targets because of the conditionals. > > If nobody objects I'll check this in at the end of the week. > > I can't see there being any objections to this patch except > that it introduces more code to maintain for an old architecture > (perhaps we'll get another _S_G_U target in the future?). other than the #if vs #ifdef weirdness, LGTM. Gentoo has been shipping this for hppa since at least glibc-2.11, and has been using it on all arches since glibc-2.17 (which is our current stable). no reports of weirdness yet. -mike
Needs to be consistently #if, not #ifdef. OK otherwise.
On Wed 05 Mar 2014 00:11:01 Carlos O'Donell wrote: > This is one of a several NPTL patches to build glibc on hppa. > > The pthread_attr_[sg]etstack functions are defined by POSIX as > taking a stackaddr that is the lowest addressable byte of the > storage used for the stack. However, the internal iattr variable > of the same name in NPTL is actually the final stack address > as usable in the stack pointer for the machine. Therefore the > NPTL implementation must add and subtract stacksize for > _STACK_GROWS_DOWN architectures. HPPA is a _STACK_GROWS_UP > architecture and doesn't need to add or subtract anything, > the stack address *is* the lowest addressable byte of the > storage. > > Tested on hppa-linux-gnu, with no regressions. > > Can't impact any other targets because of the conditionals. > > If nobody objects I'll check this in at the end of the week. sorry Carlos, i got impatient and fixed the #if/#ifdef and pushed it ;) > I can't see there being any objections to this patch except > that it introduces more code to maintain for an old architecture > (perhaps we'll get another _S_G_U target in the future?). if the metag arch ever gets merged, it's _S_G_U iiuc -mike
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 03/13/2014 08:41 PM, Mike Frysinger wrote: > On Wed 05 Mar 2014 00:11:01 Carlos O'Donell wrote: >> This is one of a several NPTL patches to build glibc on hppa. >> >> The pthread_attr_[sg]etstack functions are defined by POSIX as >> taking a stackaddr that is the lowest addressable byte of the >> storage used for the stack. However, the internal iattr variable >> of the same name in NPTL is actually the final stack address >> as usable in the stack pointer for the machine. Therefore the >> NPTL implementation must add and subtract stacksize for >> _STACK_GROWS_DOWN architectures. HPPA is a _STACK_GROWS_UP >> architecture and doesn't need to add or subtract anything, >> the stack address *is* the lowest addressable byte of the >> storage. >> >> Tested on hppa-linux-gnu, with no regressions. >> >> Can't impact any other targets because of the conditionals. >> >> If nobody objects I'll check this in at the end of the week. > > sorry Carlos, i got impatient and fixed the #if/#ifdef and pushed it ;) No worries. Thanks! I have more patches queued up which I'll push directly as long as they don't change code-gen for x86* Cheers, Carlos. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJTIlyTAAoJECXvCkNsKkr/dssIAKRp+9kt9NcO5qqgaLFeN7Sv MC9b5rXynx1ZMspN0dvCHWbRX6wuRbSJLy8OJKdDfmcGYNAXe3ZMDZGqpEUwnrhX ddLh6E/KwQOpUfykzTmEj31zSspi8dNqL527LAM2OfSHT4iDKYCssrGExmRh2bjk jqVHJVQ9vTE+WjTSMZFfuZAZO7l5W/GOUYlPaH7ZimB+DMiFD4Hgwza2HmElqzq7 KbdmvZamQrJE6bEVVf9kIlt67dV0wk6+tJiZIACx99D4z0VjSA8iQotsl9WIryoK puKVy5x/brODffioxZr/b3EuaHiQzTeUciAovK650103t/4FAWI+PhUH0Qt50aI= =Kf7z -----END PGP SIGNATURE-----
diff --git a/nptl/pthread_attr_getstack.c b/nptl/pthread_attr_getstack.c index 3f4fd8d..4c1a098 100644 --- a/nptl/pthread_attr_getstack.c +++ b/nptl/pthread_attr_getstack.c @@ -32,7 +32,11 @@ __pthread_attr_getstack (attr, stackaddr, stacksize) iattr = (struct pthread_attr *) attr; /* Store the result. */ +#ifdef _STACK_GROWS_DOWN *stackaddr = (char *) iattr->stackaddr - iattr->stacksize; +#else + *stackaddr = (char *) iattr->stackaddr; +#endif *stacksize = iattr->stacksize; return 0;