1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

gn build: Add support for cross-compiling the builtins and profile runtimes for Android aarch64 and arm.

Differential Revision: https://reviews.llvm.org/D69681
This commit is contained in:
Peter Collingbourne 2019-10-31 15:15:54 -07:00
parent 5e640f3b2f
commit 71aebd8c16
6 changed files with 99 additions and 74 deletions

View File

@ -207,6 +207,15 @@ if (android_ndk_path != "") {
use_lld = true
}
}
stage2_unix_toolchain("stage2_android_arm") {
toolchain_args = {
current_os = "android"
current_cpu = "arm"
is_clang = true
use_lld = true
}
}
}
toolchain("win") {

View File

@ -11,6 +11,9 @@ if (current_os == "android") {
"-B$android_ndk_path/toolchains/llvm/prebuilt/linux-x86_64",
]
target_ldflags += [ "-static-libstdc++" ]
if (current_cpu == "arm") {
target_flags += [ "-march=armv7-a" ]
}
}
if (current_cpu == "x86") {

View File

@ -1,8 +1,19 @@
group("compiler-rt") {
# In the GN build, compiler-rt is always built by just-built clang and lld.
# FIXME: For macOS and iOS builds, depend on lib in all needed target arch
# toolchains and then lipo them together for the final output.
deps = [
"//compiler-rt/lib(//llvm/utils/gn/build/toolchain:stage2_unix)",
import("//llvm/utils/gn/build/toolchain/compiler.gni")
# In the GN build, compiler-rt is always built by just-built clang and lld.
# FIXME: For macOS and iOS builds, depend on lib in all needed target arch
# toolchains and then lipo them together for the final output.
supported_toolchains = [ "//llvm/utils/gn/build/toolchain:stage2_unix" ]
if (android_ndk_path != "") {
supported_toolchains += [
"//llvm/utils/gn/build/toolchain:stage2_android_aarch64",
"//llvm/utils/gn/build/toolchain:stage2_android_arm",
]
}
group("compiler-rt") {
deps = []
foreach(toolchain, supported_toolchains) {
deps += [ "//compiler-rt/lib($toolchain)" ]
}
}

View File

@ -306,12 +306,30 @@ static_library("builtins") {
"comparesf2.c",
"divmodsi4.c",
"divsi3.c",
"fp_mode.c",
"modsi3.c",
"udivmodsi4.c",
"udivsi3.c",
"umodsi3.c",
]
sources += [
"arm/aeabi_cdcmp.S",
"arm/aeabi_cdcmpeq_check_nan.c",
"arm/aeabi_cfcmp.S",
"arm/aeabi_cfcmpeq_check_nan.c",
"arm/aeabi_dcmp.S",
"arm/aeabi_div0.c",
"arm/aeabi_drsub.c",
"arm/aeabi_fcmp.S",
"arm/aeabi_frsub.c",
"arm/aeabi_idivmod.S",
"arm/aeabi_ldivmod.S",
"arm/aeabi_memcmp.S",
"arm/aeabi_memcpy.S",
"arm/aeabi_memmove.S",
"arm/aeabi_memset.S",
"arm/aeabi_uidivmod.S",
"arm/aeabi_uldivmod.S",
"arm/bswapdi2.S",
"arm/bswapsi2.S",
"arm/clzdi2.S",
@ -321,6 +339,10 @@ static_library("builtins") {
"arm/divsi3.S",
"arm/fp_mode.c",
"arm/modsi3.S",
"arm/switch16.S",
"arm/switch32.S",
"arm/switch8.S",
"arm/switchu8.S",
"arm/sync_fetch_and_add_4.S",
"arm/sync_fetch_and_add_8.S",
"arm/sync_fetch_and_and_4.S",
@ -341,10 +363,52 @@ static_library("builtins") {
"arm/sync_fetch_and_umin_8.S",
"arm/sync_fetch_and_xor_4.S",
"arm/sync_fetch_and_xor_8.S",
"arm/sync_synchronize.S",
"arm/udivmodsi4.S",
"arm/udivsi3.S",
"arm/umodsi3.S",
]
if (current_os == "android") {
sources += [
"arm/adddf3vfp.S",
"arm/addsf3vfp.S",
"arm/divdf3vfp.S",
"arm/divsf3vfp.S",
"arm/eqdf2vfp.S",
"arm/eqsf2vfp.S",
"arm/extendsfdf2vfp.S",
"arm/fixdfsivfp.S",
"arm/fixsfsivfp.S",
"arm/fixunsdfsivfp.S",
"arm/fixunssfsivfp.S",
"arm/floatsidfvfp.S",
"arm/floatsisfvfp.S",
"arm/floatunssidfvfp.S",
"arm/floatunssisfvfp.S",
"arm/gedf2vfp.S",
"arm/gesf2vfp.S",
"arm/gtdf2vfp.S",
"arm/gtsf2vfp.S",
"arm/ledf2vfp.S",
"arm/lesf2vfp.S",
"arm/ltdf2vfp.S",
"arm/ltsf2vfp.S",
"arm/muldf3vfp.S",
"arm/mulsf3vfp.S",
"arm/nedf2vfp.S",
"arm/negdf2vfp.S",
"arm/negsf2vfp.S",
"arm/nesf2vfp.S",
"arm/restore_vfp_d8_d15_regs.S",
"arm/save_vfp_d8_d15_regs.S",
"arm/subdf3vfp.S",
"arm/subsf3vfp.S",
"arm/truncdfsf2vfp.S",
"arm/unorddf2vfp.S",
"arm/unordsf2vfp.S",
]
}
} else {
sources += [
"arm/aeabi_idivmod.S",
@ -450,73 +514,5 @@ source_set("_unused") {
"arm/comparesf2.S",
"arm/divsi3.S",
"arm/udivsi3.S",
# EABI
"arm/aeabi_cdcmp.S",
"arm/aeabi_cdcmpeq_check_nan.c",
"arm/aeabi_cfcmp.S",
"arm/aeabi_cfcmpeq_check_nan.c",
"arm/aeabi_dcmp.S",
"arm/aeabi_div0.c",
"arm/aeabi_drsub.c",
"arm/aeabi_fcmp.S",
"arm/aeabi_frsub.c",
"arm/aeabi_idivmod.S",
"arm/aeabi_ldivmod.S",
"arm/aeabi_memcmp.S",
"arm/aeabi_memcpy.S",
"arm/aeabi_memmove.S",
"arm/aeabi_memset.S",
"arm/aeabi_uidivmod.S",
"arm/aeabi_uldivmod.S",
# Thumb1 JT
"arm/switch16.S",
"arm/switch32.S",
"arm/switch8.S",
"arm/switchu8.S",
# Thumb1 SjLj
"arm/restore_vfp_d8_d15_regs.S",
"arm/save_vfp_d8_d15_regs.S",
# Thumb1 VFPv2
"arm/adddf3vfp.S",
"arm/addsf3vfp.S",
"arm/divdf3vfp.S",
"arm/divsf3vfp.S",
"arm/eqdf2vfp.S",
"arm/eqsf2vfp.S",
"arm/extendsfdf2vfp.S",
"arm/fixdfsivfp.S",
"arm/fixsfsivfp.S",
"arm/fixunsdfsivfp.S",
"arm/fixunssfsivfp.S",
"arm/floatsidfvfp.S",
"arm/floatsisfvfp.S",
"arm/floatunssidfvfp.S",
"arm/floatunssisfvfp.S",
"arm/gedf2vfp.S",
"arm/gesf2vfp.S",
"arm/gtdf2vfp.S",
"arm/gtsf2vfp.S",
"arm/ledf2vfp.S",
"arm/lesf2vfp.S",
"arm/ltdf2vfp.S",
"arm/ltsf2vfp.S",
"arm/muldf3vfp.S",
"arm/mulsf3vfp.S",
"arm/nedf2vfp.S",
"arm/negdf2vfp.S",
"arm/negsf2vfp.S",
"arm/nesf2vfp.S",
"arm/subdf3vfp.S",
"arm/subsf3vfp.S",
"arm/truncdfsf2vfp.S",
"arm/unorddf2vfp.S",
"arm/unordsf2vfp.S",
# Thumb1 icache
"arm/sync_synchronize.S",
]
}

View File

@ -5,6 +5,8 @@ if (current_cpu == "x86") {
crt_current_target_arch = "i386"
} else if (current_cpu == "x64") {
crt_current_target_arch = "x86_64"
} else if (current_cpu == "arm") {
crt_current_target_arch = "arm"
} else if (current_cpu == "arm64") {
crt_current_target_arch = "aarch64"
} else if (current_cpu == "ppc64") {

View File

@ -12,6 +12,10 @@ if (current_cpu == "x86") {
} else if (current_os == "win") {
llvm_current_triple = "x86_64-pc-windows-msvc"
}
} else if (current_cpu == "arm") {
if (current_os == "android") {
llvm_current_triple = "arm-linux-androideabi"
}
} else if (current_cpu == "arm64") {
if (current_os == "android") {
llvm_current_triple = "aarch64-linux-android21"