Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/ld.elf_so Use alignof and not size_t for platforms w...



details:   https://anonhg.NetBSD.org/src/rev/d0758582f005
branches:  trunk
changeset: 1004624:d0758582f005
user:      joerg <joerg%NetBSD.org@localhost>
date:      Tue Nov 05 22:22:42 2019 +0000

description:
Use alignof and not size_t for platforms with non-natural base
alignments.

diffstat:

 lib/libc/tls/tls.c      |  7 ++++---
 libexec/ld.elf_so/tls.c |  7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)

diffs (67 lines):

diff -r 81cb2dd6f468 -r d0758582f005 lib/libc/tls/tls.c
--- a/lib/libc/tls/tls.c        Tue Nov 05 22:19:43 2019 +0000
+++ b/lib/libc/tls/tls.c        Tue Nov 05 22:22:42 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tls.c,v 1.10 2019/11/04 12:45:10 joerg Exp $   */
+/*     $NetBSD: tls.c,v 1.11 2019/11/05 22:22:42 joerg Exp $   */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: tls.c,v 1.10 2019/11/04 12:45:10 joerg Exp $");
+__RCSID("$NetBSD: tls.c,v 1.11 2019/11/05 22:22:42 joerg Exp $");
 
 #include "namespace.h"
 
@@ -46,6 +46,7 @@
 #include <link_elf.h>
 #include <lwp.h>
 #include <stdbool.h>
+#include <stdalign.h>
 #include <stddef.h>
 #include <stdlib.h>
 #include <string.h>
@@ -85,7 +86,7 @@
 
        if (initial_thread_tcb == NULL) {
 #ifdef __HAVE_TLS_VARIANT_II
-               tls_size = roundup2(tls_size, sizeof(max_align_t));
+               tls_size = roundup2(tls_size, alignof(max_align_t));
 #endif
                tls_allocation = tls_size + sizeof(*tcb);
 
diff -r 81cb2dd6f468 -r d0758582f005 libexec/ld.elf_so/tls.c
--- a/libexec/ld.elf_so/tls.c   Tue Nov 05 22:19:43 2019 +0000
+++ b/libexec/ld.elf_so/tls.c   Tue Nov 05 22:22:42 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tls.c,v 1.13 2019/11/04 12:45:10 joerg Exp $   */
+/*     $NetBSD: tls.c,v 1.14 2019/11/05 22:22:42 joerg Exp $   */
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,11 +29,12 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: tls.c,v 1.13 2019/11/04 12:45:10 joerg Exp $");
+__RCSID("$NetBSD: tls.c,v 1.14 2019/11/05 22:22:42 joerg Exp $");
 
 #include <sys/param.h>
 #include <sys/ucontext.h>
 #include <lwp.h>
+#include <stdalign.h>
 #include <stddef.h>
 #include <string.h>
 #include "debug.h"
@@ -100,7 +101,7 @@
 
 #ifndef __HAVE_TLS_VARIANT_I
        _rtld_tls_static_space = roundup2(_rtld_tls_static_space,
-           sizeof(max_align_t));
+           alignof(max_align_t));
 #endif
        dbg(("_rtld_tls_static_space %zu", _rtld_tls_static_space));
 



Home | Main Index | Thread Index | Old Index