blob: 23e84231e2a07e3580d440ced92c799b2acfe73d [file] [log] [blame]
# SPDX-License-Identifier: Apache-2.0
zephyr_library()
zephyr_library_sources(libc-hooks.c)
# define __LINUX_ERRNO_EXTENSIONS__ so we get errno defines like -ESHUTDOWN
# used by the network stack
zephyr_compile_definitions(__LINUX_ERRNO_EXTENSIONS__)
if(NOT CONFIG_PICOLIBC_USE_MODULE)
# Use picolibc provided with the toolchain. This requires a new enough
# toolchain so that the version of picolibc supports auto-detecting a
# Zephyr build (via the __ZEPHYR__ macro) to expose the Zephyr C API
zephyr_compile_options(--specs=picolibc.specs)
zephyr_libc_link_libraries(--specs=picolibc.specs c -lgcc)
if(CONFIG_PICOLIBC_IO_FLOAT)
zephyr_compile_definitions(PICOLIBC_DOUBLE_PRINTF_SCANF)
zephyr_link_libraries(-DPICOLIBC_DOUBLE_PRINTF_SCANF)
elseif(CONFIG_PICOLIBC_IO_MINIMAL)
zephyr_compile_definitions(PICOLIBC_MINIMAL_PRINTF_SCANF)
zephyr_link_libraries(-DPICOLIBC_MINIMAL_PRINTF_SCANF)
elseif(CONFIG_PICOLIBC_IO_LONG_LONG)
zephyr_compile_definitions(PICOLIBC_LONG_LONG_PRINTF_SCANF)
zephyr_link_libraries(-DPICOLIBC_LONG_LONG_PRINTF_SCANF)
else()
zephyr_compile_definitions(PICOLIBC_INTEGER_PRINTF_SCANF)
zephyr_link_libraries(-DPICOLIBC_INTEGER_PRINTF_SCANF)
endif()
endif()