| 1 |
import("//compiler-rt/lib/builtins/sources.gni") |
| 2 |
import("//compiler-rt/target.gni") |
| 3 |
import("//llvm/utils/gn/build/buildflags.gni") |
| 4 |
|
| 5 |
lse_targets = [] |
| 6 |
|
| 7 |
if (current_cpu == "arm64") { |
| 8 |
foreach(pat, |
| 9 |
[ |
| 10 |
"cas", |
| 11 |
"swp", |
| 12 |
"ldadd", |
| 13 |
"ldclr", |
| 14 |
"ldeor", |
| 15 |
"ldset", |
| 16 |
]) { |
| 17 |
foreach(size, |
| 18 |
[ |
| 19 |
"1", |
| 20 |
"2", |
| 21 |
"4", |
| 22 |
"8", |
| 23 |
"16", |
| 24 |
]) { |
| 25 |
foreach(model, |
| 26 |
[ |
| 27 |
"1", |
| 28 |
"2", |
| 29 |
"3", |
| 30 |
"4", |
| 31 |
]) { |
| 32 |
if (pat == "cas" || size != "16") { |
| 33 |
source_set("lse_${pat}_${size}_${model}") { |
| 34 |
# Assign to sources like this to hide from |
| 35 |
# sync_source_lists_from_cmake.py which won't find the source file |
| 36 |
# on the CMake side. |
| 37 |
lse_file = "aarch64/lse.S" |
| 38 |
sources = [ lse_file ] |
| 39 |
include_dirs = [ "." ] |
| 40 |
defines = [ |
| 41 |
"L_$pat", |
| 42 |
"SIZE=$size", |
| 43 |
"MODEL=$model", |
| 44 |
] |
| 45 |
} |
| 46 |
lse_targets += [ ":lse_${pat}_${size}_${model}" ] |
| 47 |
} |
| 48 |
} |
| 49 |
} |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
static_library("builtins") { |
| 54 |
output_dir = crt_current_out_dir |
| 55 |
if (current_os == "mac") { |
| 56 |
output_name = "clang_rt.osx" |
| 57 |
} else if (current_os == "ios" && current_cpu == "arm64") { |
| 58 |
output_name = "clang_rt.ios" |
| 59 |
} else if (current_os == "ios" && current_cpu == "x64") { |
| 60 |
output_name = "clang_rt.iossim" |
| 61 |
} else { |
| 62 |
output_name = "clang_rt.builtins$crt_current_target_suffix" |
| 63 |
} |
| 64 |
|
| 65 |
complete_static_lib = true |
| 66 |
configs -= [ "//llvm/utils/gn/build:thin_archive" ] |
| 67 |
|
| 68 |
cflags = [] |
| 69 |
if (current_os != "win") { |
| 70 |
cflags = [ |
| 71 |
"-fPIC", |
| 72 |
"-fno-builtin", |
| 73 |
] |
| 74 |
if (current_os != "android") { |
| 75 |
cflags += [ "-fvisibility=hidden" ] |
| 76 |
} |
| 77 |
if (!is_debug) { |
| 78 |
cflags += [ "-fomit-frame-pointer" ] |
| 79 |
} |
| 80 |
cflags_c = [ "-std=c11" ] |
| 81 |
cflags_cc = [ "-nostdinc++" ] |
| 82 |
} |
| 83 |
|
| 84 |
defines = builtins_defines |
| 85 |
sources = builtins_sources |
| 86 |
|
| 87 |
deps = lse_targets |
| 88 |
include_dirs = [ "//third-party/siphash/include" ] |
| 89 |
} |
| 90 |
|
| 91 |
# Currently unused but necessary to make sync_source_lists_from_cmake.py happy. |
| 92 |
source_set("_unused") { |
| 93 |
sources = [ |
| 94 |
# Thumb1 |
| 95 |
"arm/addsf3.S", |
| 96 |
"arm/comparesf2.S", |
| 97 |
"arm/divsi3.S", |
| 98 |
"arm/udivsi3.S", |
| 99 |
] |
| 100 |
} |