libc: add LIBC_MALLOC option

This will enable alternative mallocs to be included in the tree and
selected by setting LIBC_MALLOC.  As there is only one today (jemalloc)
this option does nothing, but we expect to add other implementations
in the future.  This will also reduce diffs to CheriBSD.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D41660
This commit is contained in:
Brooks Davis 2023-09-01 17:42:39 +01:00
parent bd016ad227
commit 09e32b2fdd
3 changed files with 20 additions and 1 deletions

View file

@ -1,3 +1,3 @@
SYM_MAPS+=${LIBC_SRCTOP}/stdlib/malloc/Symbol.map
.include "${LIBC_SRCTOP}/stdlib/malloc/jemalloc/Makefile.inc"
.include "${LIBC_SRCTOP}/stdlib/malloc/${OPT_LIBC_MALLOC}/Makefile.inc"

View file

@ -228,6 +228,12 @@ __DEFAULT_DEPENDENT_OPTIONS= \
LOADER_VERIEXEC_VECTX/LOADER_VERIEXEC \
VERIEXEC/BEARSSL \
__SINGLE_OPTIONS = \
LIBC_MALLOC
__LIBC_MALLOC_OPTIONS= jemalloc
__LIBC_MALLOC_DEFAULT= jemalloc
# MK_*_SUPPORT options which default to "yes" unless their corresponding
# MK_* variable is set to "no".
#

View file

@ -0,0 +1,13 @@
Specify the
.Xr malloc 3
implementaiton used by libc.
The default value is
.Li jemalloc .
Valid values are:
.Bl -tag -width indent
.It Li jemalloc
.El
.Pp
Other implementations are expected in the future in both
.Fx
and downstream consumers.