[llvm] 7a035de - Revert "[gn build] Support linux/win compiler-rt cross compilation"
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 17 09:57:16 PST 2023
Author: Arthur Eubanks
Date: 2023-02-17T09:56:51-08:00
New Revision: 7a035de2d6c440f677cb0e03ad25011f56cd08b5
URL: https://github.com/llvm/llvm-project/commit/7a035de2d6c440f677cb0e03ad25011f56cd08b5
DIFF: https://github.com/llvm/llvm-project/commit/7a035de2d6c440f677cb0e03ad25011f56cd08b5.diff
LOG: Revert "[gn build] Support linux/win compiler-rt cross compilation"
This reverts commit d73eb92cc673acf532b396537d78fe041dc9a9c2.
Breaks win/mac, e.g. http://45.33.8.238/win/75236/step_4.txt
Added:
Modified:
llvm/utils/gn/build/toolchain/BUILD.gn
llvm/utils/gn/build/toolchain/compiler.gni
llvm/utils/gn/secondary/compiler-rt/BUILD.gn
llvm/utils/gn/secondary/compiler-rt/test/asan/BUILD.gn
Removed:
################################################################################
diff --git a/llvm/utils/gn/build/toolchain/BUILD.gn b/llvm/utils/gn/build/toolchain/BUILD.gn
index ecb23716ec293..80e5bd92a1ad8 100644
--- a/llvm/utils/gn/build/toolchain/BUILD.gn
+++ b/llvm/utils/gn/build/toolchain/BUILD.gn
@@ -9,8 +9,6 @@ declare_args() {
assert(!use_goma || goma_dir != "",
"set `goma_dir` to the output of `goma_ctl goma_dir` in your args.gn")
-unix_copy_command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} && cp -af {{source}} {{output}})"
-
template("unix_toolchain") {
toolchain(target_name) {
# https://groups.google.com/a/chromium.org/g/gn-dev/c/F_lv5T-tNDM
@@ -146,8 +144,9 @@ template("unix_toolchain") {
default_output_dir = "{{root_out_dir}}/bin"
}
+ copy_command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} && cp -af {{source}} {{output}})"
tool("copy") {
- command = unix_copy_command
+ command = copy_command
description = "COPY {{source}} {{output}}"
}
@@ -379,23 +378,14 @@ template("win_toolchain") {
}
tool("copy") {
- if (host_os == "win") {
- # GN hands out slash-using paths, but cmd's copy needs backslashes.
- # Use cmd's %foo:a=b% substitution feature to convert.
- command = "cmd /c set source=\"{{source}}\" & set output=\"{{output}}\" & call copy /Y %source:/=\% %output:\=/% > nul"
- } else {
- command = unix_copy_command
- }
-
+ # GN hands out slash-using paths, but cmd's copy needs backslashes.
+ # Use cmd's %foo:a=b% substitution feature to convert.
+ command = "cmd /c set source=\"{{source}}\" & set output=\"{{output}}\" & call copy /Y %source:/=\% %output:\=/% > nul"
description = "COPY {{source}} {{output}}"
}
tool("stamp") {
- if (host_os == "win") {
- command = "cmd /c type nul > {{output}}"
- } else {
- command = "touch {{output}}"
- }
+ command = "cmd /c type nul > {{output}}"
description = "STAMP {{output}}"
}
}
@@ -408,14 +398,11 @@ win_toolchain("win") {
}
}
-win_toolchain("stage2_win_x64") {
+win_toolchain("stage2_win") {
toolchain_args = {
- current_os = "win"
- current_cpu = "x64"
+ current_os = host_os
+ current_cpu = host_cpu
- if (host_os != "win") {
- sysroot = win_sysroot
- }
clang_base_path = root_build_dir
use_goma = false
}
@@ -427,12 +414,9 @@ win_toolchain("stage2_win_x64") {
win_toolchain("stage2_win_x86") {
toolchain_args = {
- current_os = "win"
+ current_os = host_os
current_cpu = "x86"
- if (host_os != "win") {
- sysroot = win_sysroot
- }
clang_base_path = root_build_dir
use_goma = false
}
diff --git a/llvm/utils/gn/build/toolchain/compiler.gni b/llvm/utils/gn/build/toolchain/compiler.gni
index 7cd15e658a087..28efe991bee86 100644
--- a/llvm/utils/gn/build/toolchain/compiler.gni
+++ b/llvm/utils/gn/build/toolchain/compiler.gni
@@ -13,9 +13,6 @@ declare_args() {
# Set this to the path to Android NDK r21. If set, cross compilation targeting
# Android will be enabled.
android_ndk_path = ""
-
- # Set this to the path of the Win SDK. Only used for cross compilation. If set, cross compilation targeting Windows will be enabled.
- win_sysroot = ""
}
declare_args() {
@@ -26,7 +23,3 @@ declare_args() {
# Set this to true to link with LLD instead of the default linker.
use_lld = clang_base_path != ""
}
-
-assert(
- !(host_os == "win" && win_sysroot != ""),
- "win_sysroot should only be used for cross compilation, use sysroot on Windows")
diff --git a/llvm/utils/gn/secondary/compiler-rt/BUILD.gn b/llvm/utils/gn/secondary/compiler-rt/BUILD.gn
index b31016108419e..edadd265833b9 100644
--- a/llvm/utils/gn/secondary/compiler-rt/BUILD.gn
+++ b/llvm/utils/gn/secondary/compiler-rt/BUILD.gn
@@ -5,13 +5,11 @@ 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 = []
-if (current_os == "win" || win_sysroot != "") {
- supported_toolchains += [ "//llvm/utils/gn/build/toolchain:stage2_win_x64" ]
+if (current_os == "win") {
+ supported_toolchains = [ "//llvm/utils/gn/build/toolchain:stage2_win" ]
supported_toolchains += [ "//llvm/utils/gn/build/toolchain:stage2_win_x86" ]
-}
-if (current_os != "win") {
- supported_toolchains += [ "//llvm/utils/gn/build/toolchain:stage2_unix" ]
+} else {
+ supported_toolchains = [ "//llvm/utils/gn/build/toolchain:stage2_unix" ]
}
supported_toolchains += supported_android_toolchains
if (llvm_build_AArch64) {
diff --git a/llvm/utils/gn/secondary/compiler-rt/test/asan/BUILD.gn b/llvm/utils/gn/secondary/compiler-rt/test/asan/BUILD.gn
index 92a74a04a9d98..27ab789ae7b74 100644
--- a/llvm/utils/gn/secondary/compiler-rt/test/asan/BUILD.gn
+++ b/llvm/utils/gn/secondary/compiler-rt/test/asan/BUILD.gn
@@ -48,9 +48,8 @@ supported_toolchains = []
if (host_os == "linux") {
supported_toolchains += [ "//llvm/utils/gn/build/toolchain:stage2_unix" ]
} else if (host_os == "win") {
- supported_toolchains += [ "//llvm/utils/gn/build/toolchain:stage2_win_64" ]
+ supported_toolchains += [ "//llvm/utils/gn/build/toolchain:stage2_win" ]
}
-
group("asan") {
deps = []
foreach(toolchain, supported_toolchains) {
More information about the llvm-commits
mailing list