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 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 142if (HAVE_UNWIND_H) 143 set(GENERIC_SOURCES 144 ${GENERIC_SOURCES} 145 gcc_personality_v0.c) 146endif () 147 148set(x86_64_SOURCES 149 x86_64/floatdidf.c 150 x86_64/floatdisf.c 151 x86_64/floatdixf.c 152 x86_64/floatundidf.S 153 x86_64/floatundisf.S 154 x86_64/floatundixf.S 155 ${GENERIC_SOURCES}) 156 157set(i386_SOURCES 158 i386/ashldi3.S 159 i386/ashrdi3.S 160 i386/divdi3.S 161 i386/floatdidf.S 162 i386/floatdisf.S 163 i386/floatdixf.S 164 i386/floatundidf.S 165 i386/floatundisf.S 166 i386/floatundixf.S 167 i386/lshrdi3.S 168 i386/moddi3.S 169 i386/muldi3.S 170 i386/udivdi3.S 171 i386/umoddi3.S 172 ${GENERIC_SOURCES}) 173 174set(i686_SOURCES 175 ${i386_SOURCES}) 176 177set(arm_SOURCES 178 arm/adddf3vfp.S 179 arm/addsf3vfp.S 180 arm/aeabi_dcmp.S 181 arm/aeabi_div0.c 182 arm/aeabi_fcmp.S 183 arm/aeabi_idivmod.S 184 arm/aeabi_ldivmod.S 185 arm/aeabi_memcmp.S 186 arm/aeabi_memcpy.S 187 arm/aeabi_memmove.S 188 arm/aeabi_memset.S 189 arm/aeabi_uidivmod.S 190 arm/aeabi_uldivmod.S 191 arm/bswapdi2.S 192 arm/bswapsi2.S 193 arm/comparesf2.S 194 arm/divdf3vfp.S 195 arm/divmodsi4.S 196 arm/divsf3vfp.S 197 arm/divsi3.S 198 arm/eqdf2vfp.S 199 arm/eqsf2vfp.S 200 arm/extendsfdf2vfp.S 201 arm/fixdfsivfp.S 202 arm/fixsfsivfp.S 203 arm/fixunsdfsivfp.S 204 arm/fixunssfsivfp.S 205 arm/floatsidfvfp.S 206 arm/floatsisfvfp.S 207 arm/floatunssidfvfp.S 208 arm/floatunssisfvfp.S 209 arm/gedf2vfp.S 210 arm/gesf2vfp.S 211 arm/gtdf2vfp.S 212 arm/gtsf2vfp.S 213 arm/ledf2vfp.S 214 arm/lesf2vfp.S 215 arm/ltdf2vfp.S 216 arm/ltsf2vfp.S 217 arm/modsi3.S 218 arm/muldf3vfp.S 219 arm/mulsf3vfp.S 220 arm/nedf2vfp.S 221 arm/negdf2vfp.S 222 arm/negsf2vfp.S 223 arm/nesf2vfp.S 224 arm/restore_vfp_d8_d15_regs.S 225 arm/save_vfp_d8_d15_regs.S 226 arm/subdf3vfp.S 227 arm/subsf3vfp.S 228 arm/switch16.S 229 arm/switch32.S 230 arm/switch8.S 231 arm/switchu8.S 232 arm/sync_fetch_and_add_4.S 233 arm/sync_fetch_and_add_8.S 234 arm/sync_fetch_and_and_4.S 235 arm/sync_fetch_and_and_8.S 236 arm/sync_fetch_and_max_4.S 237 arm/sync_fetch_and_max_8.S 238 arm/sync_fetch_and_min_4.S 239 arm/sync_fetch_and_min_8.S 240 arm/sync_fetch_and_nand_4.S 241 arm/sync_fetch_and_nand_8.S 242 arm/sync_fetch_and_or_4.S 243 arm/sync_fetch_and_or_8.S 244 arm/sync_fetch_and_sub_4.S 245 arm/sync_fetch_and_sub_8.S 246 arm/sync_fetch_and_umax_4.S 247 arm/sync_fetch_and_umax_8.S 248 arm/sync_fetch_and_umin_4.S 249 arm/sync_fetch_and_umin_8.S 250 arm/sync_fetch_and_xor_4.S 251 arm/sync_fetch_and_xor_8.S 252 arm/sync_synchronize.S 253 arm/truncdfsf2vfp.S 254 arm/udivmodsi4.S 255 arm/udivsi3.S 256 arm/umodsi3.S 257 arm/unorddf2vfp.S 258 arm/unordsf2vfp.S 259 ${GENERIC_SOURCES}) 260 261add_custom_target(builtins) 262 263if (NOT WIN32) 264 foreach (arch x86_64 i386 i686 arm) 265 if (CAN_TARGET_${arch}) 266 # Filter out generic versions of routines that are re-implemented in 267 # architecture specific manner. This prevents multiple definitions of the 268 # same symbols, making the symbol selection non-deterministic. 269 foreach (_file ${${arch}_SOURCES}) 270 if (${_file} MATCHES ${arch}/*) 271 get_filename_component(_name ${_file} NAME) 272 string(REPLACE ".S" ".c" _cname "${_name}") 273 list(REMOVE_ITEM ${arch}_SOURCES ${_cname}) 274 endif () 275 endforeach () 276 277 set_source_files_properties(${${arch}_SOURCES} PROPERTIES LANGUAGE C) 278 add_compiler_rt_runtime(clang_rt.builtins-${arch} ${arch} STATIC 279 SOURCES ${${arch}_SOURCES} 280 CFLAGS "-std=c99") 281 add_dependencies(builtins clang_rt.builtins-${arch}) 282 endif () 283 endforeach () 284endif () 285 286add_dependencies(compiler-rt builtins) 287