1 # Helper function that creates an alias if a target specific implementation
2 # exists, otherwise it uses a generic one.
3 function(add_stdio_entrypoint_object name)
4 if(TARGET libc.src.stdio.${LIBC_TARGET_OS}.${name})
9 .${LIBC_TARGET_OS}.${name}
11 elseif(TARGET libc.src.stdio.generic.${name})
12 add_entrypoint_object(
19 endfunction(add_stdio_entrypoint_object)
21 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
22 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
25 if(NOT LIBC_TARGET_ARCHITECTURE_IS_GPU)
26 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/generic)
29 if(NOT LLVM_LIBC_FULL_BUILD)
30 list(APPEND use_system_file "COMPILE_OPTIONS" "-DLIBC_COPT_STDIO_USE_SYSTEM_FILE")
33 add_entrypoint_object(
41 libc.src.__support.File.file
42 libc.src.__support.File.platform_file
45 add_entrypoint_object(
53 libc.src.__support.File.file
54 libc.src.__support.File.platform_file
57 add_entrypoint_object(
65 libc.src.__support.CPP.new
66 libc.src.__support.File.file
69 add_entrypoint_object(
78 libc.src.__support.File.file
79 libc.src.__support.File.platform_file
82 add_entrypoint_object(
91 libc.src.__support.File.file
92 libc.src.__support.File.platform_file
95 list(APPEND scanf_deps
96 libc.src.__support.arg_list
97 libc.src.stdio.scanf_core.vfscanf_internal
100 if(LLVM_LIBC_FULL_BUILD)
101 list(APPEND scanf_deps
102 libc.src.__support.File.file
103 libc.src.__support.File.platform_file
104 libc.src.__support.File.platform_stdin
108 add_entrypoint_object(
115 libc.src.__support.arg_list
116 libc.src.stdio.scanf_core.reader
117 libc.src.stdio.scanf_core.scanf_main
120 add_entrypoint_object(
130 add_entrypoint_object(
140 add_entrypoint_object(
147 libc.src.stdio.printf_core.printf_main
148 libc.src.stdio.printf_core.writer
151 add_entrypoint_object(
158 libc.src.stdio.printf_core.printf_main
159 libc.src.stdio.printf_core.writer
162 list(APPEND printf_deps
163 libc.src.__support.arg_list
164 libc.src.stdio.printf_core.vfprintf_internal
167 if(LLVM_LIBC_FULL_BUILD)
168 list(APPEND printf_deps
169 libc.src.__support.File.file
170 libc.src.__support.File.platform_file
171 libc.src.__support.File.platform_stdout
175 add_entrypoint_object(
185 add_entrypoint_object(
192 libc.src.__support.arg_list
193 libc.src.stdio.printf_core.vfprintf_internal
196 add_entrypoint_object(
203 libc.src.stdio.printf_core.printf_main
204 libc.src.stdio.printf_core.writer
207 add_entrypoint_object(
214 libc.src.stdio.printf_core.printf_main
215 libc.src.stdio.printf_core.writer
218 add_entrypoint_object(
228 add_entrypoint_object(
235 libc.src.__support.arg_list
236 libc.src.stdio.printf_core.vfprintf_internal
239 add_subdirectory(printf_core)
240 add_subdirectory(scanf_core)
242 add_entrypoint_object(
246 .${LIBC_TARGET_OS}.remove
249 # These entrypoints have multiple potential implementations.
250 add_stdio_entrypoint_object(feof)
251 add_stdio_entrypoint_object(feof_unlocked)
252 add_stdio_entrypoint_object(ferror)
253 add_stdio_entrypoint_object(ferror_unlocked)
254 add_stdio_entrypoint_object(fseek)
255 add_stdio_entrypoint_object(ftell)
256 add_stdio_entrypoint_object(fflush)
257 add_stdio_entrypoint_object(clearerr)
258 add_stdio_entrypoint_object(clearerr_unlocked)
259 add_stdio_entrypoint_object(fopen)
260 add_stdio_entrypoint_object(fclose)
261 add_stdio_entrypoint_object(fread_unlocked)
262 add_stdio_entrypoint_object(fread)
263 add_stdio_entrypoint_object(puts)
264 add_stdio_entrypoint_object(fputs)
265 add_stdio_entrypoint_object(fwrite_unlocked)
266 add_stdio_entrypoint_object(fwrite)
267 add_stdio_entrypoint_object(fputc)
268 add_stdio_entrypoint_object(putc)
269 add_stdio_entrypoint_object(putchar)
270 add_stdio_entrypoint_object(fgetc)
271 add_stdio_entrypoint_object(fgetc_unlocked)
272 add_stdio_entrypoint_object(getc)
273 add_stdio_entrypoint_object(getc_unlocked)
274 add_stdio_entrypoint_object(getchar)
275 add_stdio_entrypoint_object(getchar_unlocked)
276 add_stdio_entrypoint_object(fgets)
277 add_stdio_entrypoint_object(ungetc)
278 add_stdio_entrypoint_object(stdin)
279 add_stdio_entrypoint_object(stdout)
280 add_stdio_entrypoint_object(stderr)