Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions llvm/utils/gn/build/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ config("compiler_defaults") {
}

asmflags = target_flags
cflags = target_flags
cflags = target_flags + target_cflags
cflags_cc = []
ldflags = target_flags + target_ldflags

Expand Down Expand Up @@ -343,7 +343,11 @@ config("compiler_defaults") {
ldflags += [ "/winsysroot:" + rebase_path(sysroot, root_build_dir) ]

# FIXME: Remove once PR54409 is fixed.
ldflags += [ "/machine:x64" ]
if (current_cpu == "x64") {
ldflags += [ "/machine:x64" ]
} else if (current_cpu == "x86") {
ldflags += [ "/machine:x86" ]
}
}
} else if (current_os != "ios" && current_os != "mac" &&
current_os != "android") {
Expand Down
7 changes: 7 additions & 0 deletions llvm/utils/gn/build/toolchain/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,13 @@ stage2_unix_toolchain("stage2_unix") {
}
}

stage2_unix_toolchain("stage2_unix_x86") {
toolchain_args = {
current_os = host_os
current_cpu = "x86"
}
}

if (android_ndk_path != "") {
# Android compiler-rt libraries don't really work with per-target runtime
# directories yet so force it off.
Expand Down
9 changes: 7 additions & 2 deletions llvm/utils/gn/build/toolchain/target_flags.gni
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import("//llvm/utils/gn/build/toolchain/compiler.gni")
# COMPILER_RT_TEST_COMPILER_CFLAGS).

target_flags = []
target_cflags = []
target_ldflags = []

if (current_os == "android") {
Expand Down Expand Up @@ -55,6 +56,10 @@ if (current_os == "android") {
target_flags += [ "--target=$llvm_current_triple" ]
}

if (current_cpu == "x86" && current_os != "win") {
target_flags += [ "-m32" ]
if (current_cpu == "x86") {
if (current_os == "win") {
target_cflags += [ "-m32" ]
} else {
target_flags += [ "-m32" ]
}
}
1 change: 1 addition & 0 deletions llvm/utils/gn/secondary/compiler-rt/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ if (current_os == "win" || win_sysroot != "") {
}
if (current_os != "win") {
supported_toolchains += [ "//llvm/utils/gn/build/toolchain:stage2_unix" ]
supported_toolchains += [ "//llvm/utils/gn/build/toolchain:stage2_unix_x86" ]
}
supported_toolchains += supported_android_toolchains
if (llvm_build_AArch64) {
Expand Down
2 changes: 1 addition & 1 deletion llvm/utils/gn/secondary/compiler-rt/lib/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ group("lib") {
"//compiler-rt/lib/builtins",
"//compiler-rt/lib/cfi:ignorelist($host_toolchain)",
]
if (current_os == "linux") {
if (current_os == "linux" && current_cpu == "x64") {
deps += [ "//compiler-rt/lib/msan" ]
}
if (current_os == "linux" || current_os == "android") {
Expand Down
2 changes: 1 addition & 1 deletion llvm/utils/gn/secondary/compiler-rt/test/test.gni
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ declare_args() {

target_flags_string = ""

foreach(flag, target_flags + target_ldflags) {
foreach(flag, target_flags + target_cflags + target_ldflags) {
if (target_flags_string != "") {
target_flags_string += " "
}
Expand Down
Loading