feat(newlib): Implement getentropy() function

Closes https://github.com/espressif/esp-idf/issues/11963
This commit is contained in:
Alexey Gerenkov
2023-08-03 16:25:53 +03:00
parent 172f086c6e
commit f8e020b1d7
5 changed files with 58 additions and 4 deletions

View File

@@ -53,15 +53,18 @@ target_link_libraries(${COMPONENT_LIB} INTERFACE "-u __cxa_guard_dummy")
# Furthermore, force libcxx to appear later than libgcc because some libgcc unwind code is wrapped, if C++
# exceptions are disabled. libcxx (this component) provides the unwind code wrappers.
# This is to prevent linking of libgcc's unwind code which considerably increases the binary size.
# Also force libnewlib to appear later than libstdc++ in link line since libstdc++ depends on
# some functions in libnewlib, e.g. getentropy().
idf_component_get_property(pthread pthread COMPONENT_LIB)
idf_component_get_property(newlib newlib COMPONENT_LIB)
idf_component_get_property(cxx cxx COMPONENT_LIB)
add_library(stdcpp_pthread INTERFACE)
add_library(stdcpp_deps INTERFACE)
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
target_link_libraries(stdcpp_pthread INTERFACE stdc++ c $<TARGET_FILE:${pthread}>)
target_link_libraries(stdcpp_deps INTERFACE stdc++ c $<TARGET_FILE:${pthread}> $<TARGET_FILE:${newlib}>)
else()
target_link_libraries(stdcpp_pthread INTERFACE stdc++ $<TARGET_FILE:${pthread}>)
target_link_libraries(stdcpp_deps INTERFACE stdc++ $<TARGET_FILE:${pthread}> $<TARGET_FILE:${newlib}>)
endif()
target_link_libraries(${COMPONENT_LIB} PUBLIC stdcpp_pthread)
target_link_libraries(${COMPONENT_LIB} PUBLIC stdcpp_deps)
add_library(libgcc_cxx INTERFACE)
target_link_libraries(libgcc_cxx INTERFACE ${CONFIG_COMPILER_RT_LIB_NAME} $<TARGET_FILE:${cxx}>)
target_link_libraries(${COMPONENT_LIB} PUBLIC libgcc_cxx)