diff --git a/libc/config/baremetal/arm/entrypoints.txt b/libc/config/baremetal/arm/entrypoints.txt --- a/libc/config/baremetal/arm/entrypoints.txt +++ b/libc/config/baremetal/arm/entrypoints.txt @@ -63,6 +63,12 @@ libc.src.inttypes.imaxdiv libc.src.inttypes.strtoimax libc.src.inttypes.strtoumax + + # stdio.h entrypoints + libc.src.stdio.sprintf + libc.src.stdio.snprintf + libc.src.stdio.vsprintf + libc.src.stdio.vsnprintf # stdlib.h entrypoints libc.src.stdlib.abs diff --git a/libc/config/baremetal/arm/headers.txt b/libc/config/baremetal/arm/headers.txt --- a/libc/config/baremetal/arm/headers.txt +++ b/libc/config/baremetal/arm/headers.txt @@ -4,6 +4,7 @@ libc.include.errno libc.include.inttypes libc.include.math + libc.include.stdio libc.include.stdlib libc.include.string libc.include.strings diff --git a/libc/config/baremetal/riscv32/entrypoints.txt b/libc/config/baremetal/riscv32/entrypoints.txt --- a/libc/config/baremetal/riscv32/entrypoints.txt +++ b/libc/config/baremetal/riscv32/entrypoints.txt @@ -64,6 +64,12 @@ libc.src.inttypes.strtoimax libc.src.inttypes.strtoumax + # stdio.h entrypoints + libc.src.stdio.sprintf + libc.src.stdio.snprintf + libc.src.stdio.vsprintf + libc.src.stdio.vsnprintf + # stdlib.h entrypoints libc.src.stdlib.abs libc.src.stdlib.atoi diff --git a/libc/config/baremetal/riscv32/headers.txt b/libc/config/baremetal/riscv32/headers.txt --- a/libc/config/baremetal/riscv32/headers.txt +++ b/libc/config/baremetal/riscv32/headers.txt @@ -4,6 +4,7 @@ libc.include.errno libc.include.inttypes libc.include.math + libc.include.stdio libc.include.stdlib libc.include.string libc.include.strings diff --git a/libc/src/stdio/CMakeLists.txt b/libc/src/stdio/CMakeLists.txt --- a/libc/src/stdio/CMakeLists.txt +++ b/libc/src/stdio/CMakeLists.txt @@ -26,6 +26,14 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/generic) endif() +if(${LIBC_TARGET_OS} STREQUAL "baremetal") + list(APPEND printf_copts + "-DLIBC_COPT_PRINTF_DISABLE_FLOAT" + "-DLIBC_COPT_PRINTF_DISABLE_INDEX_MODE" + "-DLIBC_COPT_PRINTF_DISABLE_WRITE_INT" + ) +endif() + add_subdirectory(printf_core) add_subdirectory(scanf_core) @@ -419,13 +427,13 @@ libc.src.stdio.printf_core.vfprintf_internal ) if(LLVM_LIBC_FULL_BUILD) - list(APPEND printf_deps + list(APPEND printf_deps libc.src.__support.File.file libc.src.__support.File.platform_file libc.src.__support.File.platform_stdout ) else() - set(printf_copts "-DLIBC_COPT_PRINTF_USE_SYSTEM_FILE") + list(APPEND printf_copts "-DLIBC_COPT_PRINTF_USE_SYSTEM_FILE") endif() add_entrypoint_object( diff --git a/libc/src/stdio/printf_core/CMakeLists.txt b/libc/src/stdio/printf_core/CMakeLists.txt --- a/libc/src/stdio/printf_core/CMakeLists.txt +++ b/libc/src/stdio/printf_core/CMakeLists.txt @@ -93,6 +93,7 @@ libc.src.__support.float_to_string COMPILE_OPTIONS -DLIBC_COPT_FLOAT_TO_STR_USE_MEGA_LONG_DOUBLE_TABLE + ${printf_copts} )