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 if (current_cpu != "arm") { 19 target_flags += [ "-rtlib=libgcc" ] 20 } 21 target_ldflags += [ "-static-libstdc++" ] 22 if (current_cpu == "arm") { 23 target_flags += [ "-march=armv7-a" ] 24 } 25} else if (current_os == "ios") { 26 if (current_cpu == "arm64") { 27 target_flags += [ 28 "-arch", 29 "arm64", 30 ] 31 target_ldflags += [ 32 "-arch", 33 "arm64", 34 ] 35 } else if (current_cpu == "x64") { 36 target_flags += [ 37 "-arch", 38 "x86_64", 39 ] 40 target_ldflags += [ 41 "-arch", 42 "x86_64", 43 ] 44 } 45} 46 47if (current_cpu == "x86") { 48 target_flags = [ "-m32" ] 49} 50