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.File.file
66 libc.src.__support.File.platform_file
69 add_entrypoint_object(
77 libc.src.__support.CPP.new
78 libc.src.__support.File.file
81 add_entrypoint_object(
90 libc.src.__support.File.file
91 libc.src.__support.File.platform_file
94 add_entrypoint_object(
103 libc.src.__support.File.file
104 libc.src.__support.File.platform_file
107 list(APPEND scanf_deps
108 libc.src.__support.arg_list
109 libc.src.stdio.scanf_core.vfscanf_internal
112 if(LLVM_LIBC_FULL_BUILD)
113 list(APPEND scanf_deps
114 libc.src.__support.File.file
115 libc.src.__support.File.platform_file
116 libc.src.__support.File.platform_stdin
120 add_entrypoint_object(
127 libc.src.__support.arg_list
128 libc.src.stdio.scanf_core.reader
129 libc.src.stdio.scanf_core.scanf_main
132 add_entrypoint_object(
142 add_entrypoint_object(
152 add_entrypoint_object(
159 libc.src.stdio.printf_core.printf_main
160 libc.src.stdio.printf_core.writer
163 add_entrypoint_object(
170 libc.src.stdio.printf_core.printf_main
171 libc.src.stdio.printf_core.writer
174 list(APPEND printf_deps
175 libc.src.__support.arg_list
176 libc.src.stdio.printf_core.vfprintf_internal
179 if(LLVM_LIBC_FULL_BUILD)
180 list(APPEND printf_deps
181 libc.src.__support.File.file
182 libc.src.__support.File.platform_file
183 libc.src.__support.File.platform_stdout
187 add_entrypoint_object(
197 add_entrypoint_object(
204 libc.src.__support.arg_list
205 libc.src.stdio.printf_core.vfprintf_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(
240 add_entrypoint_object(
247 libc.src.__support.arg_list
248 libc.src.stdio.printf_core.vfprintf_internal
251 add_subdirectory(printf_core)
252 add_subdirectory(scanf_core)
254 add_entrypoint_object(
258 .${LIBC_TARGET_OS}.remove
261 # These entrypoints have multiple potential implementations.
262 add_stdio_entrypoint_object(feof)
263 add_stdio_entrypoint_object(feof_unlocked)
264 add_stdio_entrypoint_object(ferror)
265 add_stdio_entrypoint_object(ferror_unlocked)
266 add_stdio_entrypoint_object(fseek)
267 add_stdio_entrypoint_object(ftell)
268 add_stdio_entrypoint_object(fflush)
269 add_stdio_entrypoint_object(clearerr)
270 add_stdio_entrypoint_object(clearerr_unlocked)
271 add_stdio_entrypoint_object(fopen)
272 add_stdio_entrypoint_object(fclose)
273 add_stdio_entrypoint_object(fread_unlocked)
274 add_stdio_entrypoint_object(fread)
275 add_stdio_entrypoint_object(puts)
276 add_stdio_entrypoint_object(fputs)
277 add_stdio_entrypoint_object(fwrite_unlocked)
278 add_stdio_entrypoint_object(fwrite)
279 add_stdio_entrypoint_object(fputc)
280 add_stdio_entrypoint_object(putc)
281 add_stdio_entrypoint_object(putchar)
282 add_stdio_entrypoint_object(fgetc)
283 add_stdio_entrypoint_object(fgetc_unlocked)
284 add_stdio_entrypoint_object(getc)
285 add_stdio_entrypoint_object(getc_unlocked)
286 add_stdio_entrypoint_object(getchar)
287 add_stdio_entrypoint_object(getchar_unlocked)
288 add_stdio_entrypoint_object(fgets)
289 add_stdio_entrypoint_object(stdin)
290 add_stdio_entrypoint_object(stdout)
291 add_stdio_entrypoint_object(stderr)