From nobody Thu Nov 18 00:04:28 2021 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2D4C7188AE88; Thu, 18 Nov 2021 00:04:29 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hvg5T0RYnz3qKg; Thu, 18 Nov 2021 00:04:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E01542A22; Thu, 18 Nov 2021 00:04:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AI04SML054609; Thu, 18 Nov 2021 00:04:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AI04SQ3054608; Thu, 18 Nov 2021 00:04:28 GMT (envelope-from git) Date: Thu, 18 Nov 2021 00:04:28 GMT Message-Id: <202111180004.1AI04SQ3054608@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: b928e924f74b - main - rtld-elf: Use _get_tp in __tls_get_addr for aarch64 and riscv64. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b928e924f74b0b8f882a9b735611421a93113640 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b928e924f74b0b8f882a9b735611421a93113640 commit b928e924f74b0b8f882a9b735611421a93113640 Author: John Baldwin AuthorDate: 2021-11-17 23:50:55 +0000 Commit: John Baldwin CommitDate: 2021-11-17 23:50:55 +0000 rtld-elf: Use _get_tp in __tls_get_addr for aarch64 and riscv64. Reviewed by: kib Sponsored by: The University of Cambridge, Google Inc. Differential Revision: https://reviews.freebsd.org/D33047 --- libexec/rtld-elf/aarch64/reloc.c | 9 +++------ libexec/rtld-elf/riscv/reloc.c | 8 +++----- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/libexec/rtld-elf/aarch64/reloc.c b/libexec/rtld-elf/aarch64/reloc.c index 8cc66c87d698..f697e4a03054 100644 --- a/libexec/rtld-elf/aarch64/reloc.c +++ b/libexec/rtld-elf/aarch64/reloc.c @@ -534,11 +534,8 @@ allocate_initial_tls(Obj_Entry *objs) void * __tls_get_addr(tls_index* ti) { - char *p; - void *_tp; + Elf_Addr **dtvp; - __asm __volatile("mrs %0, tpidr_el0" : "=r" (_tp)); - p = tls_get_addr_common((Elf_Addr **)(_tp), ti->ti_module, ti->ti_offset); - - return (p); + dtvp = _get_tp(); + return (tls_get_addr_common(dtvp, ti->ti_module, ti->ti_offset)); } diff --git a/libexec/rtld-elf/riscv/reloc.c b/libexec/rtld-elf/riscv/reloc.c index 1e749206e9b9..70db8379ade5 100644 --- a/libexec/rtld-elf/riscv/reloc.c +++ b/libexec/rtld-elf/riscv/reloc.c @@ -406,13 +406,11 @@ allocate_initial_tls(Obj_Entry *objs) void * __tls_get_addr(tls_index* ti) { - char *_tp; + Elf_Addr **dtvp; void *p; - __asm __volatile("mv %0, tp" : "=r" (_tp)); - - p = tls_get_addr_common((Elf_Addr**)((Elf_Addr)_tp - TLS_TP_OFFSET - - TLS_TCB_SIZE), ti->ti_module, ti->ti_offset); + dtvp = _get_tp(); + p = tls_get_addr_common(dtvp, ti->ti_module, ti->ti_offset); return ((char*)p + TLS_DTV_OFFSET); }