fix(esp_stdio): align VFS console force-link with the source-selection condition

stdio_vfs.c (the sole definition of esp_vfs_include_console_register)
is only added to the source list on non-Linux targets. The trailing
target_link_libraries(... -u esp_vfs_include_console_register) was
applied whenever CONFIG_VFS_SUPPORT_IO was enabled, including on the
Linux host build where the symbol is not part of the link. Constrain
the force-undef to the same condition that opts the defining source
in.
This commit is contained in:
Sudeep Mohanty
2026-05-13 09:05:56 +02:00
parent 794d3772e4
commit bc0ae03f60

View File

@@ -27,7 +27,7 @@ endif()
idf_component_register(SRCS ${srcs}
INCLUDE_DIRS ${includes})
if(CONFIG_VFS_SUPPORT_IO)
if(CONFIG_VFS_SUPPORT_IO AND NOT ${target} STREQUAL "linux")
if(IDF_BUILD_V2)
idf_component_include(vfs)
@@ -63,6 +63,9 @@ if(CONFIG_VFS_SUPPORT_IO)
endif()
target_link_libraries(${COMPONENT_LIB} PRIVATE idf::vfs)
# Make sure esp_stdio_register gets called at startup stage
# Make sure esp_stdio_register gets called at startup stage.
# The referenced symbol is defined in stdio_vfs.c, which is only added to
# the source list above on non-Linux targets; the force-undef is gated on
# the same condition for the link line to remain resolvable.
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u esp_vfs_include_console_register")
endif()