Home
last modified time | relevance | path

Searched hist:eacabbbceb433cede5676d7b5869f20cfa4b9def (Results 1 – 2 of 2) sorted by relevance

/optee_os/lib/libutils/isoc/include/
H A Dmalloc.heacabbbceb433cede5676d7b5869f20cfa4b9def Thu Sep 23 08:20:17 UTC 2021 Jerome Forissier <jerome@forissier.org> libutils: ta: provide malloc(), calloc() and realloc() when debug is on

When enabling malloc debug for TAs (CFG_TEE_TA_MALLOC_DEBUG=y), the
standard malloc entry points malloc(), calloc() and realloc() are
redirected by C macros to instrumented variants: mdbg_malloc(),
mdbg_calloc() and mdbg_realloc(). In addition, the 'normal' symbols are
not exported by libutils. That is a problem because a TA might still
reference them. For example the C++ code in optee_test requires libstdc++
which relies on malloc() etc.:

build (master)$ make -j10 CFG_TEE_TA_MALLOC_DEBUG=y CFG_TEE_TA_LOG_LEVEL=2
...
/home/jerome/work/optee_repo_qemu/build/../toolchains/aarch32/bin/arm-linux-gnueabihf-ld.bfd: /home/jerome/work/toolchains-gcc10.2/aarch32/bin/../lib/gcc/arm-none-linux-gnueabihf/10.2.1/../../../../arm-none-linux-gnueabihf/lib/libstdc++.a(eh_alloc.o): in function `__cxa_allocate_exception':
/tmp/dgboter/bbs/build03--cen7x86_64/buildbot/cen7x86_64--arm-none-linux-gnueabihf/build/src/gcc/libstdc++-v3/libsupc++/eh_alloc.cc:284: undefined reference to `malloc'
...

Fix the issue by defining the standard malloc() functions in libutils,
calling the debug variants.

Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
/optee_os/lib/libutils/isoc/
H A Dbget_malloc.ceacabbbceb433cede5676d7b5869f20cfa4b9def Thu Sep 23 08:20:17 UTC 2021 Jerome Forissier <jerome@forissier.org> libutils: ta: provide malloc(), calloc() and realloc() when debug is on

When enabling malloc debug for TAs (CFG_TEE_TA_MALLOC_DEBUG=y), the
standard malloc entry points malloc(), calloc() and realloc() are
redirected by C macros to instrumented variants: mdbg_malloc(),
mdbg_calloc() and mdbg_realloc(). In addition, the 'normal' symbols are
not exported by libutils. That is a problem because a TA might still
reference them. For example the C++ code in optee_test requires libstdc++
which relies on malloc() etc.:

build (master)$ make -j10 CFG_TEE_TA_MALLOC_DEBUG=y CFG_TEE_TA_LOG_LEVEL=2
...
/home/jerome/work/optee_repo_qemu/build/../toolchains/aarch32/bin/arm-linux-gnueabihf-ld.bfd: /home/jerome/work/toolchains-gcc10.2/aarch32/bin/../lib/gcc/arm-none-linux-gnueabihf/10.2.1/../../../../arm-none-linux-gnueabihf/lib/libstdc++.a(eh_alloc.o): in function `__cxa_allocate_exception':
/tmp/dgboter/bbs/build03--cen7x86_64/buildbot/cen7x86_64--arm-none-linux-gnueabihf/build/src/gcc/libstdc++-v3/libsupc++/eh_alloc.cc:284: undefined reference to `malloc'
...

Fix the issue by defining the standard malloc() functions in libutils,
calling the debug variants.

Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>