diff options
author | Brooks Davis <brooks@FreeBSD.org> | 2023-09-01 16:42:39 +0000 |
---|---|---|
committer | Brooks Davis <brooks@FreeBSD.org> | 2023-09-01 16:54:23 +0000 |
commit | 09e32b2fddf5f673f76e2fffa415a73d99a6f309 (patch) | |
tree | 34fb242c1c971a9bad85ad03c72e96e1400972b3 | |
parent | bd016ad227b06830ac24a8f9035b904a138a5d3e (diff) | |
download | src-09e32b2fddf5f673f76e2fffa415a73d99a6f309.tar.gz src-09e32b2fddf5f673f76e2fffa415a73d99a6f309.zip |
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
-rw-r--r-- | lib/libc/stdlib/malloc/Makefile.inc | 2 | ||||
-rw-r--r-- | share/mk/src.opts.mk | 6 | ||||
-rw-r--r-- | tools/build/options/LIBC_MALLOC | 13 |
3 files changed, 20 insertions, 1 deletions
diff --git a/lib/libc/stdlib/malloc/Makefile.inc b/lib/libc/stdlib/malloc/Makefile.inc index bce4353fe80a..3bae4ff1505b 100644 --- a/lib/libc/stdlib/malloc/Makefile.inc +++ b/lib/libc/stdlib/malloc/Makefile.inc @@ -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" diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 1183a8202168..d7112cf57178 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -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". # diff --git a/tools/build/options/LIBC_MALLOC b/tools/build/options/LIBC_MALLOC new file mode 100644 index 000000000000..ee1883f3ee54 --- /dev/null +++ b/tools/build/options/LIBC_MALLOC @@ -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. |