From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12584 Path: news.gmane.org!.POSTED!not-for-mail From: Denys Vlasenko Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH] reduce size of struct __libc by using narrower integers Date: Tue, 6 Mar 2018 17:55:02 +0100 Message-ID: <20180306165502.23633-1-vda.linux@googlemail.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1520355215 25421 195.159.176.226 (6 Mar 2018 16:53:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 6 Mar 2018 16:53:35 +0000 (UTC) Cc: Denys Vlasenko , musl To: Rich Felker Original-X-From: musl-return-12600-gllmg-musl=m.gmane.org@lists.openwall.com Tue Mar 06 17:53:31 2018 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1etFq3-0004Yb-4j for gllmg-musl@m.gmane.org; Tue, 06 Mar 2018 17:53:19 +0100 Original-Received: (qmail 24286 invoked by uid 550); 6 Mar 2018 16:55:19 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 24220 invoked from network); 6 Mar 2018 16:55:16 -0000 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 06 Mar 2018 16:55:05 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 06 Mar 2018 16:55:05 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'vda.linux@googlemail.com' RCPT:'' Xref: news.gmane.org gmane.linux.lib.musl.general:12584 Archived-At: can_do_threads, threaded and secure are boolean flags, can use bytes instead of full word ints. tls_align and page_size are surely smaller than 4GB, no need to use potentially 64-bit size_t. Signed-off-by: Denys Vlasenko CC: musl --- ldso/dynlink.c | 3 ++- src/internal/libc.h | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ldso/dynlink.c b/ldso/dynlink.c index 9bf6924b..67d36395 100644 --- a/ldso/dynlink.c +++ b/ldso/dynlink.c @@ -124,8 +124,9 @@ static jmp_buf *rtld_fail; static pthread_rwlock_t lock; static struct debug debug; static struct tls_module *tls_tail; -static size_t tls_cnt, tls_offset, tls_align = MIN_TLS_ALIGN; +static size_t tls_cnt, tls_offset; static size_t static_tls_cnt; +static unsigned tls_align = MIN_TLS_ALIGN; static pthread_mutex_t init_fini_lock = { ._m_type = PTHREAD_MUTEX_RECURSIVE }; static struct fdpic_loadmap *app_loadmap; static struct fdpic_dummy_loadmap app_dummy_loadmap; diff --git a/src/internal/libc.h b/src/internal/libc.h index 5e145183..3cd44e90 100644 --- a/src/internal/libc.h +++ b/src/internal/libc.h @@ -18,14 +18,15 @@ struct tls_module { }; struct __libc { - int can_do_threads; - int threaded; - int secure; + char can_do_threads; + char threaded; + char secure; volatile int threads_minus_1; size_t *auxv; struct tls_module *tls_head; - size_t tls_size, tls_align, tls_cnt; - size_t page_size; + size_t tls_size, tls_cnt; + unsigned tls_align; + unsigned page_size; struct __locale_struct global_locale; }; -- 2.16.2