From patchwork Wed Dec 15 09:54:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 48932 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 555263858420 for ; Wed, 15 Dec 2021 09:54:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 555263858420 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1639562071; bh=wc5ep5dQoQfyJmrjiZf01Wlv0XLTfc6knVKYGkxN+hg=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=rVF+tjsI4Jsomou9ctOON2GYebX585MV5V922txeDXXGqp8qRCAQZdpdsawxvs1OC r0GZo6QByKL8dx0XBfvTKSE8wyk5wTby7y2nMht5mqueACkVr5jhzjZEkE/L6Ftn66 ESYsG8Ai0gamROfAa3OEi7ZZBFzd2vXbMR9x6h+U= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id EB9583858D28 for ; Wed, 15 Dec 2021 09:54:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EB9583858D28 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-283-RFjSQ5QsO2WgAs5g5nRrxw-1; Wed, 15 Dec 2021 04:54:06 -0500 X-MC-Unique: RFjSQ5QsO2WgAs5g5nRrxw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9FF87100C625; Wed, 15 Dec 2021 09:54:05 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.17.223]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C652B10927BF; Wed, 15 Dec 2021 09:54:04 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH] powerpc: Use global register variable in Date: Wed, 15 Dec 2021 10:54:02 +0100 Message-ID: <874k7ary6d.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Cc: Mathieu Desnoyers Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" A local register variable is merely a compiler hint, and so not appropriate in this context. Move the global register variable into and include it from , as there can only be one global definition for one particular register. Fixes commit 8dbeb0561eeb876f557ac9eef5721912ec074ea5 ("nptl: Add for defining __thread_pointer"). Built with build-many-glibcs.py. Reported-by: Mathieu Desnoyers Reviewed-by: Raphael M Zinsly --- sysdeps/powerpc/nptl/thread_pointer.h | 13 +++++++------ sysdeps/powerpc/nptl/tls.h | 7 +------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/sysdeps/powerpc/nptl/thread_pointer.h b/sysdeps/powerpc/nptl/thread_pointer.h index 8fd5ba671f..4feba59610 100644 --- a/sysdeps/powerpc/nptl/thread_pointer.h +++ b/sysdeps/powerpc/nptl/thread_pointer.h @@ -19,15 +19,16 @@ #ifndef _SYS_THREAD_POINTER_H #define _SYS_THREAD_POINTER_H -static inline void * -__thread_pointer (void) -{ #ifdef __powerpc64__ - register void *__result asm ("r13"); +register void *__thread_register asm ("r13"); #else - register void *__result asm ("r2"); +register void *__thread_register asm ("r2"); #endif - return __result; + +static inline void * +__thread_pointer (void) +{ + return __thread_register; } #endif /* _SYS_THREAD_POINTER_H */ diff --git a/sysdeps/powerpc/nptl/tls.h b/sysdeps/powerpc/nptl/tls.h index 63098f4048..d03fcb6983 100644 --- a/sysdeps/powerpc/nptl/tls.h +++ b/sysdeps/powerpc/nptl/tls.h @@ -26,6 +26,7 @@ # include # include # include +# include #else /* __ASSEMBLER__ */ # include @@ -36,16 +37,10 @@ #ifndef __powerpc64__ /* Register r2 (tp) is reserved by the ABI as "thread pointer". */ # define PT_THREAD_POINTER PT_R2 -# ifndef __ASSEMBLER__ -register void *__thread_register __asm__ ("r2"); -# endif #else /* __powerpc64__ */ /* Register r13 (tp) is reserved by the ABI as "thread pointer". */ # define PT_THREAD_POINTER PT_R13 -# ifndef __ASSEMBLER__ -register void *__thread_register __asm__ ("r13"); -# endif #endif /* __powerpc64__ */ #ifndef __ASSEMBLER__