From 4f598c584d7e4f34162efa5b179af62cd201f554 Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Fri, 20 Jan 2017 15:44:24 -0800 Subject: [PATCH] GN: Fix cross ARM64 and cross MIPS builds. R=zra@google.com Review-Url: https://codereview.chromium.org/2643583002 . --- build/config/compiler/BUILD.gn | 4 ++++ runtime/platform/globals.h | 3 +++ tools/gn.py | 19 +++++++++++-------- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 346059763e2..ab45443d08c 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -226,6 +226,10 @@ config("compiler") { ] } } else if (current_cpu == "mipsel") { + # Some toolchains default to big-endian. + cflags += [ "-EL" ] + ldflags += [ "-EL" ] + # We have to explicitly request exceptions to get good heap profiles from # tcmalloc. if (is_debug || is_release) { diff --git a/runtime/platform/globals.h b/runtime/platform/globals.h index 101200bec5f..d862a9edaf8 100644 --- a/runtime/platform/globals.h +++ b/runtime/platform/globals.h @@ -248,6 +248,9 @@ typedef simd_value_t fpu_register_t; #define ARCH_IS_32_BIT 1 #define kFpuRegisterSize 8 typedef double fpu_register_t; +#elif defined(__MIPSEB__) +#error Big-endian MIPS is not supported by Dart. Try passing -EL to your \ + compiler. #elif defined(__aarch64__) #define HOST_ARCH_ARM64 1 #define ARCH_IS_64_BIT 1 diff --git a/tools/gn.py b/tools/gn.py index 1e5120b927b..df6e36ec058 100755 --- a/tools/gn.py +++ b/tools/gn.py @@ -140,14 +140,17 @@ def to_gn_args(args, mode, arch, target_os): and not args.msan and not args.tsan) - # Force -mfloat-abi=hard and -mfpu=neon on Linux as we're specifying - # a gnueabihf compiler in //build/toolchain/linux BUILD.gn. - # TODO(zra): This will likely need some adjustment to build for armv6 etc. - hard_float = (gn_args['target_cpu'].startswith('arm') and - (gn_args['target_os'] == 'linux')) - if hard_float: - gn_args['arm_float_abi'] = 'hard' - gn_args['arm_use_neon'] = True + if gn_args['target_os'] == 'linux': + if gn_args['target_cpu'] == 'arm': + # Force -mfloat-abi=hard and -mfpu=neon for arm on Linux as we're + # specifying a gnueabihf compiler in //build/toolchain/linux BUILD.gn. + gn_args['arm_arch'] = 'armv7' + gn_args['arm_float_abi'] = 'hard' + gn_args['arm_use_neon'] = True + elif gn_args['target_cpu'] == 'armv6': + raise Exception("GN support for armv6 unimplemented") + elif gn_args['target_cpu'] == 'armv5te': + raise Exception("GN support for armv5te unimplemented") gn_args['is_debug'] = mode == 'debug' gn_args['is_release'] = mode == 'release'