From e160db81029cb36806a5411cfdb889de16137b8c Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 5 Jul 2020 10:03:29 +0000 Subject: project: added mallocng support. --- project/common.mk | 2 ++ project/config/cfgdefs.in | 3 +++ project/config/cfgdefs.sh | 14 ++++++++++++++ 3 files changed, 19 insertions(+) (limited to 'project') diff --git a/project/common.mk b/project/common.mk index af5155e..cbe8ecb 100644 --- a/project/common.mk +++ b/project/common.mk @@ -1,6 +1,7 @@ libc_src_dirs = $(SOURCE_DIR)/src/*/ libc_src_dirs += $(SOURCE_DIR)/crt/ libc_src_dirs += $(SOURCE_DIR)/ldso/ +libc_src_dirs += $(SOURCE_DIR)/$(MALLOC_SUBDIR)/ ifeq ($(PORT_DIR),$(PROJECT_DIR)) libc_src_dirs += $(PROJECT_DIR)/src/*/ @@ -64,6 +65,7 @@ libc_tree_dirs = $(subst $(SOURCE_DIR)/,./, \ libc_tree_dirs += ./crt/ ./crt/$(ARCH)/ libc_tree_dirs += ./ldso/ ./ldso/$(ARCH)/ +libc_tree_dirs += $(MALLOC_SUBDIR) # depend on all headers diff --git a/project/config/cfgdefs.in b/project/config/cfgdefs.in index d8b3bb5..95db393 100644 --- a/project/config/cfgdefs.in +++ b/project/config/cfgdefs.in @@ -23,6 +23,9 @@ CFLAGS_CONFIG += @libc_source_tree@ # libgcc, libgcc_eh LIBC_DEPS += @libc_deps@ +# mallocng */ +MALLOC_SUBDIR = @malloc_subdir@ + # syscall.h build/syscall_h.tag: build/@libc_syscall_arch@ diff --git a/project/config/cfgdefs.sh b/project/config/cfgdefs.sh index 994ef54..a9cb7c4 100644 --- a/project/config/cfgdefs.sh +++ b/project/config/cfgdefs.sh @@ -126,6 +126,16 @@ cfgdefs_set_libc_cflags() } +cfgdefs_set_malloc_options() +{ + if [ -d $mb_source_dir/src/malloc/mallocng ]; then + malloc_subdir='src/malloc/mallocng' + else + malloc_subdir='src/malloc/oldmalloc' + fi +} + + cfgdefs_output_custom_defs() { sed \ @@ -140,6 +150,7 @@ cfgdefs_output_custom_defs() -e 's/@libc_syscall_arch@/'"$libc_syscall_arch"'/g' \ -e 's/@libc_td_tid_addr@/'"$libc_td_tid_addr"'/g' \ -e 's!@alltypes_sed@!'"$alltypes_sed"'!g' \ + -e 's!@malloc_subdir@!'"$malloc_subdir"'!g' \ "$mb_project_dir/project/config/cfgdefs.in" \ | sed -e 's/[ \t]*$//g' \ >> "$mb_pwd/cfgdefs.mk" @@ -158,6 +169,9 @@ cfgdefs_set_libc_options # libc (variant-specific) cflags cfgdefs_set_libc_cflags +# malloc implementation variant +cfgdefs_set_malloc_options + # cfgdefs.in --> cfgdefs.mk cfgdefs_output_custom_defs -- cgit v1.2.3