File tree Expand file tree Collapse file tree 6 files changed +23
-6
lines changed Expand file tree Collapse file tree 6 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ config("compiler_defaults") {
6161 }
6262
6363 asmflags = target_flags
64- cflags = target_flags
64+ cflags = target_flags + target_cflags
6565 cflags_cc = []
6666 ldflags = target_flags + target_ldflags
6767
@@ -343,7 +343,11 @@ config("compiler_defaults") {
343343 ldflags += [ " /winsysroot:" + rebase_path (sysroot , root_build_dir ) ]
344344
345345 # FIXME: Remove once PR54409 is fixed.
346- ldflags += [ " /machine:x64" ]
346+ if (current_cpu == " x64" ) {
347+ ldflags += [ " /machine:x64" ]
348+ } else if (current_cpu == " x86" ) {
349+ ldflags += [ " /machine:x86" ]
350+ }
347351 }
348352 } else if (current_os != " ios" && current_os != " mac" &&
349353 current_os != " android" ) {
Original file line number Diff line number Diff line change @@ -209,6 +209,13 @@ stage2_unix_toolchain("stage2_unix") {
209209 }
210210}
211211
212+ stage2_unix_toolchain (" stage2_unix_x86" ) {
213+ toolchain_args = {
214+ current_os = host_os
215+ current_cpu = " x86"
216+ }
217+ }
218+
212219if (android_ndk_path != " " ) {
213220 # Android compiler-rt libraries don't really work with per-target runtime
214221 # directories yet so force it off.
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import("//llvm/utils/gn/build/toolchain/compiler.gni")
88# COMPILER_RT_TEST_COMPILER_CFLAGS).
99
1010target_flags = []
11+ target_cflags = []
1112target_ldflags = []
1213
1314if (current_os == " android" ) {
@@ -55,6 +56,10 @@ if (current_os == "android") {
5556 target_flags += [ " --target=$llvm_current_triple " ]
5657}
5758
58- if (current_cpu == " x86" && current_os != " win" ) {
59- target_flags += [ " -m32" ]
59+ if (current_cpu == " x86" ) {
60+ if (current_os == " win" ) {
61+ target_cflags += [ " -m32" ]
62+ } else {
63+ target_flags += [ " -m32" ]
64+ }
6065}
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ if (current_os == "win" || win_sysroot != "") {
1212}
1313if (current_os != " win" ) {
1414 supported_toolchains += [ " //llvm/utils/gn/build/toolchain:stage2_unix" ]
15+ supported_toolchains += [ " //llvm/utils/gn/build/toolchain:stage2_unix_x86" ]
1516}
1617supported_toolchains += supported_android_toolchains
1718if (llvm_build_AArch64 ) {
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ group("lib") {
44 " //compiler-rt/lib/builtins" ,
55 " //compiler-rt/lib/cfi:ignorelist($host_toolchain )" ,
66 ]
7- if (current_os == " linux" ) {
7+ if (current_os == " linux" && current_cpu == " x64 " ) {
88 deps += [ " //compiler-rt/lib/msan" ]
99 }
1010 if (current_os == " linux" || current_os == " android" ) {
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ declare_args() {
1010
1111target_flags_string = " "
1212
13- foreach (flag , target_flags + target_ldflags ) {
13+ foreach (flag , target_flags + target_cflags + target_ldflags ) {
1414 if (target_flags_string != " " ) {
1515 target_flags_string += " "
1616 }
You can’t perform that action at this time.
0 commit comments