From 7c605f71f945fe0f5582873f3862116f59e42874 Mon Sep 17 00:00:00 2001 From: klzgrad Date: Sat, 30 Nov 2019 21:57:40 +0800 Subject: [PATCH] build: Add MIPS architectures --- src/build/config/nacl/config.gni | 2 ++ src/build/toolchain/linux/BUILD.gn | 14 ++++++++++++++ src/build/toolchain/nacl/BUILD.gn | 10 ++++++++++ src/chrome/installer/linux/BUILD.gn | 8 ++++++++ .../src/trusted/service_runtime/linux/BUILD.gn | 4 ++++ .../service_runtime/linux/toolchain/BUILD.gn | 4 ++++ src/ppapi/native_client/nacl_test_data.gni | 4 ++++ .../src/untrusted/pnacl_support_extension/BUILD.gn | 2 +- src/skia/BUILD.gn | 7 +++++-- src/third_party/angle/gni/angle.gni | 2 ++ .../swiftshader/third_party/llvm-7.0/BUILD.gn | 2 ++ 11 files changed, 56 insertions(+), 3 deletions(-) diff --git a/src/build/config/nacl/config.gni b/src/build/config/nacl/config.gni index 77e15fc51c..3bcc621056 100644 --- a/src/build/config/nacl/config.gni +++ b/src/build/config/nacl/config.gni @@ -19,6 +19,8 @@ if (is_nacl_glibc) { nacl_toolchain_package = "nacl_x86_glibc" } else if (current_cpu == "arm") { nacl_toolchain_package = "nacl_arm_glibc" + } else if (current_cpu == "mips") { + nacl_toolchain_package = "nacl_mips_glibc" } } else { nacl_toolchain_package = "pnacl_newlib" diff --git a/src/build/toolchain/linux/BUILD.gn b/src/build/toolchain/linux/BUILD.gn index fa8b17e9db..cfd98ac14d 100644 --- a/src/build/toolchain/linux/BUILD.gn +++ b/src/build/toolchain/linux/BUILD.gn @@ -185,6 +185,20 @@ clang_toolchain("clang_mips64el") { } } +clang_toolchain("clang_mips") { + toolchain_args = { + current_cpu = "mips" + current_os = "linux" + } +} + +clang_toolchain("clang_mips64") { + toolchain_args = { + current_cpu = "mips64" + current_os = "linux" + } +} + gcc_toolchain("mipsel") { toolprefix = "mipsel-linux-gnu-" diff --git a/src/build/toolchain/nacl/BUILD.gn b/src/build/toolchain/nacl/BUILD.gn index 85e284948c..6847e1e448 100644 --- a/src/build/toolchain/nacl/BUILD.gn +++ b/src/build/toolchain/nacl/BUILD.gn @@ -167,6 +167,12 @@ nacl_glibc_toolchain("arm") { toolchain_tuple = "arm-nacl" } +nacl_glibc_toolchain("mips") { + toolchain_package = "" + toolchain_revision = "" + toolchain_tuple = "" +} + template("nacl_clang_toolchain") { toolchain_cpu = target_name assert(defined(invoker.toolchain_tuple), "Must define toolchain_tuple") @@ -264,3 +270,7 @@ nacl_clang_toolchains("arm") { nacl_clang_toolchains("mipsel") { toolchain_tuple = "mipsel-nacl" } + +nacl_clang_toolchains("mips") { + toolchain_tuple = "mips-nacl" +} diff --git a/src/chrome/installer/linux/BUILD.gn b/src/chrome/installer/linux/BUILD.gn index 709552f186..c7457d5104 100644 --- a/src/chrome/installer/linux/BUILD.gn +++ b/src/chrome/installer/linux/BUILD.gn @@ -403,6 +403,10 @@ template("linux_package") { deb_arch = "mipsel" } else if (current_cpu == "mips64el") { deb_arch = "mips64el" + } else if (current_cpu == "mips") { + deb_arch = "mips" + } else if (current_cpu == "mips64") { + deb_arch = "mips64" } else { assert(false, "Linux installer not configured for this architecture.") } @@ -461,6 +465,10 @@ template("linux_package") { rpm_arch = "mipsel" } else if (current_cpu == "mips64el") { rpm_arch = "mips64el" + } else if (current_cpu == "mips") { + rpm_arch = "mips" + } else if (current_cpu == "mips64") { + rpm_arch = "mips64" } else { assert(false, "Linux installer not configured for this architecture.") } diff --git a/src/native_client/src/trusted/service_runtime/linux/BUILD.gn b/src/native_client/src/trusted/service_runtime/linux/BUILD.gn index 438daa224b..d7f8cfc9e0 100644 --- a/src/native_client/src/trusted/service_runtime/linux/BUILD.gn +++ b/src/native_client/src/trusted/service_runtime/linux/BUILD.gn @@ -52,6 +52,10 @@ if (current_toolchain == bootstrap_toolchain) { nacl_reserve_top = "0x40008000" linker_emulation = "elf32ltsmip" } + if (current_cpu == "mips") { + nacl_reserve_top = "" + linker_emulation = "" + } static_library("nacl_bootstrap_lib") { # This code has very specific requirements related to its static diff --git a/src/native_client/src/trusted/service_runtime/linux/toolchain/BUILD.gn b/src/native_client/src/trusted/service_runtime/linux/toolchain/BUILD.gn index 440a91b3cf..1fa4ef4be0 100644 --- a/src/native_client/src/trusted/service_runtime/linux/toolchain/BUILD.gn +++ b/src/native_client/src/trusted/service_runtime/linux/toolchain/BUILD.gn @@ -36,3 +36,7 @@ nacl_bootstrap_toolchain("nacl_bootstrap_arm") { nacl_bootstrap_toolchain("nacl_bootstrap_mipsel") { toolchain_cpu = "mipsel" } + +nacl_bootstrap_toolchain("nacl_bootstrap_mips") { + toolchain_cpu = "mips" +} diff --git a/src/ppapi/native_client/nacl_test_data.gni b/src/ppapi/native_client/nacl_test_data.gni index 4bf1b90b47..0b143c37fe 100644 --- a/src/ppapi/native_client/nacl_test_data.gni +++ b/src/ppapi/native_client/nacl_test_data.gni @@ -220,6 +220,8 @@ template("nacl_test_data") { arch = "x86-32-nonsfi" } else if (translate_cpu == "arm") { arch = "arm-nonsfi" + } else if (translate_cpu == "mips") { + arch = "mips" } } else { # TODO(phosek): remove the following once change 1360243003 is rolled @@ -232,6 +234,8 @@ template("nacl_test_data") { arch = "armv7" } else if (translate_cpu == "mipsel") { arch = "mipsel" + } else if (translate_cpu == "mips") { + arch = "mips" } } diff --git a/src/ppapi/native_client/src/untrusted/pnacl_support_extension/BUILD.gn b/src/ppapi/native_client/src/untrusted/pnacl_support_extension/BUILD.gn index a4ee2076e5..65176a49fc 100644 --- a/src/ppapi/native_client/src/untrusted/pnacl_support_extension/BUILD.gn +++ b/src/ppapi/native_client/src/untrusted/pnacl_support_extension/BUILD.gn @@ -53,7 +53,7 @@ action("pnacl_support_extension") { if (target_cpu == "arm") { output_cpu = "arm" - } else if (target_cpu == "mipsel") { + } else if (target_cpu == "mipsel" || target_cpu == "mips") { output_cpu = "mips32" } else if (target_cpu == "x64") { output_cpu = "x86_64" diff --git a/src/skia/BUILD.gn b/src/skia/BUILD.gn index ecb5604eb7..e49c1bb574 100644 --- a/src/skia/BUILD.gn +++ b/src/skia/BUILD.gn @@ -18,6 +18,9 @@ if (current_cpu == "arm") { if (current_cpu == "mipsel" || current_cpu == "mips64el") { import("//build/config/mips.gni") } +if (current_cpu == "mips" || current_cpu == "mips64") { + import("//build/config/mips.gni") +} skia_support_gpu = !is_ios skia_support_pdf = !is_ios && enable_basic_printing @@ -714,7 +717,7 @@ skia_source_set("skia_opts") { } else if (current_cpu == "arm64") { sources = skia_opts.arm64_sources deps += [ ":skia_opts_crc32" ] - } else if (current_cpu == "mipsel") { + } else if (current_cpu == "mipsel" || current_cpu == "mips") { cflags += [ "-fomit-frame-pointer" ] if (mips_dsp_rev >= 1) { @@ -722,7 +725,7 @@ skia_source_set("skia_opts") { } else { sources = skia_opts.none_sources } - } else if (current_cpu == "mips64el") { + } else if (current_cpu == "mips64el" || current_cpu == "mips64") { cflags += [ "-fomit-frame-pointer" ] sources = skia_opts.none_sources } else if (current_cpu == "ppc64") { diff --git a/src/third_party/angle/gni/angle.gni b/src/third_party/angle/gni/angle.gni index 1ba4132d20..95c0478b78 100644 --- a/src/third_party/angle/gni/angle.gni +++ b/src/third_party/angle/gni/angle.gni @@ -26,10 +26,12 @@ angle_data_dir = "angledata" declare_args() { if (current_cpu == "arm64" || current_cpu == "x64" || current_cpu == "mips64el" || current_cpu == "s390x" || + current_cpu == "mips64" || current_cpu == "ppc64") { angle_64bit_current_cpu = true } else if (current_cpu == "arm" || current_cpu == "x86" || current_cpu == "mipsel" || current_cpu == "s390" || + current_cpu == "mips" || current_cpu == "ppc") { angle_64bit_current_cpu = false } else { diff --git a/src/third_party/swiftshader/third_party/llvm-7.0/BUILD.gn b/src/third_party/swiftshader/third_party/llvm-7.0/BUILD.gn index 08ec2b025a..243e072916 100644 --- a/src/third_party/swiftshader/third_party/llvm-7.0/BUILD.gn +++ b/src/third_party/swiftshader/third_party/llvm-7.0/BUILD.gn @@ -333,6 +333,8 @@ swiftshader_source_set("swiftshader_llvm") { deps += [":swiftshader_llvm_aarch64"] } else if (target_cpu == "mipsel" || target_cpu == "mips64el") { deps += [":swiftshader_llvm_mips"] + } else if (target_cpu == "mips" || target_cpu == "mips64") { + deps += [":swiftshader_llvm_mips"] } else if (target_cpu == "ppc64") { deps += [":swiftshader_llvm_ppc"] } else {