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  strtof
43  SRCS
44    strtof.cpp
45  HDRS
46    strtof.h
47  DEPENDS
48    libc.src.__support.str_to_float
49)
50
51add_entrypoint_object(
52  strtod
53  SRCS
54    strtod.cpp
55  HDRS
56    strtod.h
57  DEPENDS
58    libc.src.__support.str_to_float
59)
60
61add_entrypoint_object(
62  strtold
63  SRCS
64    strtold.cpp
65  HDRS
66    strtold.h
67  DEPENDS
68    libc.src.__support.str_to_float
69)
70
71add_entrypoint_object(
72  strtol
73  SRCS
74    strtol.cpp
75  HDRS
76    strtol.h
77  DEPENDS
78    libc.src.__support.str_to_integer
79)
80
81add_entrypoint_object(
82  strtoll
83  SRCS
84    strtoll.cpp
85  HDRS
86    strtoll.h
87  DEPENDS
88    libc.src.__support.str_to_integer
89)
90
91add_entrypoint_object(
92  strtoul
93  SRCS
94    strtoul.cpp
95  HDRS
96    strtoul.h
97  DEPENDS
98    libc.src.__support.str_to_integer
99)
100
101add_entrypoint_object(
102  strtoull
103  SRCS
104    strtoull.cpp
105  HDRS
106    strtoull.h
107  DEPENDS
108    libc.src.__support.str_to_integer
109)
110
111add_entrypoint_object(
112  abs
113  SRCS
114    abs.cpp
115  HDRS
116    abs.h
117  DEPENDS
118    libc.src.__support.integer_operations
119)
120
121add_entrypoint_object(
122  labs
123  SRCS
124    labs.cpp
125  HDRS
126    labs.h
127  DEPENDS
128    libc.src.__support.integer_operations
129)
130
131add_entrypoint_object(
132  llabs
133  SRCS
134    llabs.cpp
135  HDRS
136    llabs.h
137  DEPENDS
138    libc.src.__support.integer_operations
139)
140
141add_entrypoint_object(
142  div
143  SRCS
144    div.cpp
145  HDRS
146    div.h
147  DEPENDS
148    libc.include.stdlib
149    libc.src.__support.integer_operations
150)
151
152add_entrypoint_object(
153  ldiv
154  SRCS
155    ldiv.cpp
156  HDRS
157    ldiv.h
158  DEPENDS
159    libc.include.stdlib
160    libc.src.__support.integer_operations
161)
162
163add_entrypoint_object(
164  lldiv
165  SRCS
166    lldiv.cpp
167  HDRS
168    lldiv.h
169  DEPENDS
170    libc.include.stdlib
171    libc.src.__support.integer_operations
172)
173
174add_entrypoint_object(
175  bsearch
176  SRCS
177    bsearch.cpp
178  HDRS
179    bsearch.h
180  DEPENDS
181    libc.include.stdlib
182)
183
184add_entrypoint_object(
185  qsort
186  SRCS
187    qsort.cpp
188  HDRS
189    qsort.h
190  DEPENDS
191    libc.include.stdlib
192)
193
194if(LLVM_LIBC_INCLUDE_SCUDO)
195  set(SCUDO_DEPS "")
196
197  include(${LIBC_SOURCE_DIR}/../compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake)
198  if(NOT (LIBC_TARGET_ARCHITECTURE IN_LIST ALL_SCUDO_STANDALONE_SUPPORTED_ARCH))
199    message(FATAL_ERROR "Architecture ${LIBC_TARGET_ARCHITECTURE} is not supported by SCUDO.
200      Either disable LLVM_LIBC_INCLUDE_SCUDO or change your target architecture.")
201  endif()
202  list(APPEND SCUDO_DEPS RTScudoStandalone.${LIBC_TARGET_ARCHITECTURE}
203       RTScudoStandaloneCWrappers.${LIBC_TARGET_ARCHITECTURE})
204  if((LIBC_TARGET_ARCHITECTURE IN_LIST ALL_GWP_ASAN_SUPPORTED_ARCH)
205      AND COMPILER_RT_BUILD_GWP_ASAN)
206    list(APPEND SCUDO_DEPS RTGwpAsan.${LIBC_TARGET_ARCHITECTURE}
207                            RTGwpAsanBacktraceLibc.${LIBC_TARGET_ARCHITECTURE}
208                            RTGwpAsanSegvHandler.${LIBC_TARGET_ARCHITECTURE})
209  elseif(COMPILER_RT_BUILD_GWP_ASAN)
210    message(WARNING "Architecture ${LIBC_TARGET_ARCHITECTURE} is not supported by GWP-ASan. Skipping.")
211  endif()
212
213  add_entrypoint_external(
214    malloc
215    DEPENDS
216      ${SCUDO_DEPS}
217  )
218  add_entrypoint_external(
219    calloc
220    DEPENDS
221      ${SCUDO_DEPS}
222  )
223  add_entrypoint_external(
224    realloc
225    DEPENDS
226      ${SCUDO_DEPS}
227  )
228  add_entrypoint_external(
229    free
230    DEPENDS
231      ${SCUDO_DEPS}
232  )
233
234endif()
235
236if(NOT LLVM_LIBC_FULL_BUILD)
237  return()
238endif()
239
240if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
241  add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
242endif()
243
244add_entrypoint_object(
245  _Exit
246  ALIAS
247  DEPENDS
248    .${LIBC_TARGET_OS}._Exit
249)
250
251# add_entrypoint_object(
252#   abort
253#   SRCS
254#     abort.cpp
255#   HDRS
256#     abort.h
257#   DEPENDS
258#     libc.include.stdlib
259#     libc.src.signal.raise
260#     ._Exit
261# )
262