From: claudio Date: Thu, 14 Dec 2023 14:04:57 +0000 (+0000) Subject: Workaround for broken clang which has a broken -fno-zero-initialized-in-bss X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d6514e0fadfd6647939b0ac6ccce475f77d1e512;p=openbsd Workaround for broken clang which has a broken -fno-zero-initialized-in-bss implementation. Set nkmempages to -1 by default instead of 0 so that the value ends up in the data section. This way config(8) is able to alter the value as promised. See also: https://github.com/llvm/llvm-project/issues/74632 OK miod@ --- diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 4c1446bb626..a2104b989f5 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_malloc.c,v 1.150 2023/12/14 11:58:09 claudio Exp $ */ +/* $OpenBSD: kern_malloc.c,v 1.151 2023/12/14 14:04:57 claudio Exp $ */ /* $NetBSD: kern_malloc.c,v 1.15.4.2 1996/06/13 17:10:56 cgd Exp $ */ /* @@ -83,7 +83,7 @@ struct vm_map *kmem_map = NULL; * config file. */ #ifndef NKMEMPAGES -#define NKMEMPAGES 0 +#define NKMEMPAGES -1 #endif u_int nkmempages = NKMEMPAGES; @@ -495,7 +495,7 @@ kmeminit_nkmempages(void) { u_int npages; - if (nkmempages != 0) { + if (nkmempages != -1) { /* * It's already been set (by us being here before, or * by patching or kernel config options), bail out now.