From 40c6e736fda48d7d39ca07a19d45cb32409f2149 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Wed, 6 Mar 2019 01:28:32 +0000 Subject: [PATCH] gn build: Add 32-bit Linux support. Differential Revision: https://reviews.llvm.org/D58839 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355467 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/gn/build/toolchain/target_flags.gni | 4 ++++ utils/gn/secondary/compiler-rt/target.gni | 4 +++- utils/gn/secondary/llvm/triples.gni | 6 +++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/utils/gn/build/toolchain/target_flags.gni b/utils/gn/build/toolchain/target_flags.gni index 3ad02a969fd..e1c045f625c 100644 --- a/utils/gn/build/toolchain/target_flags.gni +++ b/utils/gn/build/toolchain/target_flags.gni @@ -12,3 +12,7 @@ if (current_os == "android") { ] target_ldflags += [ "-static-libstdc++" ] } + +if (current_cpu == "x86") { + target_flags = [ "-m32" ] +} diff --git a/utils/gn/secondary/compiler-rt/target.gni b/utils/gn/secondary/compiler-rt/target.gni index 7ea73b12ea1..c511bed8204 100644 --- a/utils/gn/secondary/compiler-rt/target.gni +++ b/utils/gn/secondary/compiler-rt/target.gni @@ -6,7 +6,9 @@ if (current_os == "linux" || current_os == "android") { assert(false, "unimplemented current_os " + current_os) } -if (current_cpu == "x64") { +if (current_cpu == "x86") { + crt_current_target_arch = "i386" +} else if (current_cpu == "x64") { crt_current_target_arch = "x86_64" } else if (current_cpu == "arm64") { crt_current_target_arch = "aarch64" diff --git a/utils/gn/secondary/llvm/triples.gni b/utils/gn/secondary/llvm/triples.gni index a82bd9b921b..988ad59893e 100644 --- a/utils/gn/secondary/llvm/triples.gni +++ b/utils/gn/secondary/llvm/triples.gni @@ -1,4 +1,8 @@ -if (current_cpu == "x64") { +if (current_cpu == "x86") { + if (current_os == "linux") { + llvm_current_triple = "i386-unknown-linux-gnu" + } +} else if (current_cpu == "x64") { if (current_os == "freebsd") { llvm_current_triple = "x86_64-unknown-freebsd" } else if (current_os == "linux") { -- 2.40.0