--- /dev/null
+import("//clang/resource_dir.gni")
+import("//llvm/triples.gni")
+
+declare_args() {
+ # Use target triple as the name of the runtimes directory.
+ clang_enable_per_target_runtime_dir = false
+}
+
+if (clang_enable_per_target_runtime_dir) {
+ runtimes_dir = "$clang_resource_dir/$llvm_target_triple/lib"
+} else {
+ runtimes_dir = "$root_build_dir/lib"
+}
static_library("builtins") {
output_dir = crt_current_out_dir
- output_name = "clang_rt.builtins-$crt_current_target"
+ output_name = "clang_rt.builtins$crt_current_target_suffix"
complete_static_lib = true
cflags = [
"-fPIC",
"--version-list",
"--extra",
rebase_path(sources[0], root_build_dir),
- rebase_path("$crt_current_out_dir/libclang_rt.hwasan-$crt_current_target.a",
+ rebase_path("$crt_current_out_dir/libclang_rt.hwasan$crt_current_target_suffix.a",
root_build_dir),
rebase_path(
- "$crt_current_out_dir/libclang_rt.hwasan_cxx-$crt_current_target.a",
+ "$crt_current_out_dir/libclang_rt.hwasan_cxx$crt_current_target_suffix.a",
root_build_dir),
"-o",
rebase_path(outputs[0], root_build_dir),
static_library("hwasan") {
output_dir = crt_current_out_dir
- output_name = "clang_rt.hwasan-$crt_current_target"
+ output_name = "clang_rt.hwasan$crt_current_target_suffix"
complete_static_lib = true
configs -= [
"//llvm/utils/gn/build:llvm_code",
static_library("hwasan_cxx") {
output_dir = crt_current_out_dir
- output_name = "clang_rt.hwasan_cxx-$crt_current_target"
+ output_name = "clang_rt.hwasan_cxx$crt_current_target_suffix"
complete_static_lib = true
configs -= [
"//llvm/utils/gn/build:llvm_code",
shared_library("hwasan_shared") {
output_dir = crt_current_out_dir
- output_name = "clang_rt.hwasan-$crt_current_target"
+ output_name = "clang_rt.hwasan$crt_current_target_suffix"
configs -= [ "//llvm/utils/gn/build:llvm_code" ]
configs += [ "//llvm/utils/gn/build:crt_code" ]
deps = [
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)
-}
+import("//clang/runtimes.gni")
if (current_cpu == "x86") {
crt_current_target_arch = "i386"
assert(false, "unimplemented current_cpu " + current_cpu)
}
-crt_current_target = crt_current_target_arch
-if (current_os == "android") {
- crt_current_target += "-android"
+if (clang_enable_per_target_runtime_dir) {
+ crt_current_out_dir = runtimes_dir
+
+ crt_current_target_suffix = ""
+} else if (current_os == "linux" || current_os == "android") {
+ crt_current_out_dir = "$clang_resource_dir/lib/linux"
+
+ crt_current_target_suffix = "-$crt_current_target_arch"
+ if (current_os == "android") {
+ crt_current_target_suffix += "-android"
+ }
+} else {
+ assert(false, "unimplemented current_os " + current_os)
}
values = [
"LIT_SITE_CFG_IN_HEADER=## Autogenerated from $input, do not edit",
- "HWASAN_TEST_CONFIG_SUFFIX=-$crt_current_target",
+ "HWASAN_TEST_CONFIG_SUFFIX=$crt_current_target_suffix",
"HWASAN_TEST_TARGET_CFLAGS=$target_flags_string",
"HWASAN_TEST_TARGET_ARCH=$crt_current_target_arch",
if (current_os == "android") {
values += [ "HWASAN_ANDROID_FILES_TO_PUSH=[\"" + rebase_path(
- "$crt_current_out_dir/libclang_rt.hwasan-$crt_current_target.so") + "\", \"" + rebase_path(
+ "$crt_current_out_dir/libclang_rt.hwasan$crt_current_target_suffix.so") + "\", \"" + rebase_path(
"$root_out_dir/bin/llvm-symbolizer") + "\"]" ]
} else {
values += [ "HWASAN_ANDROID_FILES_TO_PUSH=[]" ]