blob: ee48e441d1c59f4a57ac246ed6fa6bd8fabe4251 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
|
# Helper function that creates an alias if a target specific implementation
# exists, otherwise it uses a generic one.
function(add_stdio_entrypoint_object name)
if(TARGET libc.src.stdio.${LIBC_TARGET_OS}.${name})
add_entrypoint_object(
${name}
ALIAS
DEPENDS
.${LIBC_TARGET_OS}.${name}
)
elseif(TARGET libc.src.stdio.generic.${name})
add_entrypoint_object(
${name}
ALIAS
DEPENDS
.generic.${name}
)
endif()
endfunction(add_stdio_entrypoint_object)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
endif()
if(NOT LIBC_TARGET_OS_IS_GPU)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/generic)
endif()
if(NOT LLVM_LIBC_FULL_BUILD)
list(APPEND use_system_file "COMPILE_OPTIONS" "-DLIBC_COPT_STDIO_USE_SYSTEM_FILE")
endif()
add_entrypoint_object(
flockfile
SRCS
flockfile.cpp
HDRS
flockfile.h
DEPENDS
libc.include.stdio
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
add_entrypoint_object(
funlockfile
SRCS
funlockfile.cpp
HDRS
funlockfile.h
DEPENDS
libc.include.stdio
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
add_entrypoint_object(
fopencookie
SRCS
fopencookie.cpp
HDRS
fopencookie.h
DEPENDS
libc.include.stdio
libc.src.__support.CPP.new
libc.src.__support.File.file
)
add_entrypoint_object(
setbuf
SRCS
setbuf.cpp
HDRS
setbuf.h
DEPENDS
libc.src.errno.errno
libc.include.stdio
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
add_entrypoint_object(
setvbuf
SRCS
setvbuf.cpp
HDRS
setvbuf.h
DEPENDS
libc.src.errno.errno
libc.include.stdio
libc.src.__support.File.file
libc.src.__support.File.platform_file
)
list(APPEND scanf_deps
libc.src.__support.arg_list
libc.src.stdio.scanf_core.vfscanf_internal
)
if(LLVM_LIBC_FULL_BUILD)
list(APPEND scanf_deps
libc.src.__support.File.file
libc.src.__support.File.platform_file
libc.src.__support.File.platform_stdin
)
endif()
add_entrypoint_object(
sscanf
SRCS
sscanf.cpp
HDRS
sscanf.h
DEPENDS
libc.src.__support.arg_list
libc.src.stdio.scanf_core.reader
libc.src.stdio.scanf_core.scanf_main
)
add_entrypoint_object(
fscanf
SRCS
fscanf.cpp
HDRS
fscanf.h
DEPENDS
${scanf_deps}
)
add_entrypoint_object(
scanf
SRCS
scanf.cpp
HDRS
scanf.h
DEPENDS
${scanf_deps}
)
add_entrypoint_object(
sprintf
SRCS
sprintf.cpp
HDRS
sprintf.h
DEPENDS
libc.src.stdio.printf_core.printf_main
libc.src.stdio.printf_core.writer
)
add_entrypoint_object(
snprintf
SRCS
snprintf.cpp
HDRS
snprintf.h
DEPENDS
libc.src.stdio.printf_core.printf_main
libc.src.stdio.printf_core.writer
)
add_entrypoint_object(
fprintf
SRCS
fprintf.cpp
HDRS
fprintf.h
DEPENDS
libc.src.__support.arg_list
libc.src.stdio.printf_core.vfprintf_internal
)
add_entrypoint_object(
vsprintf
SRCS
vsprintf.cpp
HDRS
vsprintf.h
DEPENDS
libc.src.stdio.printf_core.printf_main
libc.src.stdio.printf_core.writer
)
add_entrypoint_object(
vsnprintf
SRCS
vsnprintf.cpp
HDRS
vsnprintf.h
DEPENDS
libc.src.stdio.printf_core.printf_main
libc.src.stdio.printf_core.writer
)
add_entrypoint_object(
vfprintf
SRCS
vfprintf.cpp
HDRS
vfprintf.h
DEPENDS
libc.src.__support.arg_list
libc.src.stdio.printf_core.vfprintf_internal
)
add_stdio_entrypoint_object(
fileno
SRCS
fileno.cpp
HDRS
fileno.h
DEPENDS
libc.src.stdio.fileno
)
add_subdirectory(printf_core)
add_subdirectory(scanf_core)
add_entrypoint_object(
remove
ALIAS
DEPENDS
.${LIBC_TARGET_OS}.remove
)
add_entrypoint_object(
rename
ALIAS
DEPENDS
.${LIBC_TARGET_OS}.rename
)
# These entrypoints have multiple potential implementations.
add_stdio_entrypoint_object(feof)
add_stdio_entrypoint_object(feof_unlocked)
add_stdio_entrypoint_object(ferror)
add_stdio_entrypoint_object(ferror_unlocked)
add_stdio_entrypoint_object(fseek)
add_stdio_entrypoint_object(ftell)
add_stdio_entrypoint_object(fseeko)
add_stdio_entrypoint_object(ftello)
add_stdio_entrypoint_object(fflush)
add_stdio_entrypoint_object(clearerr)
add_stdio_entrypoint_object(clearerr_unlocked)
add_stdio_entrypoint_object(fopen)
add_stdio_entrypoint_object(fclose)
add_stdio_entrypoint_object(fread_unlocked)
add_stdio_entrypoint_object(fread)
add_stdio_entrypoint_object(puts)
add_stdio_entrypoint_object(fputs)
add_stdio_entrypoint_object(fwrite_unlocked)
add_stdio_entrypoint_object(fwrite)
add_stdio_entrypoint_object(fputc)
add_stdio_entrypoint_object(putc)
add_stdio_entrypoint_object(putchar)
add_stdio_entrypoint_object(printf)
add_stdio_entrypoint_object(fgetc)
add_stdio_entrypoint_object(fgetc_unlocked)
add_stdio_entrypoint_object(getc)
add_stdio_entrypoint_object(getc_unlocked)
add_stdio_entrypoint_object(getchar)
add_stdio_entrypoint_object(getchar_unlocked)
add_stdio_entrypoint_object(fgets)
add_stdio_entrypoint_object(ungetc)
add_stdio_entrypoint_object(stdin)
add_stdio_entrypoint_object(stdout)
add_stdio_entrypoint_object(stderr)
add_stdio_entrypoint_object(vprintf)
|