1 import("//compiler-rt/target.gni")
2 import("//llvm/utils/gn/build/buildflags.gni")
5 # Skip the atomic builtin (should normally be provided by a shared library).
6 compiler_rt_exclude_atomic_builtin = true
8 # Compile builtins for baremetal.
9 compiler_rt_baremetal_build = false
12 static_library("builtins") {
13 output_dir = crt_current_out_dir
14 if (current_os == "mac") {
15 output_name = "clang_rt.osx"
17 output_name = "clang_rt.builtins$crt_current_target_suffix"
20 complete_static_lib = true
21 configs -= [ "//llvm/utils/gn/build:thin_archive" ]
27 if (target_os != "android") {
28 cflags += [ "-fvisibility=hidden" ]
31 cflags += [ "-fomit-frame-pointer" ]
33 cflags_c = [ "-std=c11" ]
129 "os_version_check.c",
145 "trampoline_setup.c",
161 # This depends on unwind.h which is present in Clang headers. We should
162 # reconsider this if we ever decide to support building builtins with
164 "gcc_personality_v0.c",
167 if (target_os != "fuchsia") {
170 "enable_execute_stack.c",
175 if (target_os != "fuchsia" && !compiler_rt_baremetal_build) {
177 # This comment prevents `gn format` from putting the file on the same line
178 # as `sources +=`, for sync_source_lists_from_cmake.py.
183 if (target_os == "mac") {
185 "atomic_flag_clear.c",
186 "atomic_flag_clear_explicit.c",
187 "atomic_flag_test_and_set.c",
188 "atomic_flag_test_and_set_explicit.c",
189 "atomic_signal_fence.c",
190 "atomic_thread_fence.c",
194 if ((target_cpu == "x64" && target_os != "win") || target_cpu == "arm64") {
218 if (target_cpu == "x86" || target_cpu == "x64") {
235 if (target_cpu == "x86") {
259 "i386/floatundidf.S",
260 "i386/floatundisf.S",
261 "i386/floatundixf.S",
268 if (target_os == "win") {
274 } else if (target_cpu == "x64") {
284 "x86_64/floatdidf.c",
285 "x86_64/floatdisf.c",
286 "x86_64/floatdixf.c",
287 "x86_64/floatundidf.S",
288 "x86_64/floatundisf.S",
289 "x86_64/floatundixf.S",
291 if (target_os == "win") {
299 if (target_cpu == "arm") {
300 if (target_os != "mingw") {
324 "arm/sync_fetch_and_add_4.S",
325 "arm/sync_fetch_and_add_8.S",
326 "arm/sync_fetch_and_and_4.S",
327 "arm/sync_fetch_and_and_8.S",
328 "arm/sync_fetch_and_max_4.S",
329 "arm/sync_fetch_and_max_8.S",
330 "arm/sync_fetch_and_min_4.S",
331 "arm/sync_fetch_and_min_8.S",
332 "arm/sync_fetch_and_nand_4.S",
333 "arm/sync_fetch_and_nand_8.S",
334 "arm/sync_fetch_and_or_4.S",
335 "arm/sync_fetch_and_or_8.S",
336 "arm/sync_fetch_and_sub_4.S",
337 "arm/sync_fetch_and_sub_8.S",
338 "arm/sync_fetch_and_umax_4.S",
339 "arm/sync_fetch_and_umax_8.S",
340 "arm/sync_fetch_and_umin_4.S",
341 "arm/sync_fetch_and_umin_8.S",
342 "arm/sync_fetch_and_xor_4.S",
343 "arm/sync_fetch_and_xor_8.S",
350 "arm/aeabi_idivmod.S",
351 "arm/aeabi_ldivmod.S",
352 "arm/aeabi_uidivmod.S",
353 "arm/aeabi_uldivmod.S",
360 if (target_cpu == "arm64") {
362 # This comment prevents `gn format` from putting the file on the same line
363 # as `sources +=`, for sync_source_lists_from_cmake.py.
366 if (target_os == "mingw") {
368 # This comment prevents `gn format` from putting the file on the same
369 # line as `sources +=`, for sync_source_lists_from_cmake.py.
375 if (target_cpu == "hexagon") {
377 "hexagon/common_entry_exit_abi1.S",
378 "hexagon/common_entry_exit_abi2.S",
379 "hexagon/common_entry_exit_legacy.S",
380 "hexagon/dfaddsub.S",
383 "hexagon/dfminmax.S",
388 "hexagon/fabs_opt.S",
389 "hexagon/fastmath2_dlib_asm.S",
390 "hexagon/fastmath2_ldlib_asm.S",
391 "hexagon/fastmath_dlib_asm.S",
393 "hexagon/fmax_opt.S",
394 "hexagon/fmin_opt.S",
395 "hexagon/memcpy_forward_vp4cp4n2.S",
396 "hexagon/memcpy_likely_aligned.S",
399 "hexagon/sfdiv_opt.S",
400 "hexagon/sfsqrt_opt.S",
402 "hexagon/udivmoddi4.S",
403 "hexagon/udivmodsi4.S",
410 if (target_cpu == "ppc64") {
427 if (target_cpu == "riscv") {
429 # This comment prevents `gn format` from putting the file on the same line
430 # as `sources +=`, for sync_source_lists_from_cmake.py.
435 if (!compiler_rt_exclude_atomic_builtin) {
437 # This comment prevents `gn format` from putting the file on the same line
438 # as `sources +=`, for sync_source_lists_from_cmake.py.
444 # Currently unused but necessary to make the sync_source_lists_from_cmake.py
446 source_set("_unused") {
456 "arm/aeabi_cdcmpeq_check_nan.c",
458 "arm/aeabi_cfcmpeq_check_nan.c",
464 "arm/aeabi_idivmod.S",
465 "arm/aeabi_ldivmod.S",
466 "arm/aeabi_memcmp.S",
467 "arm/aeabi_memcpy.S",
468 "arm/aeabi_memmove.S",
469 "arm/aeabi_memset.S",
470 "arm/aeabi_uidivmod.S",
471 "arm/aeabi_uldivmod.S",
480 "arm/restore_vfp_d8_d15_regs.S",
481 "arm/save_vfp_d8_d15_regs.S",
490 "arm/extendsfdf2vfp.S",
493 "arm/fixunsdfsivfp.S",
494 "arm/fixunssfsivfp.S",
495 "arm/floatsidfvfp.S",
496 "arm/floatsisfvfp.S",
497 "arm/floatunssidfvfp.S",
498 "arm/floatunssisfvfp.S",
515 "arm/truncdfsf2vfp.S",
520 "arm/sync_synchronize.S",