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