1import("//llvm/triples.gni")
2import("//llvm/utils/gn/build/toolchain/compiler.gni")
3
4# Flags in this file are passed both to the compiler that's building
5# compiler-rt at build time (via normal gn cflags/ldflags), as well as to the
6# compiler building compiler-rt test programs at test time (via
7# COMPILER_RT_TEST_COMPILER_CFLAGS).
8
9target_flags = []
10target_ldflags = []
11
12if (current_os == "android") {
13  target_flags += [
14    "--target=$llvm_current_triple",
15    "--sysroot=$android_ndk_path/toolchains/llvm/prebuilt/linux-x86_64/sysroot",
16    "--gcc-toolchain=$android_ndk_path/toolchains/llvm/prebuilt/linux-x86_64",
17  ]
18  target_ldflags += [ "-static-libstdc++" ]
19  if (current_cpu == "arm") {
20    target_flags += [ "-march=armv7-a" ]
21  }
22} else if (current_os == "ios") {
23  if (current_cpu == "arm64") {
24    target_flags += [
25      "-arch",
26      "arm64",
27    ]
28    target_ldflags += [
29      "-arch",
30      "arm64",
31    ]
32  } else if (current_cpu == "x64") {
33    target_flags += [
34      "-arch",
35      "x86_64",
36    ]
37    target_ldflags += [
38      "-arch",
39      "x86_64",
40    ]
41  }
42} else if (current_os == "baremetal") {
43  target_flags += [ "--target=$llvm_current_triple" ]
44}
45
46if (current_cpu == "x86") {
47  target_flags = [ "-m32" ]
48}
49