]> git.proxmox.com Git - rustc.git/blame - src/compiler-rt/lib/builtins/CMakeLists.txt
Imported Upstream version 1.9.0+dfsg1
[rustc.git] / src / compiler-rt / lib / builtins / CMakeLists.txt
CommitLineData
1a4d82fc
JJ
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
5set(GENERIC_SOURCES
6 absvdi2.c
7 absvsi2.c
8 absvti2.c
9 adddf3.c
10 addsf3.c
92a42be0 11 addtf3.c
1a4d82fc
JJ
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
92a42be0 42 divtf3.c
1a4d82fc
JJ
43 divxc3.c
44 enable_execute_stack.c
45 eprintf.c
46 extendsfdf2.c
92a42be0 47 extendhfsf2.c
1a4d82fc
JJ
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
1a4d82fc
JJ
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
92a42be0 98 multf3.c
1a4d82fc
JJ
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
92a42be0 125 subtf3.c
1a4d82fc 126 trampoline_setup.c
92a42be0 127 truncdfhf2.c
1a4d82fc 128 truncdfsf2.c
92a42be0 129 truncsfhf2.c
1a4d82fc
JJ
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
92a42be0
SL
142if(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)
151endif()
1a4d82fc 152
92a42be0
SL
153if(NOT WIN32)
154 set(GENERIC_SOURCES
155 ${GENERIC_SOURCES}
156 emutls.c)
157endif()
158
159if (HAVE_UNWIND_H)
160 set(GENERIC_SOURCES
161 ${GENERIC_SOURCES}
162 gcc_personality_v0.c)
163endif ()
164
165if (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})
209else () # 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})
220endif () # if (NOT MSVC)
1a4d82fc
JJ
221
222set(arm_SOURCES
92a42be0
SL
223 arm/aeabi_cdcmp.S
224 arm/aeabi_cdcmpeq_check_nan.c
225 arm/aeabi_cfcmp.S
226 arm/aeabi_cfcmpeq_check_nan.c
1a4d82fc 227 arm/aeabi_dcmp.S
92a42be0
SL
228 arm/aeabi_div0.c
229 arm/aeabi_drsub.c
1a4d82fc 230 arm/aeabi_fcmp.S
92a42be0 231 arm/aeabi_frsub.c
1a4d82fc
JJ
232 arm/aeabi_idivmod.S
233 arm/aeabi_ldivmod.S
234 arm/aeabi_memcmp.S
235 arm/aeabi_memcpy.S
236 arm/aeabi_memmove.S
237 arm/aeabi_memset.S
238 arm/aeabi_uidivmod.S
239 arm/aeabi_uldivmod.S
240 arm/bswapdi2.S
241 arm/bswapsi2.S
242 arm/comparesf2.S
1a4d82fc 243 arm/divmodsi4.S
1a4d82fc 244 arm/divsi3.S
1a4d82fc 245 arm/modsi3.S
1a4d82fc
JJ
246 arm/negdf2vfp.S
247 arm/negsf2vfp.S
1a4d82fc
JJ
248 arm/switch16.S
249 arm/switch32.S
250 arm/switch8.S
251 arm/switchu8.S
252 arm/sync_fetch_and_add_4.S
253 arm/sync_fetch_and_add_8.S
254 arm/sync_fetch_and_and_4.S
255 arm/sync_fetch_and_and_8.S
256 arm/sync_fetch_and_max_4.S
257 arm/sync_fetch_and_max_8.S
258 arm/sync_fetch_and_min_4.S
259 arm/sync_fetch_and_min_8.S
260 arm/sync_fetch_and_nand_4.S
261 arm/sync_fetch_and_nand_8.S
262 arm/sync_fetch_and_or_4.S
263 arm/sync_fetch_and_or_8.S
264 arm/sync_fetch_and_sub_4.S
265 arm/sync_fetch_and_sub_8.S
266 arm/sync_fetch_and_umax_4.S
267 arm/sync_fetch_and_umax_8.S
268 arm/sync_fetch_and_umin_4.S
269 arm/sync_fetch_and_umin_8.S
270 arm/sync_fetch_and_xor_4.S
271 arm/sync_fetch_and_xor_8.S
272 arm/sync_synchronize.S
1a4d82fc
JJ
273 arm/udivmodsi4.S
274 arm/udivsi3.S
275 arm/umodsi3.S
1a4d82fc
JJ
276 ${GENERIC_SOURCES})
277
85aaf69f 278set(aarch64_SOURCES
92a42be0
SL
279 comparetf2.c
280 extenddftf2.c
281 extendsftf2.c
282 fixtfdi.c
283 fixtfsi.c
284 fixtfti.c
285 fixunstfdi.c
286 fixunstfsi.c
287 fixunstfti.c
288 floatditf.c
289 floatsitf.c
290 floatunditf.c
291 floatunsitf.c
292 multc3.c
293 trunctfdf2.c
294 trunctfsf2.c
85aaf69f
SL
295 ${GENERIC_SOURCES})
296
54a0048b
SL
297set(armhf_SOURCES
298 arm/adddf3vfp.S
299 arm/addsf3vfp.S
300 arm/divdf3vfp.S
301 arm/divsf3vfp.S
302 arm/eqdf2vfp.S
303 arm/eqsf2vfp.S
304 arm/extendsfdf2vfp.S
305 arm/fixdfsivfp.S
306 arm/fixsfsivfp.S
307 arm/fixunsdfsivfp.S
308 arm/fixunssfsivfp.S
309 arm/floatsidfvfp.S
310 arm/floatsisfvfp.S
311 arm/floatunssidfvfp.S
312 arm/floatunssisfvfp.S
313 arm/gedf2vfp.S
314 arm/gesf2vfp.S
315 arm/gtdf2vfp.S
316 arm/gtsf2vfp.S
317 arm/ledf2vfp.S
318 arm/lesf2vfp.S
319 arm/ltdf2vfp.S
320 arm/ltsf2vfp.S
321 arm/muldf3vfp.S
322 arm/mulsf3vfp.S
323 arm/nedf2vfp.S
324 arm/nesf2vfp.S
325 arm/restore_vfp_d8_d15_regs.S
326 arm/save_vfp_d8_d15_regs.S
327 arm/subdf3vfp.S
328 arm/subsf3vfp.S
329 arm/truncdfsf2vfp.S
330 arm/unorddf2vfp.S
331 arm/unordsf2vfp.S
332 ${arm_SOURCES})
92a42be0
SL
333set(armv7_SOURCES ${arm_SOURCES})
334set(armv7s_SOURCES ${arm_SOURCES})
335set(arm64_SOURCES ${aarch64_SOURCES})
336
337# macho_embedded archs
338set(armv6m_SOURCES ${GENERIC_SOURCES})
339set(armv7m_SOURCES ${arm_SOURCES})
340set(armv7em_SOURCES ${arm_SOURCES})
341
342set(mips_SOURCES ${GENERIC_SOURCES})
343set(mipsel_SOURCES ${mips_SOURCES})
344set(mips64_SOURCES ${mips_SOURCES})
345set(mips64el_SOURCES ${mips_SOURCES})
346
1a4d82fc
JJ
347add_custom_target(builtins)
348
92a42be0
SL
349if (APPLE)
350 add_subdirectory(Darwin-excludes)
351 add_subdirectory(macho_embedded)
352 darwin_add_builtin_libraries(${BUILTIN_SUPPORTED_OS})
353else ()
354 foreach (arch ${BUILTIN_SUPPORTED_ARCH})
355 if (CAN_TARGET_${arch})
356 # Filter out generic versions of routines that are re-implemented in
357 # architecture specific manner. This prevents multiple definitions of the
358 # same symbols, making the symbol selection non-deterministic.
359 foreach (_file ${${arch}_SOURCES})
360 if (${_file} MATCHES ${arch}/*)
361 get_filename_component(_name ${_file} NAME)
362 string(REPLACE ".S" ".c" _cname "${_name}")
363 list(REMOVE_ITEM ${arch}_SOURCES ${_cname})
364 endif ()
365 endforeach ()
366
367 # Rust: don't insert a reference to MSVCRT.lib/etc
368 if (MSVC)
369 set(_cflags -Zl)
370 else ()
371 set(_cflags -std=c99)
372 endif ()
373
374 add_compiler_rt_runtime(clang_rt.builtins
375 STATIC
376 ARCHS ${arch}
377 SOURCES ${${arch}_SOURCES}
378 CFLAGS ${_cflags}
379 PARENT_TARGET builtins)
380 endif ()
381 endforeach ()
382endif ()
1a4d82fc
JJ
383
384add_dependencies(compiler-rt builtins)