]> git.proxmox.com Git - rustc.git/blob - src/compiler-rt/lib/builtins/CMakeLists.txt
Imported Upstream version 1.6.0+dfsg1
[rustc.git] / src / compiler-rt / lib / builtins / CMakeLists.txt
1 # This directory contains a large amount of C code which provides
2 # generic implementations of the core runtime library along with optimized
3 # architecture-specific code in various subdirectories.
4
5 set(GENERIC_SOURCES
6 absvdi2.c
7 absvsi2.c
8 absvti2.c
9 adddf3.c
10 addsf3.c
11 addtf3.c
12 addvdi3.c
13 addvsi3.c
14 addvti3.c
15 apple_versioning.c
16 ashldi3.c
17 ashlti3.c
18 ashrdi3.c
19 ashrti3.c
20 # FIXME: atomic.c may only be compiled if host compiler understands _Atomic
21 # atomic.c
22 clear_cache.c
23 clzdi2.c
24 clzsi2.c
25 clzti2.c
26 cmpdi2.c
27 cmpti2.c
28 comparedf2.c
29 comparesf2.c
30 ctzdi2.c
31 ctzsi2.c
32 ctzti2.c
33 divdc3.c
34 divdf3.c
35 divdi3.c
36 divmoddi4.c
37 divmodsi4.c
38 divsc3.c
39 divsf3.c
40 divsi3.c
41 divti3.c
42 divtf3.c
43 divxc3.c
44 enable_execute_stack.c
45 eprintf.c
46 extendsfdf2.c
47 extendhfsf2.c
48 ffsdi2.c
49 ffsti2.c
50 fixdfdi.c
51 fixdfsi.c
52 fixdfti.c
53 fixsfdi.c
54 fixsfsi.c
55 fixsfti.c
56 fixunsdfdi.c
57 fixunsdfsi.c
58 fixunsdfti.c
59 fixunssfdi.c
60 fixunssfsi.c
61 fixunssfti.c
62 fixunsxfdi.c
63 fixunsxfsi.c
64 fixunsxfti.c
65 fixxfdi.c
66 fixxfti.c
67 floatdidf.c
68 floatdisf.c
69 floatdixf.c
70 floatsidf.c
71 floatsisf.c
72 floattidf.c
73 floattisf.c
74 floattixf.c
75 floatundidf.c
76 floatundisf.c
77 floatundixf.c
78 floatunsidf.c
79 floatunsisf.c
80 floatuntidf.c
81 floatuntisf.c
82 floatuntixf.c
83 int_util.c
84 lshrdi3.c
85 lshrti3.c
86 moddi3.c
87 modsi3.c
88 modti3.c
89 muldc3.c
90 muldf3.c
91 muldi3.c
92 mulodi4.c
93 mulosi4.c
94 muloti4.c
95 mulsc3.c
96 mulsf3.c
97 multi3.c
98 multf3.c
99 mulvdi3.c
100 mulvsi3.c
101 mulvti3.c
102 mulxc3.c
103 negdf2.c
104 negdi2.c
105 negsf2.c
106 negti2.c
107 negvdi2.c
108 negvsi2.c
109 negvti2.c
110 paritydi2.c
111 paritysi2.c
112 parityti2.c
113 popcountdi2.c
114 popcountsi2.c
115 popcountti2.c
116 powidf2.c
117 powisf2.c
118 powitf2.c
119 powixf2.c
120 subdf3.c
121 subsf3.c
122 subvdi3.c
123 subvsi3.c
124 subvti3.c
125 subtf3.c
126 trampoline_setup.c
127 truncdfhf2.c
128 truncdfsf2.c
129 truncsfhf2.c
130 ucmpdi2.c
131 ucmpti2.c
132 udivdi3.c
133 udivmoddi4.c
134 udivmodsi4.c
135 udivmodti4.c
136 udivsi3.c
137 udivti3.c
138 umoddi3.c
139 umodsi3.c
140 umodti3.c)
141
142 if(APPLE)
143 set(GENERIC_SOURCES
144 ${GENERIC_SOURCES}
145 atomic_flag_clear.c
146 atomic_flag_clear_explicit.c
147 atomic_flag_test_and_set.c
148 atomic_flag_test_and_set_explicit.c
149 atomic_signal_fence.c
150 atomic_thread_fence.c)
151 endif()
152
153 if(NOT WIN32)
154 set(GENERIC_SOURCES
155 ${GENERIC_SOURCES}
156 emutls.c)
157 endif()
158
159 if (HAVE_UNWIND_H)
160 set(GENERIC_SOURCES
161 ${GENERIC_SOURCES}
162 gcc_personality_v0.c)
163 endif ()
164
165 if (NOT MSVC)
166 set(x86_64_SOURCES
167 x86_64/floatdidf.c
168 x86_64/floatdisf.c
169 x86_64/floatdixf.c
170 x86_64/floatundidf.S
171 x86_64/floatundisf.S
172 x86_64/floatundixf.S
173 ${GENERIC_SOURCES})
174 set(x86_64h_SOURCES ${x86_64_SOURCES})
175
176 if (WIN32)
177 set(x86_64_SOURCES
178 ${x86_64_SOURCES}
179 x86_64/chkstk.S
180 x86_64/chkstk2.S)
181 endif()
182
183 set(i386_SOURCES
184 i386/ashldi3.S
185 i386/ashrdi3.S
186 i386/divdi3.S
187 i386/floatdidf.S
188 i386/floatdisf.S
189 i386/floatdixf.S
190 i386/floatundidf.S
191 i386/floatundisf.S
192 i386/floatundixf.S
193 i386/lshrdi3.S
194 i386/moddi3.S
195 i386/muldi3.S
196 i386/udivdi3.S
197 i386/umoddi3.S
198 ${GENERIC_SOURCES})
199
200 if (WIN32)
201 set(i386_SOURCES
202 ${i386_SOURCES}
203 i386/chkstk.S
204 i386/chkstk2.S)
205 endif()
206
207 set(i686_SOURCES
208 ${i386_SOURCES})
209 else () # MSVC
210 # Use C versions of functions when building on MSVC
211 # MSVC's assembler takes Intel syntax, not AT&T syntax
212 set(x86_64_SOURCES
213 x86_64/floatdidf.c
214 x86_64/floatdisf.c
215 x86_64/floatdixf.c
216 ${GENERIC_SOURCES})
217 set(x86_64h_SOURCES ${x86_64_SOURCES})
218 set(i386_SOURCES ${GENERIC_SOURCES})
219 set(i686_SOURCES ${i386_SOURCES})
220 endif () # if (NOT MSVC)
221
222 set(arm_SOURCES
223 arm/adddf3vfp.S
224 arm/addsf3vfp.S
225 arm/aeabi_cdcmp.S
226 arm/aeabi_cdcmpeq_check_nan.c
227 arm/aeabi_cfcmp.S
228 arm/aeabi_cfcmpeq_check_nan.c
229 arm/aeabi_dcmp.S
230 arm/aeabi_div0.c
231 arm/aeabi_drsub.c
232 arm/aeabi_fcmp.S
233 arm/aeabi_frsub.c
234 arm/aeabi_idivmod.S
235 arm/aeabi_ldivmod.S
236 arm/aeabi_memcmp.S
237 arm/aeabi_memcpy.S
238 arm/aeabi_memmove.S
239 arm/aeabi_memset.S
240 arm/aeabi_uidivmod.S
241 arm/aeabi_uldivmod.S
242 arm/bswapdi2.S
243 arm/bswapsi2.S
244 arm/comparesf2.S
245 arm/divdf3vfp.S
246 arm/divmodsi4.S
247 arm/divsf3vfp.S
248 arm/divsi3.S
249 arm/eqdf2vfp.S
250 arm/eqsf2vfp.S
251 arm/extendsfdf2vfp.S
252 arm/fixdfsivfp.S
253 arm/fixsfsivfp.S
254 arm/fixunsdfsivfp.S
255 arm/fixunssfsivfp.S
256 arm/floatsidfvfp.S
257 arm/floatsisfvfp.S
258 arm/floatunssidfvfp.S
259 arm/floatunssisfvfp.S
260 arm/gedf2vfp.S
261 arm/gesf2vfp.S
262 arm/gtdf2vfp.S
263 arm/gtsf2vfp.S
264 arm/ledf2vfp.S
265 arm/lesf2vfp.S
266 arm/ltdf2vfp.S
267 arm/ltsf2vfp.S
268 arm/modsi3.S
269 arm/muldf3vfp.S
270 arm/mulsf3vfp.S
271 arm/nedf2vfp.S
272 arm/negdf2vfp.S
273 arm/negsf2vfp.S
274 arm/nesf2vfp.S
275 arm/restore_vfp_d8_d15_regs.S
276 arm/save_vfp_d8_d15_regs.S
277 arm/subdf3vfp.S
278 arm/subsf3vfp.S
279 arm/switch16.S
280 arm/switch32.S
281 arm/switch8.S
282 arm/switchu8.S
283 arm/sync_fetch_and_add_4.S
284 arm/sync_fetch_and_add_8.S
285 arm/sync_fetch_and_and_4.S
286 arm/sync_fetch_and_and_8.S
287 arm/sync_fetch_and_max_4.S
288 arm/sync_fetch_and_max_8.S
289 arm/sync_fetch_and_min_4.S
290 arm/sync_fetch_and_min_8.S
291 arm/sync_fetch_and_nand_4.S
292 arm/sync_fetch_and_nand_8.S
293 arm/sync_fetch_and_or_4.S
294 arm/sync_fetch_and_or_8.S
295 arm/sync_fetch_and_sub_4.S
296 arm/sync_fetch_and_sub_8.S
297 arm/sync_fetch_and_umax_4.S
298 arm/sync_fetch_and_umax_8.S
299 arm/sync_fetch_and_umin_4.S
300 arm/sync_fetch_and_umin_8.S
301 arm/sync_fetch_and_xor_4.S
302 arm/sync_fetch_and_xor_8.S
303 arm/sync_synchronize.S
304 arm/truncdfsf2vfp.S
305 arm/udivmodsi4.S
306 arm/udivsi3.S
307 arm/umodsi3.S
308 arm/unorddf2vfp.S
309 arm/unordsf2vfp.S
310 ${GENERIC_SOURCES})
311
312 set(aarch64_SOURCES
313 comparetf2.c
314 extenddftf2.c
315 extendsftf2.c
316 fixtfdi.c
317 fixtfsi.c
318 fixtfti.c
319 fixunstfdi.c
320 fixunstfsi.c
321 fixunstfti.c
322 floatditf.c
323 floatsitf.c
324 floatunditf.c
325 floatunsitf.c
326 multc3.c
327 trunctfdf2.c
328 trunctfsf2.c
329 ${GENERIC_SOURCES})
330
331 set(armhf_SOURCES ${arm_SOURCES})
332 set(armv7_SOURCES ${arm_SOURCES})
333 set(armv7s_SOURCES ${arm_SOURCES})
334 set(arm64_SOURCES ${aarch64_SOURCES})
335
336 # macho_embedded archs
337 set(armv6m_SOURCES ${GENERIC_SOURCES})
338 set(armv7m_SOURCES ${arm_SOURCES})
339 set(armv7em_SOURCES ${arm_SOURCES})
340
341 set(mips_SOURCES ${GENERIC_SOURCES})
342 set(mipsel_SOURCES ${mips_SOURCES})
343 set(mips64_SOURCES ${mips_SOURCES})
344 set(mips64el_SOURCES ${mips_SOURCES})
345
346 add_custom_target(builtins)
347
348 if (APPLE)
349 add_subdirectory(Darwin-excludes)
350 add_subdirectory(macho_embedded)
351 darwin_add_builtin_libraries(${BUILTIN_SUPPORTED_OS})
352 else ()
353 foreach (arch ${BUILTIN_SUPPORTED_ARCH})
354 if (CAN_TARGET_${arch})
355 # Filter out generic versions of routines that are re-implemented in
356 # architecture specific manner. This prevents multiple definitions of the
357 # same symbols, making the symbol selection non-deterministic.
358 foreach (_file ${${arch}_SOURCES})
359 if (${_file} MATCHES ${arch}/*)
360 get_filename_component(_name ${_file} NAME)
361 string(REPLACE ".S" ".c" _cname "${_name}")
362 list(REMOVE_ITEM ${arch}_SOURCES ${_cname})
363 endif ()
364 endforeach ()
365
366 # Rust: don't insert a reference to MSVCRT.lib/etc
367 if (MSVC)
368 set(_cflags -Zl)
369 else ()
370 set(_cflags -std=c99)
371 endif ()
372
373 add_compiler_rt_runtime(clang_rt.builtins
374 STATIC
375 ARCHS ${arch}
376 SOURCES ${${arch}_SOURCES}
377 CFLAGS ${_cflags}
378 PARENT_TARGET builtins)
379 endif ()
380 endforeach ()
381 endif ()
382
383 add_dependencies(compiler-rt builtins)