[llvm] r357850 - [gn] Support for per-target runtime directory layout
Petr Hosek via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 6 16:05:56 PDT 2019
Author: phosek
Date: Sat Apr 6 16:05:56 2019
New Revision: 357850
URL: http://llvm.org/viewvc/llvm-project?rev=357850&view=rev
Log:
[gn] Support for per-target runtime directory layout
This change also introduces the clang_enable_per_target_runtime_dir
to enable the use of per-target runtime directory layout which is the
equivalent of LLVM_ENABLE_PER_TARGET_RUNTIME_DIR CMake option.
Differential Revision: https://reviews.llvm.org/D60332
Added:
llvm/trunk/utils/gn/secondary/clang/runtimes.gni
Modified:
llvm/trunk/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
llvm/trunk/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn
llvm/trunk/utils/gn/secondary/compiler-rt/target.gni
llvm/trunk/utils/gn/secondary/compiler-rt/test/hwasan/BUILD.gn
Added: llvm/trunk/utils/gn/secondary/clang/runtimes.gni
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/secondary/clang/runtimes.gni?rev=357850&view=auto
==============================================================================
--- llvm/trunk/utils/gn/secondary/clang/runtimes.gni (added)
+++ llvm/trunk/utils/gn/secondary/clang/runtimes.gni Sat Apr 6 16:05:56 2019
@@ -0,0 +1,13 @@
+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"
+}
Modified: llvm/trunk/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn?rev=357850&r1=357849&r2=357850&view=diff
==============================================================================
--- llvm/trunk/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn (original)
+++ llvm/trunk/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn Sat Apr 6 16:05:56 2019
@@ -11,7 +11,7 @@ declare_args() {
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",
Modified: llvm/trunk/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn?rev=357850&r1=357849&r2=357850&view=diff
==============================================================================
--- llvm/trunk/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn (original)
+++ llvm/trunk/utils/gn/secondary/compiler-rt/lib/hwasan/BUILD.gn Sat Apr 6 16:05:56 2019
@@ -16,10 +16,10 @@ action("version_script") {
"--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),
@@ -75,7 +75,7 @@ source_set("cxx_sources") {
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",
@@ -89,7 +89,7 @@ static_library("hwasan") {
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",
@@ -103,7 +103,7 @@ static_library("hwasan_cxx") {
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 = [
Modified: llvm/trunk/utils/gn/secondary/compiler-rt/target.gni
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/secondary/compiler-rt/target.gni?rev=357850&r1=357849&r2=357850&view=diff
==============================================================================
--- llvm/trunk/utils/gn/secondary/compiler-rt/target.gni (original)
+++ llvm/trunk/utils/gn/secondary/compiler-rt/target.gni Sat Apr 6 16:05:56 2019
@@ -1,10 +1,5 @@
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"
@@ -16,7 +11,17 @@ if (current_cpu == "x86") {
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)
}
Modified: llvm/trunk/utils/gn/secondary/compiler-rt/test/hwasan/BUILD.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/secondary/compiler-rt/test/hwasan/BUILD.gn?rev=357850&r1=357849&r2=357850&view=diff
==============================================================================
--- llvm/trunk/utils/gn/secondary/compiler-rt/test/hwasan/BUILD.gn (original)
+++ llvm/trunk/utils/gn/secondary/compiler-rt/test/hwasan/BUILD.gn Sat Apr 6 16:05:56 2019
@@ -11,7 +11,7 @@ write_cmake_config("lit_site_cfg") {
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",
@@ -21,7 +21,7 @@ write_cmake_config("lit_site_cfg") {
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=[]" ]
More information about the llvm-commits
mailing list