mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
gn build: Add a stage2 host toolchain and make the hwasan runtime buildable on x86_64 Linux.
Differential Revision: https://reviews.llvm.org/D56711 llvm-svn: 351258
This commit is contained in:
parent
6a91773c9e
commit
c6dd831c47
@ -150,8 +150,10 @@ unix_toolchain("unix") {
|
||||
}
|
||||
}
|
||||
|
||||
if (android_ndk_path != "") {
|
||||
unix_toolchain("stage2_android_aarch64") {
|
||||
template("stage2_unix_toolchain") {
|
||||
unix_toolchain(target_name) {
|
||||
forward_variables_from(invoker, "*")
|
||||
|
||||
cc = "bin/clang"
|
||||
cxx = "bin/clang++"
|
||||
ld = cxx
|
||||
@ -162,7 +164,19 @@ if (android_ndk_path != "") {
|
||||
"//:lld($host_toolchain)",
|
||||
"//:llvm-ar($host_toolchain)",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
stage2_unix_toolchain("stage2_unix") {
|
||||
toolchain_args = {
|
||||
current_os = host_os
|
||||
current_cpu = host_cpu
|
||||
use_lld = host_os != "mac"
|
||||
}
|
||||
}
|
||||
|
||||
if (android_ndk_path != "") {
|
||||
stage2_unix_toolchain("stage2_android_aarch64") {
|
||||
toolchain_args = {
|
||||
current_os = "android"
|
||||
current_cpu = "arm64"
|
||||
|
@ -9,9 +9,9 @@ group("default") {
|
||||
"//llvm/test",
|
||||
]
|
||||
|
||||
# FIXME: This should be a dependency of a test target instead of being
|
||||
# depended on from here.
|
||||
if (android_ndk_path != "") {
|
||||
# FIXME: This should be a dependency of a test target instead of being
|
||||
# depended on from here.
|
||||
android_aarch64_toolchain =
|
||||
"//llvm/utils/gn/build/toolchain:stage2_android_aarch64"
|
||||
deps += [
|
||||
@ -19,6 +19,9 @@ group("default") {
|
||||
"//llvm/tools/llvm-symbolizer($android_aarch64_toolchain)",
|
||||
]
|
||||
}
|
||||
if (host_cpu == "x64" && host_os == "linux") {
|
||||
deps += [ "//compiler-rt/lib/hwasan:hwasan_shared(//llvm/utils/gn/build/toolchain:stage2_unix)" ]
|
||||
}
|
||||
|
||||
testonly = true
|
||||
}
|
||||
|
@ -1,10 +1,4 @@
|
||||
import("//clang/resource_dir.gni")
|
||||
|
||||
# FIXME: Make this support more platforms.
|
||||
assert(current_os == "android")
|
||||
|
||||
runtime_output_dir = "$clang_resource_dir/lib/linux"
|
||||
runtime_target = "aarch64-android"
|
||||
import("//compiler-rt/target.gni")
|
||||
|
||||
action("version_script") {
|
||||
script = "//compiler-rt/lib/sanitizer_common/scripts/gen_dynamic_list.py"
|
||||
@ -22,10 +16,11 @@ action("version_script") {
|
||||
"--version-list",
|
||||
"--extra",
|
||||
rebase_path(sources[0], root_build_dir),
|
||||
rebase_path("$runtime_output_dir/libclang_rt.hwasan-$runtime_target.a",
|
||||
root_build_dir),
|
||||
rebase_path("$runtime_output_dir/libclang_rt.hwasan_cxx-$runtime_target.a",
|
||||
rebase_path("$crt_current_out_dir/libclang_rt.hwasan-$crt_current_target.a",
|
||||
root_build_dir),
|
||||
rebase_path(
|
||||
"$crt_current_out_dir/libclang_rt.hwasan_cxx-$crt_current_target.a",
|
||||
root_build_dir),
|
||||
"-o",
|
||||
rebase_path(outputs[0], root_build_dir),
|
||||
]
|
||||
@ -66,8 +61,8 @@ source_set("cxx_sources") {
|
||||
}
|
||||
|
||||
static_library("hwasan") {
|
||||
output_dir = runtime_output_dir
|
||||
output_name = "clang_rt.hwasan-$runtime_target"
|
||||
output_dir = crt_current_out_dir
|
||||
output_name = "clang_rt.hwasan-$crt_current_target"
|
||||
complete_static_lib = true
|
||||
configs -= [ "//llvm/utils/gn/build:llvm_code" ]
|
||||
configs += [ "//llvm/utils/gn/build:crt_code" ]
|
||||
@ -77,8 +72,8 @@ static_library("hwasan") {
|
||||
}
|
||||
|
||||
static_library("hwasan_cxx") {
|
||||
output_dir = runtime_output_dir
|
||||
output_name = "clang_rt.hwasan_cxx-$runtime_target"
|
||||
output_dir = crt_current_out_dir
|
||||
output_name = "clang_rt.hwasan_cxx-$crt_current_target"
|
||||
complete_static_lib = true
|
||||
configs -= [ "//llvm/utils/gn/build:llvm_code" ]
|
||||
configs += [ "//llvm/utils/gn/build:crt_code" ]
|
||||
@ -88,8 +83,8 @@ static_library("hwasan_cxx") {
|
||||
}
|
||||
|
||||
shared_library("hwasan_shared") {
|
||||
output_dir = runtime_output_dir
|
||||
output_name = "clang_rt.hwasan-$runtime_target"
|
||||
output_dir = crt_current_out_dir
|
||||
output_name = "clang_rt.hwasan-$crt_current_target"
|
||||
configs -= [ "//llvm/utils/gn/build:llvm_code" ]
|
||||
configs += [ "//llvm/utils/gn/build:crt_code" ]
|
||||
deps = [
|
||||
|
@ -1,6 +1,16 @@
|
||||
source_set("sources") {
|
||||
configs -= [ "//llvm/utils/gn/build:llvm_code" ]
|
||||
configs += [ "//llvm/utils/gn/build:crt_code" ]
|
||||
deps = [
|
||||
"//llvm/utils/gn/build/libs/pthread",
|
||||
]
|
||||
libs = []
|
||||
if (current_os == "linux" || current_os == "android") {
|
||||
libs += [ "dl" ]
|
||||
}
|
||||
if (current_os == "linux") {
|
||||
libs += [ "rt" ]
|
||||
}
|
||||
sources = [
|
||||
"sancov_flags.cc",
|
||||
"sanitizer_allocator.cc",
|
||||
@ -67,4 +77,7 @@ source_set("sources") {
|
||||
"sanitizer_unwind_win.cc",
|
||||
"sanitizer_win.cc",
|
||||
]
|
||||
if (current_cpu == "x64") {
|
||||
sources += [ "sanitizer_linux_x86_64.S" ]
|
||||
}
|
||||
}
|
||||
|
20
utils/gn/secondary/compiler-rt/target.gni
Normal file
20
utils/gn/secondary/compiler-rt/target.gni
Normal file
@ -0,0 +1,20 @@
|
||||
import("//clang/resource_dir.gni")
|
||||
|
||||
if (current_os == "linux" || current_os == "android") {
|
||||
crt_current_out_dir = "$clang_resource_dir/lib/linux"
|
||||
} else {
|
||||
assert(false, "unimplemented current_os " + current_os)
|
||||
}
|
||||
|
||||
if (current_cpu == "x64") {
|
||||
crt_current_target_arch = "x86_64"
|
||||
} else if (current_cpu == "arm64") {
|
||||
crt_current_target_arch = "aarch64"
|
||||
} else {
|
||||
assert(false, "unimplemented current_cpu " + current_cpu)
|
||||
}
|
||||
|
||||
crt_current_target = crt_current_target_arch
|
||||
if (current_os == "android") {
|
||||
crt_current_target += "-android"
|
||||
}
|
Loading…
Reference in New Issue
Block a user