From owner-dev-commits-src-all@freebsd.org Mon Aug 16 10:56:17 2021 Return-Path: Delivered-To: dev-commits-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 3FDB3671954; Mon, 16 Aug 2021 10:56:17 +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 4GpB0x0mQHz3nh2; Mon, 16 Aug 2021 10:56:17 +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 EA68023C; Mon, 16 Aug 2021 10:56:16 +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 17GAuGu0017073; Mon, 16 Aug 2021 10:56:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17GAuG9B017072; Mon, 16 Aug 2021 10:56:16 GMT (envelope-from git) Date: Mon, 16 Aug 2021 10:56:16 GMT Message-Id: <202108161056.17GAuG9B017072@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 300e08933e80 - main - libc tls: use TLS_DTV_OFFSET defined by rtld.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 300e08933e80e9fce02d0d2f7a64e3ad27e4ce8e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 10:56:17 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=300e08933e80e9fce02d0d2f7a64e3ad27e4ce8e commit 300e08933e80e9fce02d0d2f7a64e3ad27e4ce8e Author: Konstantin Belousov AuthorDate: 2021-08-15 02:14:26 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-16 10:55:35 +0000 libc tls: use TLS_DTV_OFFSET defined by rtld.h Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31541 --- lib/libc/gen/tls.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c index b5f5dfd4d315..d90aac028b88 100644 --- a/lib/libc/gen/tls.c +++ b/lib/libc/gen/tls.c @@ -81,12 +81,6 @@ void __libc_free_tls(void *tls, size_t tcbsize, size_t tcbalign); #error TLS_TCB_ALIGN undefined for target architecture #endif -#if defined(__mips__) || defined(__powerpc__) || defined(__riscv) -#define DTV_OFFSET 0x8000 -#else -#define DTV_OFFSET 0 -#endif - #ifndef PIC static size_t libc_tls_static_space; @@ -289,7 +283,7 @@ __libc_allocate_tls(void *oldtcb, size_t tcbsize, size_t tcbalign) /* Adjust the DTV. */ dtv = tcb[0]; - dtv[2] = (Elf_Addr)(tls + DTV_OFFSET); + dtv[2] = (Elf_Addr)(tls + TLS_DTV_OFFSET); } else { dtv = __je_bootstrap_malloc(3 * sizeof(Elf_Addr)); if (dtv == NULL) { @@ -300,7 +294,7 @@ __libc_allocate_tls(void *oldtcb, size_t tcbsize, size_t tcbalign) tcb[0] = dtv; dtv[0] = 1; /* Generation. */ dtv[1] = 1; /* Segments count. */ - dtv[2] = (Elf_Addr)(tls + DTV_OFFSET); + dtv[2] = (Elf_Addr)(tls + TLS_DTV_OFFSET); if (libc_tls_init_size > 0) memcpy(tls, libc_tls_init, libc_tls_init_size);