From owner-svn-src-all@freebsd.org Mon Apr 18 16:25:39 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 25D6AB1377D; Mon, 18 Apr 2016 16:25:39 +0000 (UTC) (envelope-from pfg@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 mx1.freebsd.org (Postfix) with ESMTPS id EA6471B12; Mon, 18 Apr 2016 16:25:38 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3IGPcOU024563; Mon, 18 Apr 2016 16:25:38 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3IGPcQc024562; Mon, 18 Apr 2016 16:25:38 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201604181625.u3IGPcQc024562@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 18 Apr 2016 16:25:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298215 - head/lib/libc/gen X-SVN-Group: head 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.21 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: Mon, 18 Apr 2016 16:25:39 -0000 Author: pfg Date: Mon Apr 18 16:25:37 2016 New Revision: 298215 URL: https://svnweb.freebsd.org/changeset/base/298215 Log: Re-use our roundup2() macro instead of reinventing the wheel. Obtained from: DragonflyBSD Modified: head/lib/libc/gen/tls.c Modified: head/lib/libc/gen/tls.c ============================================================================== --- head/lib/libc/gen/tls.c Mon Apr 18 15:08:31 2016 (r298214) +++ head/lib/libc/gen/tls.c Mon Apr 18 16:25:37 2016 (r298215) @@ -33,6 +33,7 @@ */ #include +#include #include #include #include @@ -82,9 +83,6 @@ void __libc_free_tls(void *tls, size_t t #ifndef PIC -#define round(size, align) \ - (((size) + (align) - 1) & ~((align) - 1)) - static size_t tls_static_space; static size_t tls_init_size; static void *tls_init; @@ -190,7 +188,7 @@ __libc_free_tls(void *tcb, size_t tcbsiz * Figure out the size of the initial TLS block so that we can * find stuff which ___tls_get_addr() allocated dynamically. */ - size = round(tls_static_space, tcbalign); + size = roundup2(tls_static_space, tcbalign); dtv = ((Elf_Addr**)tcb)[1]; tlsend = (Elf_Addr) tcb; @@ -210,7 +208,7 @@ __libc_allocate_tls(void *oldtls, size_t Elf_Addr *dtv; Elf_Addr segbase, oldsegbase; - size = round(tls_static_space, tcbalign); + size = roundup2(tls_static_space, tcbalign); if (tcbsize < 2 * sizeof(Elf_Addr)) tcbsize = 2 * sizeof(Elf_Addr); @@ -307,7 +305,7 @@ _init_tls(void) for (i = 0; (unsigned) i < phnum; i++) { if (phdr[i].p_type == PT_TLS) { - tls_static_space = round(phdr[i].p_memsz, + tls_static_space = roundup2(phdr[i].p_memsz, phdr[i].p_align); tls_init_size = phdr[i].p_filesz; tls_init = (void*) phdr[i].p_vaddr;