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