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") {
61
61
}
62
62
63
63
asmflags = target_flags
64
- cflags = target_flags
64
+ cflags = target_flags + target_cflags
65
65
cflags_cc = []
66
66
ldflags = target_flags + target_ldflags
67
67
@@ -343,7 +343,11 @@ config("compiler_defaults") {
343
343
ldflags += [ " /winsysroot:" + rebase_path (sysroot , root_build_dir ) ]
344
344
345
345
# 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
+ }
347
351
}
348
352
} else if (current_os != " ios" && current_os != " mac" &&
349
353
current_os != " android" ) {
Original file line number Diff line number Diff line change @@ -209,6 +209,13 @@ stage2_unix_toolchain("stage2_unix") {
209
209
}
210
210
}
211
211
212
+ stage2_unix_toolchain (" stage2_unix_x86" ) {
213
+ toolchain_args = {
214
+ current_os = host_os
215
+ current_cpu = " x86"
216
+ }
217
+ }
218
+
212
219
if (android_ndk_path != " " ) {
213
220
# Android compiler-rt libraries don't really work with per-target runtime
214
221
# 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")
8
8
# COMPILER_RT_TEST_COMPILER_CFLAGS).
9
9
10
10
target_flags = []
11
+ target_cflags = []
11
12
target_ldflags = []
12
13
13
14
if (current_os == " android" ) {
@@ -55,6 +56,10 @@ if (current_os == "android") {
55
56
target_flags += [ " --target=$llvm_current_triple " ]
56
57
}
57
58
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
+ }
60
65
}
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ if (current_os == "win" || win_sysroot != "") {
12
12
}
13
13
if (current_os != " win" ) {
14
14
supported_toolchains += [ " //llvm/utils/gn/build/toolchain:stage2_unix" ]
15
+ supported_toolchains += [ " //llvm/utils/gn/build/toolchain:stage2_unix_x86" ]
15
16
}
16
17
supported_toolchains += supported_android_toolchains
17
18
if (llvm_build_AArch64 ) {
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ group("lib") {
4
4
" //compiler-rt/lib/builtins" ,
5
5
" //compiler-rt/lib/cfi:ignorelist($host_toolchain )" ,
6
6
]
7
- if (current_os == " linux" ) {
7
+ if (current_os == " linux" && current_cpu == " x64 " ) {
8
8
deps += [ " //compiler-rt/lib/msan" ]
9
9
}
10
10
if (current_os == " linux" || current_os == " android" ) {
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ declare_args() {
10
10
11
11
target_flags_string = " "
12
12
13
- foreach (flag , target_flags + target_ldflags ) {
13
+ foreach (flag , target_flags + target_cflags + target_ldflags ) {
14
14
if (target_flags_string != " " ) {
15
15
target_flags_string += " "
16
16
}
You can’t perform that action at this time.
0 commit comments