From owner-dev-commits-src-branches@freebsd.org Mon Aug 23 09:21:55 2021 Return-Path: Delivered-To: dev-commits-src-branches@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 048B5666E5E; Mon, 23 Aug 2021 09:21:55 +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 4GtRZp5yvDz4RKP; Mon, 23 Aug 2021 09:21:54 +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 AF23C11AE0; Mon, 23 Aug 2021 09:21:54 +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 17N9LsjZ067157; Mon, 23 Aug 2021 09:21:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17N9LsNV067156; Mon, 23 Aug 2021 09:21:54 GMT (envelope-from git) Date: Mon, 23 Aug 2021 09:21:54 GMT Message-Id: <202108230921.17N9LsNV067156@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 6295883670c3 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 6295883670c37f005e59d2ea3b850389a5c6d308 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Aug 2021 09:21:55 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=6295883670c37f005e59d2ea3b850389a5c6d308 commit 6295883670c37f005e59d2ea3b850389a5c6d308 Author: Konstantin Belousov AuthorDate: 2021-08-15 02:14:26 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-23 09:20:56 +0000 libc tls: use TLS_DTV_OFFSET defined by rtld.h (cherry picked from commit 300e08933e80e9fce02d0d2f7a64e3ad27e4ce8e) --- 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);