From owner-svn-src-all@freebsd.org Sat Nov 2 19:52:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3DA0F161E0D; Sat, 2 Nov 2019 19:52:23 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4758pv0qxRz46ty; Sat, 2 Nov 2019 19:52:23 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 000B867C; Sat, 2 Nov 2019 19:52:22 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xA2JqM0x056302; Sat, 2 Nov 2019 19:52:22 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xA2JqMKE056301; Sat, 2 Nov 2019 19:52:22 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201911021952.xA2JqMKE056301@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Sat, 2 Nov 2019 19:52:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354263 - stable/12/lib/libthr/arch/riscv/include X-SVN-Group: stable-12 X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: stable/12/lib/libthr/arch/riscv/include X-SVN-Commit-Revision: 354263 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 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: Sat, 02 Nov 2019 19:52:23 -0000 Author: mhorne Date: Sat Nov 2 19:52:22 2019 New Revision: 354263 URL: https://svnweb.freebsd.org/changeset/base/354263 Log: MFC r353334: RISC-V: Fix an alignment warning in libthr Compiling with clang gives a loss-of-alignment error due the cast to uint8_t *. Since the TLS is always tcb aligned and TP_OFFSET is defined as sizeof(struct tcb) we can guarantee there is no misalignment. Silence the error by moving the offset into the inline assembly. Reviewed by: br Differential Revision: https://reviews.freebsd.org/D21926 Modified: stable/12/lib/libthr/arch/riscv/include/pthread_md.h Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libthr/arch/riscv/include/pthread_md.h ============================================================================== --- stable/12/lib/libthr/arch/riscv/include/pthread_md.h Sat Nov 2 19:50:36 2019 (r354262) +++ stable/12/lib/libthr/arch/riscv/include/pthread_md.h Sat Nov 2 19:52:22 2019 (r354263) @@ -62,7 +62,7 @@ static __inline void _tcb_set(struct tcb *tcb) { - __asm __volatile("mv tp, %0" :: "r"((uint8_t *)tcb + TP_OFFSET)); + __asm __volatile("addi tp, %0, %1" :: "r"(tcb), "I"(TP_OFFSET)); } /* @@ -71,11 +71,11 @@ _tcb_set(struct tcb *tcb) static __inline struct tcb * _tcb_get(void) { - register uint8_t *_tp; + struct tcb *_tcb; - __asm __volatile("mv %0, tp" : "=r"(_tp)); + __asm __volatile("addi %0, tp, %1" : "=r"(_tcb) : "I"(-TP_OFFSET)); - return ((struct tcb *)(_tp - TP_OFFSET)); + return (_tcb); } static __inline struct pthread *