Skip to content

Commit e0e7fa3

Browse files
[libc] enable s(n)printf without fullbuild
To use the FILE data structure, LLVM-libc must be in fullbuild mode since it expects its own implementation. This means that (f)printf can't be used without fullbuild, but s(n)printf only uses strings. This patch adjusts the CMake to allow for this. Reviewed By: sivachandra, lntue Differential Revision: https://reviews.llvm.org/D131913
1 parent aed5e3b commit e0e7fa3

File tree

5 files changed

+10
-13
lines changed

5 files changed

+10
-13
lines changed

libc/config/linux/aarch64/entrypoints.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ set(TARGET_LIBC_ENTRYPOINTS
9191
libc.src.stdlib.realloc
9292
libc.src.stdlib.free
9393

94+
# stdio.h entrypoints
95+
libc.src.stdio.sprintf
96+
libc.src.stdio.snprintf
97+
9498
# sys/stat.h entrypoints
9599
libc.src.sys.stat.mkdir
96100
libc.src.sys.stat.mkdirat
@@ -242,8 +246,6 @@ if(LLVM_LIBC_FULL_BUILD)
242246
libc.src.stdio.funlockfile
243247
libc.src.stdio.fwrite
244248
libc.src.stdio.fwrite_unlocked
245-
libc.src.stdio.sprintf
246-
libc.src.stdio.snprintf
247249
libc.src.stdio.fprintf
248250
libc.src.stdio.printf
249251
libc.src.stdio.stderr

libc/config/linux/x86_64/entrypoints.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ set(TARGET_LIBC_ENTRYPOINTS
9292
libc.src.stdlib.aligned_alloc
9393
libc.src.stdlib.free
9494

95+
# stdio.h entrypoints
96+
libc.src.stdio.sprintf
97+
libc.src.stdio.snprintf
98+
9599
# sys/mman.h entrypoints
96100
libc.src.sys.mman.mmap
97101
libc.src.sys.mman.munmap
@@ -298,8 +302,6 @@ if(LLVM_LIBC_FULL_BUILD)
298302
libc.src.stdio.funlockfile
299303
libc.src.stdio.fwrite
300304
libc.src.stdio.fwrite_unlocked
301-
libc.src.stdio.sprintf
302-
libc.src.stdio.snprintf
303305
libc.src.stdio.fprintf
304306
libc.src.stdio.printf
305307
libc.src.stdio.stderr

libc/src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ add_subdirectory(inttypes)
77
add_subdirectory(math)
88
add_subdirectory(string)
99
add_subdirectory(stdlib)
10+
add_subdirectory(stdio)
1011

1112
if(${LIBC_TARGET_OS} STREQUAL "linux")
1213
add_subdirectory(dirent)
@@ -24,6 +25,5 @@ endif()
2425
# since assert uses the signal API, we disable assert also.
2526
# add_subdirectory(assert)
2627
# add_subdirectory(signal)
27-
add_subdirectory(stdio)
2828
add_subdirectory(threads)
2929
add_subdirectory(time)

libc/test/src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ add_subdirectory(inttypes)
3434
add_subdirectory(math)
3535
add_subdirectory(string)
3636
add_subdirectory(stdlib)
37+
add_subdirectory(stdio)
3738

3839
if(${LIBC_TARGET_OS} STREQUAL "linux")
3940
add_subdirectory(fcntl)
@@ -50,7 +51,6 @@ add_subdirectory(dirent)
5051
# since assert uses the signal API, we disable assert also.
5152
# add_subdirectory(assert)
5253
# add_subdirectory(signal)
53-
add_subdirectory(stdio)
5454
add_subdirectory(time)
5555

5656
if(${LIBC_TARGET_OS} STREQUAL "linux")

libc/utils/UnitTest/CMakeLists.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,6 @@ add_dependencies(
5454
libc.src.__support.CPP.array_ref
5555
)
5656

57-
if(NOT LLVM_LIBC_FULL_BUILD) # TODO(michaelrj): make a more permanant solution.
58-
return()
59-
endif()
60-
61-
#currently stdio is fullbuild only, so this matcher that depends on a piece of
62-
#printf also has to be fullbuild only.
63-
6457
add_library(
6558
LibcPrintfHelpers
6659
PrintfMatcher.h

0 commit comments

Comments
 (0)