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_OS_IS_BAREMETAL AND NOT LIBC_TARGET_OS_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(
66 libc.hdr.types.cookie_io_functions_t
68 libc.src.__support.CPP.new
69 libc.src.__support.File.file
72 add_entrypoint_object(
81 libc.src.__support.File.file
82 libc.src.__support.File.platform_file
85 add_entrypoint_object(
94 libc.src.__support.File.file
95 libc.src.__support.File.platform_file
98 list(APPEND scanf_deps
99 libc.src.__support.arg_list
100 libc.src.stdio.scanf_core.vfscanf_internal
104 if(LLVM_LIBC_FULL_BUILD AND NOT LIBC_TARGET_OS_IS_GPU)
105 list(APPEND scanf_deps
106 libc.src.__support.File.file
107 libc.src.__support.File.platform_file
108 libc.src.__support.File.platform_stdin
112 add_entrypoint_object(
119 libc.src.__support.arg_list
120 libc.src.stdio.scanf_core.reader
121 libc.src.stdio.scanf_core.scanf_main
124 add_entrypoint_object(
131 libc.src.__support.arg_list
132 libc.src.stdio.scanf_core.reader
133 libc.src.stdio.scanf_core.scanf_main
136 add_entrypoint_object(
146 add_entrypoint_object(
156 add_entrypoint_object(
166 add_entrypoint_object(
176 add_entrypoint_object(
183 libc.src.stdio.printf_core.printf_main
184 libc.src.stdio.printf_core.writer
187 add_entrypoint_object(
194 libc.src.stdio.printf_core.printf_main
195 libc.src.stdio.printf_core.writer
198 add_entrypoint_object(
205 libc.src.stdio.printf_core.vasprintf_internal
208 add_entrypoint_object(
215 libc.src.stdio.printf_core.printf_main
216 libc.src.stdio.printf_core.writer
219 add_entrypoint_object(
226 libc.src.stdio.printf_core.printf_main
227 libc.src.stdio.printf_core.writer
230 add_entrypoint_object(
237 libc.src.stdio.printf_core.vasprintf_internal
240 add_subdirectory(printf_core)
241 add_subdirectory(scanf_core)
243 add_entrypoint_object(
247 .${LIBC_TARGET_OS}.remove
250 add_entrypoint_object(
254 .${LIBC_TARGET_OS}.rename
257 add_entrypoint_object(
261 .${LIBC_TARGET_OS}.fdopen
264 # These entrypoints have multiple potential implementations.
265 add_stdio_entrypoint_object(feof)
266 add_stdio_entrypoint_object(feof_unlocked)
267 add_stdio_entrypoint_object(ferror)
268 add_stdio_entrypoint_object(ferror_unlocked)
269 add_stdio_entrypoint_object(fseek)
270 add_stdio_entrypoint_object(ftell)
271 add_stdio_entrypoint_object(fseeko)
272 add_stdio_entrypoint_object(fileno)
273 add_stdio_entrypoint_object(ftello)
274 add_stdio_entrypoint_object(fflush)
275 add_stdio_entrypoint_object(clearerr)
276 add_stdio_entrypoint_object(clearerr_unlocked)
277 add_stdio_entrypoint_object(fopen)
278 add_stdio_entrypoint_object(fclose)
279 add_stdio_entrypoint_object(fread_unlocked)
280 add_stdio_entrypoint_object(fread)
281 add_stdio_entrypoint_object(puts)
282 add_stdio_entrypoint_object(fputs)
283 add_stdio_entrypoint_object(fwrite_unlocked)
284 add_stdio_entrypoint_object(fwrite)
285 add_stdio_entrypoint_object(fputc)
286 add_stdio_entrypoint_object(putc)
287 add_stdio_entrypoint_object(putchar)
288 add_stdio_entrypoint_object(printf)
289 add_stdio_entrypoint_object(fprintf)
290 add_stdio_entrypoint_object(fgetc)
291 add_stdio_entrypoint_object(fgetc_unlocked)
292 add_stdio_entrypoint_object(getc)
293 add_stdio_entrypoint_object(getc_unlocked)
294 add_stdio_entrypoint_object(getchar)
295 add_stdio_entrypoint_object(getchar_unlocked)
296 add_stdio_entrypoint_object(fgets)
297 add_stdio_entrypoint_object(ungetc)
298 add_stdio_entrypoint_object(stdin)
299 add_stdio_entrypoint_object(stdout)
300 add_stdio_entrypoint_object(stderr)
301 add_stdio_entrypoint_object(vprintf)
302 add_stdio_entrypoint_object(vfprintf)