1add_entrypoint_object(
2  atoi
3  SRCS
4    atoi.cpp
5  HDRS
6    atoi.h
7  DEPENDS
8    libc.src.__support.str_to_integer
9)
10
11add_entrypoint_object(
12  atof
13  SRCS
14    atof.cpp
15  HDRS
16    atof.h
17  DEPENDS
18    libc.src.__support.str_to_float
19)
20
21add_entrypoint_object(
22  atol
23  SRCS
24    atol.cpp
25  HDRS
26    atol.h
27  DEPENDS
28    libc.src.__support.str_to_integer
29)
30
31add_entrypoint_object(
32  atoll
33  SRCS
34    atoll.cpp
35  HDRS
36    atoll.h
37  DEPENDS
38    libc.src.__support.str_to_integer
39)
40
41add_entrypoint_object(
42  getenv
43  SRCS
44    getenv.cpp
45  HDRS
46    getenv.h
47  DEPENDS
48    libc.config.linux.app_h
49    libc.src.string.strncmp
50)
51
52add_entrypoint_object(
53  strtof
54  SRCS
55    strtof.cpp
56  HDRS
57    strtof.h
58  DEPENDS
59    libc.src.__support.str_to_float
60)
61
62add_entrypoint_object(
63  strtod
64  SRCS
65    strtod.cpp
66  HDRS
67    strtod.h
68  DEPENDS
69    libc.src.__support.str_to_float
70)
71
72add_entrypoint_object(
73  strtold
74  SRCS
75    strtold.cpp
76  HDRS
77    strtold.h
78  DEPENDS
79    libc.src.__support.str_to_float
80)
81
82add_entrypoint_object(
83  strtol
84  SRCS
85    strtol.cpp
86  HDRS
87    strtol.h
88  DEPENDS
89    libc.src.__support.str_to_integer
90)
91
92add_entrypoint_object(
93  strtoll
94  SRCS
95    strtoll.cpp
96  HDRS
97    strtoll.h
98  DEPENDS
99    libc.src.__support.str_to_integer
100)
101
102add_entrypoint_object(
103  strtoul
104  SRCS
105    strtoul.cpp
106  HDRS
107    strtoul.h
108  DEPENDS
109    libc.src.__support.str_to_integer
110)
111
112add_entrypoint_object(
113  strtoull
114  SRCS
115    strtoull.cpp
116  HDRS
117    strtoull.h
118  DEPENDS
119    libc.src.__support.str_to_integer
120)
121
122add_entrypoint_object(
123  abs
124  SRCS
125    abs.cpp
126  HDRS
127    abs.h
128  DEPENDS
129    libc.src.__support.integer_operations
130)
131
132add_entrypoint_object(
133  labs
134  SRCS
135    labs.cpp
136  HDRS
137    labs.h
138  DEPENDS
139    libc.src.__support.integer_operations
140)
141
142add_entrypoint_object(
143  llabs
144  SRCS
145    llabs.cpp
146  HDRS
147    llabs.h
148  DEPENDS
149    libc.src.__support.integer_operations
150)
151
152add_entrypoint_object(
153  div
154  SRCS
155    div.cpp
156  HDRS
157    div.h
158  DEPENDS
159    libc.include.stdlib
160    libc.src.__support.integer_operations
161)
162
163add_entrypoint_object(
164  ldiv
165  SRCS
166    ldiv.cpp
167  HDRS
168    ldiv.h
169  DEPENDS
170    libc.include.stdlib
171    libc.src.__support.integer_operations
172)
173
174add_entrypoint_object(
175  lldiv
176  SRCS
177    lldiv.cpp
178  HDRS
179    lldiv.h
180  DEPENDS
181    libc.include.stdlib
182    libc.src.__support.integer_operations
183)
184
185add_entrypoint_object(
186  bsearch
187  SRCS
188    bsearch.cpp
189  HDRS
190    bsearch.h
191  DEPENDS
192    libc.include.stdlib
193)
194
195add_entrypoint_object(
196  qsort
197  SRCS
198    qsort.cpp
199  HDRS
200    qsort.h
201  DEPENDS
202    libc.include.stdlib
203)
204
205if(LLVM_LIBC_INCLUDE_SCUDO)
206  set(SCUDO_DEPS "")
207
208  include(${LIBC_SOURCE_DIR}/../compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake)
209  if(NOT (LIBC_TARGET_ARCHITECTURE IN_LIST ALL_SCUDO_STANDALONE_SUPPORTED_ARCH))
210    message(FATAL_ERROR "Architecture ${LIBC_TARGET_ARCHITECTURE} is not supported by SCUDO.
211      Either disable LLVM_LIBC_INCLUDE_SCUDO or change your target architecture.")
212  endif()
213
214  list(APPEND SCUDO_DEPS RTScudoStandalone.${LIBC_TARGET_ARCHITECTURE}
215      RTScudoStandaloneCWrappers.${LIBC_TARGET_ARCHITECTURE})
216
217  list(APPEND SCUDO_DEPS
218    RTGwpAsan.${LIBC_TARGET_ARCHITECTURE}
219    RTGwpAsanBacktraceLibc.${LIBC_TARGET_ARCHITECTURE}
220    RTGwpAsanSegvHandler.${LIBC_TARGET_ARCHITECTURE}
221    )
222
223  add_entrypoint_external(
224    malloc
225    DEPENDS
226      ${SCUDO_DEPS}
227  )
228  add_entrypoint_external(
229    calloc
230    DEPENDS
231      ${SCUDO_DEPS}
232  )
233  add_entrypoint_external(
234    realloc
235    DEPENDS
236      ${SCUDO_DEPS}
237  )
238  add_entrypoint_external(
239    free
240    DEPENDS
241      ${SCUDO_DEPS}
242  )
243else()
244  add_entrypoint_external(
245    malloc
246  )
247  add_entrypoint_external(
248    calloc
249  )
250  add_entrypoint_external(
251    realloc
252  )
253  add_entrypoint_external(
254    free
255  )
256endif()
257
258if(NOT LLVM_LIBC_FULL_BUILD)
259  return()
260endif()
261
262if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
263  add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
264endif()
265
266add_entrypoint_object(
267  _Exit
268  ALIAS
269  DEPENDS
270    .${LIBC_TARGET_OS}._Exit
271)
272
273add_entrypoint_object(
274  atexit
275  SRCS
276    atexit.cpp
277  HDRS
278    atexit.h
279  CXX_STANDARD
280    20 # For constinit of the atexit callback list.
281  DEPENDS
282    libc.src.__support.CPP.blockstore
283    libc.src.__support.threads.thread
284)
285
286add_entrypoint_object(
287  exit
288  SRCS
289    exit.cpp
290  HDRS
291    exit.h
292  DEPENDS
293    ._Exit
294    .atexit
295)
296
297# add_entrypoint_object(
298#   abort
299#   ALIAS
300#   DEPENDS
301#     .${LIBC_TARGET_OS}.abort
302# )
303