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 add_entrypoint_object(
38 libc.src.__support.File.file
39 libc.src.__support.File.platform_file
42 add_entrypoint_object(
50 libc.src.__support.File.file
51 libc.src.__support.File.platform_file
54 add_entrypoint_object(
62 libc.src.__support.File.file
63 libc.src.__support.File.platform_file
66 add_entrypoint_object(
75 libc.src.__support.File.file
76 libc.src.__support.File.platform_file
79 add_entrypoint_object(
87 libc.src.__support.File.file
88 libc.src.__support.File.platform_file
91 add_entrypoint_object(
99 libc.src.__support.CPP.new
100 libc.src.__support.File.file
103 add_entrypoint_object(
112 libc.src.__support.File.file
113 libc.src.__support.File.platform_file
116 add_entrypoint_object(
125 libc.src.__support.File.file
126 libc.src.__support.File.platform_file
129 list(APPEND scanf_deps
130 libc.src.__support.arg_list
131 libc.src.stdio.scanf_core.vfscanf_internal
134 if(LLVM_LIBC_FULL_BUILD)
135 list(APPEND scanf_deps
136 libc.src.__support.File.file
137 libc.src.__support.File.platform_file
138 libc.src.__support.File.platform_stdin
141 list(APPEND scanf_copts "-DLIBC_COPT_STDIO_USE_SYSTEM_FILE")
144 add_entrypoint_object(
151 libc.src.__support.arg_list
152 libc.src.stdio.scanf_core.reader
153 libc.src.stdio.scanf_core.scanf_main
156 add_entrypoint_object(
168 add_entrypoint_object(
180 add_entrypoint_object(
187 libc.src.stdio.printf_core.printf_main
188 libc.src.stdio.printf_core.writer
191 add_entrypoint_object(
198 libc.src.stdio.printf_core.printf_main
199 libc.src.stdio.printf_core.writer
202 list(APPEND printf_deps
203 libc.src.__support.arg_list
204 libc.src.stdio.printf_core.vfprintf_internal
207 if(LIBC_CONF_PRINTF_DISABLE_FLOAT)
208 list(APPEND printf_copts "-DLIBC_COPT_PRINTF_DISABLE_FLOAT")
210 if(LIBC_CONF_PRINTF_DISABLE_INDEX_MODE)
211 list(APPEND printf_copts "-DLIBC_COPT_PRINTF_DISABLE_INDEX_MODE")
213 if(LIBC_CONF_PRINTF_DISABLE_WRITE_INT)
214 list(APPEND printf_copts "-DLIBC_COPT_PRINTF_DISABLE_WRITE_INT")
216 if(LIBC_CONF_PRINTF_FLOAT_TO_STR_USE_MEGA_LONG_DOUBLE_TABLE)
217 list(APPEND printf_copts "-DLIBC_COPT_FLOAT_TO_STR_USE_MEGA_LONG_DOUBLE_TABLE")
220 if(LLVM_LIBC_FULL_BUILD)
221 list(APPEND printf_deps
222 libc.src.__support.File.file
223 libc.src.__support.File.platform_file
224 libc.src.__support.File.platform_stdout
227 list(APPEND printf_copts "-DLIBC_COPT_STDIO_USE_SYSTEM_FILE")
230 add_entrypoint_object(
242 add_entrypoint_object(
249 libc.src.__support.arg_list
250 libc.src.stdio.printf_core.vfprintf_internal
255 add_entrypoint_object(
262 libc.src.stdio.printf_core.printf_main
263 libc.src.stdio.printf_core.writer
266 add_entrypoint_object(
273 libc.src.stdio.printf_core.printf_main
274 libc.src.stdio.printf_core.writer
277 add_entrypoint_object(
289 add_entrypoint_object(
296 libc.src.__support.arg_list
297 libc.src.stdio.printf_core.vfprintf_internal
302 add_subdirectory(printf_core)
303 add_subdirectory(scanf_core)
305 add_entrypoint_object(
314 libc.src.__support.File.file
315 libc.src.__support.File.platform_file
318 add_entrypoint_object(
322 .${LIBC_TARGET_OS}.remove
325 # These entrypoints have multiple potential implementations.
326 add_stdio_entrypoint_object(feof)
327 add_stdio_entrypoint_object(feof_unlocked)
328 add_stdio_entrypoint_object(ferror)
329 add_stdio_entrypoint_object(ferror_unlocked)
330 add_stdio_entrypoint_object(clearerr)
331 add_stdio_entrypoint_object(clearerr_unlocked)
332 add_stdio_entrypoint_object(fopen)
333 add_stdio_entrypoint_object(fclose)
334 add_stdio_entrypoint_object(fread_unlocked)
335 add_stdio_entrypoint_object(fread)
336 add_stdio_entrypoint_object(puts)
337 add_stdio_entrypoint_object(fputs)
338 add_stdio_entrypoint_object(fwrite_unlocked)
339 add_stdio_entrypoint_object(fwrite)
340 add_stdio_entrypoint_object(fputc)
341 add_stdio_entrypoint_object(putc)
342 add_stdio_entrypoint_object(putchar)
343 add_stdio_entrypoint_object(fgetc)
344 add_stdio_entrypoint_object(fgetc_unlocked)
345 add_stdio_entrypoint_object(getc)
346 add_stdio_entrypoint_object(getc_unlocked)
347 add_stdio_entrypoint_object(getchar)
348 add_stdio_entrypoint_object(getchar_unlocked)
349 add_stdio_entrypoint_object(fgets)
350 add_stdio_entrypoint_object(stdin)
351 add_stdio_entrypoint_object(stdout)
352 add_stdio_entrypoint_object(stderr)