diff --git a/llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn b/llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn --- a/llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn +++ b/llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn @@ -6,6 +6,54 @@ compiler_rt_exclude_atomic_builtin = true } +lse_targets = [] + +if (current_cpu == "arm64") { + foreach(pat, + [ + "cas", + "swp", + "ldadd", + "ldclr", + "ldeor", + "ldset", + ]) { + foreach(size, + [ + "1", + "2", + "4", + "8", + "16", + ]) { + foreach(model, + [ + "1", + "2", + "3", + "4", + ]) { + if (pat == "cas" || size != "16") { + source_set("lse_${pat}_${size}_${model}") { + # Assign to sources like this to hide from + # sync_source_lists_from_cmake.py which won't find the source file + # on the CMake side. + lse_file = "aarch64/lse.S" + sources = [ lse_file ] + include_dirs = [ "." ] + defines = [ + "L_$pat", + "SIZE=$size", + "MODEL=$model", + ] + } + lse_targets += [ ":lse_${pat}_${size}_${model}" ] + } + } + } + } +} + static_library("builtins") { output_dir = crt_current_out_dir if (current_os == "mac") { @@ -518,6 +566,8 @@ if (!compiler_rt_exclude_atomic_builtin) { sources += [ "atomic.c" ] } + + deps = lse_targets } # Currently unused but necessary to make sync_source_lists_from_cmake.py happy.