From dae5068650f2ae9fc32f412b8d4c4eecb30c76d6 Mon Sep 17 00:00:00 2001 From: "zra@google.com" Date: Fri, 19 Apr 2013 18:05:44 +0000 Subject: [PATCH] Enables cross-compilation of the VM for ARM. Uses the "toolset" feature of gyp to build the dart VM for ARM, but restricts building of snapshot generation to the host machine. For generated source files, it also changes to using LIB_DIR instead of SHARED_INTERMEDIATE_DIR to avoid generation of duplicate Makefile rules (gyp doesn't know that generated source files from toolchains it thinks are different will be the same.) Review URL: https://codereview.chromium.org//12726011 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21757 260f80e4-7a28-3924-810f-c04153c831b5 --- runtime/bin/bin.gypi | 40 ++++++-- runtime/dart-runtime.gyp | 6 +- runtime/platform/globals.h | 16 ++++ .../src/double-conversion.gypi | 1 + runtime/third_party/jscre/jscre.gypi | 1 + runtime/vm/assembler_arm.cc | 14 +-- runtime/vm/object.cc | 2 + runtime/vm/vm.gypi | 94 ++++++++++++------- tools/build.py | 33 +++++-- tools/gyp/configurations_make.gypi | 21 +++-- 10 files changed, 157 insertions(+), 71 deletions(-) diff --git a/runtime/bin/bin.gypi b/runtime/bin/bin.gypi index b910a106afd..1cf2bb4b002 100644 --- a/runtime/bin/bin.gypi +++ b/runtime/bin/bin.gypi @@ -4,19 +4,32 @@ { 'variables': { - 'io_cc_file': '<(SHARED_INTERMEDIATE_DIR)/io_gen.cc', - 'io_patch_cc_file': '<(SHARED_INTERMEDIATE_DIR)/io_patch_gen.cc', + # We place most generated source files in LIB_DIR (rather than, say + # SHARED_INTERMEDIATE_DIR) because it is toolset specific. This avoids + # two problems. First, if a generated source file has architecture specific + # code, we'll get two different files in two different directories. Second, + # if a generated source file is needed to build a target with multiple + # toolsets, we avoid having duplicate Makefile targets. + 'gen_source_dir': '<(LIB_DIR)', + + 'io_cc_file': '<(gen_source_dir)/io_gen.cc', + 'io_patch_cc_file': '<(gen_source_dir)/io_patch_gen.cc', 'builtin_in_cc_file': 'builtin_in.cc', - 'builtin_cc_file': '<(SHARED_INTERMEDIATE_DIR)/builtin_gen.cc', + 'builtin_cc_file': '<(gen_source_dir)/builtin_gen.cc', 'snapshot_in_cc_file': 'snapshot_in.cc', - 'snapshot_bin_file': '<(SHARED_INTERMEDIATE_DIR)/snapshot_gen.bin', + 'snapshot_bin_file': '<(gen_source_dir)/snapshot_gen.bin', + 'resources_cc_file': '<(gen_source_dir)/resources_gen.cc', + + # The program that creates snapshot_gen.cc is only built and run on the + # host, but it must be available when dart is built for the target. Thus, + # we keep it in a shared location. 'snapshot_cc_file': '<(SHARED_INTERMEDIATE_DIR)/snapshot_gen.cc', - 'resources_cc_file': '<(SHARED_INTERMEDIATE_DIR)/resources_gen.cc', }, 'targets': [ { 'target_name': 'generate_builtin_cc_file', 'type': 'none', + 'toolsets':['target','host'], 'includes': [ 'builtin_sources.gypi', ], @@ -47,8 +60,9 @@ { 'target_name': 'generate_io_cc_file', 'type': 'none', + 'toolsets':['target','host'], 'variables': { - 'io_dart': '<(SHARED_INTERMEDIATE_DIR)/io_gen.dart', + 'io_dart': '<(gen_source_dir)/io_gen.dart', }, 'sources': [ 'io.dart', @@ -99,6 +113,7 @@ { 'target_name': 'generate_io_patch_cc_file', 'type': 'none', + 'toolsets':['target','host'], 'includes': [ 'io_sources.gypi', ], @@ -129,6 +144,7 @@ { 'target_name': 'libdart_builtin', 'type': 'static_library', + 'toolsets':['target','host'], 'dependencies': [ 'generate_builtin_cc_file', 'generate_io_cc_file', @@ -218,6 +234,7 @@ { 'target_name': 'libdart_withcore', 'type': 'static_library', + 'toolsets':['target','host'], 'dependencies': [ 'libdart_lib_withcore', 'libdart_vm', @@ -243,6 +260,7 @@ # Completely statically linked binary for generating snapshots. 'target_name': 'gen_snapshot', 'type': 'executable', + 'toolsets':['host'], 'dependencies': [ 'libdart_withcore', 'libdart_builtin', @@ -276,8 +294,9 @@ # Generate snapshot bin file. 'target_name': 'generate_snapshot_bin', 'type': 'none', + 'toolsets':['host'], 'dependencies': [ - 'gen_snapshot', + 'gen_snapshot#host', ], 'actions': [ { @@ -305,8 +324,9 @@ # Generate snapshot file. 'target_name': 'generate_snapshot_file', 'type': 'none', + 'toolsets':['host'], 'dependencies': [ - 'generate_snapshot_bin', + 'generate_snapshot_bin#host', ], 'actions': [ { @@ -365,7 +385,7 @@ 'libdart', 'libdart_builtin', 'libdart_io', - 'generate_snapshot_file', + 'generate_snapshot_file#host', 'generate_resources_cc_file', ], 'include_dirs': [ @@ -478,7 +498,7 @@ ], 'include_dirs': [ '..', - '<(SHARED_INTERMEDIATE_DIR)', + '<(gen_source_dir)', ], 'sources': [ 'run_vm_tests.cc', diff --git a/runtime/dart-runtime.gyp b/runtime/dart-runtime.gyp index db2f10fd5e0..9b19767f052 100644 --- a/runtime/dart-runtime.gyp +++ b/runtime/dart-runtime.gyp @@ -11,8 +11,9 @@ 'third_party/jscre/jscre.gypi', ], 'variables': { + 'gen_source_dir': '<(LIB_DIR)', 'version_in_cc_file': 'vm/version_in.cc', - 'version_cc_file': '<(SHARED_INTERMEDIATE_DIR)/version.cc', + 'version_cc_file': '<(gen_source_dir)/version.cc', # Disable the OpenGLUI embedder by default on desktop OSes. Note, # to build this on the desktop, you need GLUT installed. @@ -61,6 +62,7 @@ { 'target_name': 'generate_version_cc_file', 'type': 'none', + 'toolsets':['target','host'], 'dependencies': [ 'libdart_dependency_helper', ], @@ -94,6 +96,7 @@ { 'target_name': 'libdart_dependency_helper', 'type': 'executable', + 'toolsets':['target','host'], # The dependencies here are the union of the dependencies of libdart and # libdart_withcore. 'dependencies': [ @@ -106,6 +109,7 @@ 'sources': [ 'vm/libdart_dependency_helper.cc', ], + 'product_dir':'<(PRODUCT_DIR)/<(_toolset)' }, { 'target_name': 'runtime_packages', diff --git a/runtime/platform/globals.h b/runtime/platform/globals.h index 2d566bbb62f..b16960e2ae8 100644 --- a/runtime/platform/globals.h +++ b/runtime/platform/globals.h @@ -130,6 +130,22 @@ typedef simd128_value_t fpu_register_t; #define ARCH_IS_32_BIT 1 #define kFpuRegisterSize 8 typedef double fpu_register_t; +typedef struct { + union { + uint32_t u; + float f; + } data_[4]; +} simd_value_t; +#define simd_value_safe_load(addr) \ + (*reinterpret_cast(addr)) +#define simd_value_safe_store(addr, value) \ + do { \ + reinterpret_cast(addr)->data_[0] = value.data_[0]; \ + reinterpret_cast(addr)->data_[1] = value.data_[1]; \ + reinterpret_cast(addr)->data_[2] = value.data_[2]; \ + reinterpret_cast(addr)->data_[3] = value.data_[3]; \ + } while (0) + #elif defined(__MIPSEL__) #define HOST_ARCH_MIPS 1 #define ARCH_IS_32_BIT 1 diff --git a/runtime/third_party/double-conversion/src/double-conversion.gypi b/runtime/third_party/double-conversion/src/double-conversion.gypi index 8466d5d6604..aa474b8ac9e 100644 --- a/runtime/third_party/double-conversion/src/double-conversion.gypi +++ b/runtime/third_party/double-conversion/src/double-conversion.gypi @@ -5,6 +5,7 @@ { 'target_name': 'libdouble_conversion', 'type': 'static_library', + 'toolsets':['target','host'], 'dependencies': [ ], 'include_dirs': [ diff --git a/runtime/third_party/jscre/jscre.gypi b/runtime/third_party/jscre/jscre.gypi index 46ecb7e2caa..acb6d8cad52 100644 --- a/runtime/third_party/jscre/jscre.gypi +++ b/runtime/third_party/jscre/jscre.gypi @@ -5,6 +5,7 @@ { 'target_name': 'libjscre', 'type': 'static_library', + 'toolsets':['target','host'], 'dependencies': [ ], 'include_dirs': [ diff --git a/runtime/vm/assembler_arm.cc b/runtime/vm/assembler_arm.cc index f003889483d..8910679a1f7 100644 --- a/runtime/vm/assembler_arm.cc +++ b/runtime/vm/assembler_arm.cc @@ -40,19 +40,7 @@ void CPUFeatures::InitOnce() { #if defined(USING_SIMULATOR) integer_division_supported_ = true; #else - Assembler assembler; - __ mrc(R0, 15, 0, 0, 2, 0); - __ Lsr(R0, R0, 24); - __ and_(R0, R0, ShifterOperand(0xf)); - __ Ret(); - - const Code& code = - Code::Handle(Code::FinalizeCode("DetectCPUFeatures", &assembler)); - Instructions& instructions = Instructions::Handle(code.instructions()); - typedef int32_t (*DetectCPUFeatures)(); - int32_t features = - reinterpret_cast(instructions.EntryPoint())(); - integer_division_supported_ = features != 0; + integer_division_supported_ = false; #endif // defined(USING_SIMULATOR) #if defined(DEBUG) initialized_ = true; diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc index b579c2ac6ef..3cf6c2d6a15 100644 --- a/runtime/vm/object.cc +++ b/runtime/vm/object.cc @@ -7,6 +7,7 @@ #include "include/dart_api.h" #include "platform/assert.h" #include "vm/assembler.h" +#include "vm/cpu.h" #include "vm/bigint_operations.h" #include "vm/bootstrap.h" #include "vm/class_finalizer.h" @@ -7761,6 +7762,7 @@ RawCode* Code::FinalizeCode(const char* name, MemoryRegion region(reinterpret_cast(instrs.EntryPoint()), instrs.size()); assembler->FinalizeInstructions(region); + CPU::FlushICache(instrs.EntryPoint(), instrs.size()); CodeObservers::NotifyAll(name, instrs.EntryPoint(), diff --git a/runtime/vm/vm.gypi b/runtime/vm/vm.gypi index eaf38652faa..ccaa4e8d59a 100644 --- a/runtime/vm/vm.gypi +++ b/runtime/vm/vm.gypi @@ -4,29 +4,30 @@ { 'variables': { + 'gen_source_dir': '<(LIB_DIR)', 'builtin_in_cc_file': '../bin/builtin_in.cc', - 'async_cc_file': '<(SHARED_INTERMEDIATE_DIR)/async_gen.cc', - 'async_patch_cc_file': '<(SHARED_INTERMEDIATE_DIR)/async_patch_gen.cc', - 'corelib_cc_file': '<(SHARED_INTERMEDIATE_DIR)/corelib_gen.cc', - 'corelib_patch_cc_file': '<(SHARED_INTERMEDIATE_DIR)/corelib_patch_gen.cc', - 'collection_cc_file': '<(SHARED_INTERMEDIATE_DIR)/collection_gen.cc', - 'collection_patch_cc_file': '<(SHARED_INTERMEDIATE_DIR)/collection_patch_gen.cc', - 'collection_dev_cc_file': '<(SHARED_INTERMEDIATE_DIR)/collection_dev_gen.cc', - 'collection_dev_patch_cc_file': '<(SHARED_INTERMEDIATE_DIR)/collection_dev_patch_gen.cc', - 'crypto_cc_file': '<(SHARED_INTERMEDIATE_DIR)/crypto_gen.cc', - 'math_cc_file': '<(SHARED_INTERMEDIATE_DIR)/math_gen.cc', - 'math_patch_cc_file': '<(SHARED_INTERMEDIATE_DIR)/math_patch_gen.cc', - 'mirrors_cc_file': '<(SHARED_INTERMEDIATE_DIR)/mirrors_gen.cc', - 'mirrors_patch_cc_file': '<(SHARED_INTERMEDIATE_DIR)/mirrors_patch_gen.cc', - 'isolate_cc_file': '<(SHARED_INTERMEDIATE_DIR)/isolate_gen.cc', - 'isolate_patch_cc_file': '<(SHARED_INTERMEDIATE_DIR)/isolate_patch_gen.cc', - 'json_cc_file': '<(SHARED_INTERMEDIATE_DIR)/json_gen.cc', - 'json_patch_cc_file': '<(SHARED_INTERMEDIATE_DIR)/json_patch_gen.cc', - 'typeddata_cc_file': '<(SHARED_INTERMEDIATE_DIR)/typeddata_gen.cc', - 'typeddata_patch_cc_file': '<(SHARED_INTERMEDIATE_DIR)/typeddata_patch_gen.cc', - 'uri_cc_file': '<(SHARED_INTERMEDIATE_DIR)/uri_gen.cc', - 'utf_cc_file': '<(SHARED_INTERMEDIATE_DIR)/utf_gen.cc', - 'snapshot_test_dat_file': '<(SHARED_INTERMEDIATE_DIR)/snapshot_test.dat', + 'async_cc_file': '<(gen_source_dir)/async_gen.cc', + 'async_patch_cc_file': '<(gen_source_dir)/async_patch_gen.cc', + 'corelib_cc_file': '<(gen_source_dir)/corelib_gen.cc', + 'corelib_patch_cc_file': '<(gen_source_dir)/corelib_patch_gen.cc', + 'collection_cc_file': '<(gen_source_dir)/collection_gen.cc', + 'collection_patch_cc_file': '<(gen_source_dir)/collection_patch_gen.cc', + 'collection_dev_cc_file': '<(gen_source_dir)/collection_dev_gen.cc', + 'collection_dev_patch_cc_file': '<(gen_source_dir)/collection_dev_patch_gen.cc', + 'crypto_cc_file': '<(gen_source_dir)/crypto_gen.cc', + 'math_cc_file': '<(gen_source_dir)/math_gen.cc', + 'math_patch_cc_file': '<(gen_source_dir)/math_patch_gen.cc', + 'mirrors_cc_file': '<(gen_source_dir)/mirrors_gen.cc', + 'mirrors_patch_cc_file': '<(gen_source_dir)/mirrors_patch_gen.cc', + 'isolate_cc_file': '<(gen_source_dir)/isolate_gen.cc', + 'isolate_patch_cc_file': '<(gen_source_dir)/isolate_patch_gen.cc', + 'json_cc_file': '<(gen_source_dir)/json_gen.cc', + 'json_patch_cc_file': '<(gen_source_dir)/json_patch_gen.cc', + 'typeddata_cc_file': '<(gen_source_dir)/typeddata_gen.cc', + 'typeddata_patch_cc_file': '<(gen_source_dir)/typeddata_patch_gen.cc', + 'uri_cc_file': '<(gen_source_dir)/uri_gen.cc', + 'utf_cc_file': '<(gen_source_dir)/utf_gen.cc', + 'snapshot_test_dat_file': '<(gen_source_dir)/snapshot_test.dat', 'snapshot_test_in_dat_file': 'snapshot_test_in.dat', 'snapshot_test_dart_file': 'snapshot_test.dart', }, @@ -34,6 +35,7 @@ { 'target_name': 'libdart_vm', 'type': 'static_library', + 'toolsets':['host', 'target'], 'includes': [ 'vm_sources.gypi', '../platform/platform_headers.gypi', @@ -91,6 +93,7 @@ { 'target_name': 'libdart_lib_withcore', 'type': 'static_library', + 'toolsets':['host', 'target'], 'dependencies': [ 'generate_async_cc_file', 'generate_async_patch_cc_file', @@ -155,6 +158,7 @@ { 'target_name': 'libdart_lib', 'type': 'static_library', + 'toolsets':['host', 'target'], 'includes': [ '../lib/async_sources.gypi', '../lib/collection_sources.gypi', @@ -174,8 +178,9 @@ { 'target_name': 'generate_async_cc_file', 'type': 'none', + 'toolsets':['host', 'target'], 'variables': { - 'async_dart': '<(SHARED_INTERMEDIATE_DIR)/async_gen.dart', + 'async_dart': '<(gen_source_dir)/async_gen.dart', }, 'includes': [ '../../sdk/lib/async/async_sources.gypi', @@ -230,8 +235,9 @@ { 'target_name': 'generate_corelib_cc_file', 'type': 'none', + 'toolsets':['host', 'target'], 'variables': { - 'core_dart': '<(SHARED_INTERMEDIATE_DIR)/core_gen.dart', + 'core_dart': '<(gen_source_dir)/core_gen.dart', },'includes': [ # Load the shared core library sources. '../../sdk/lib/core/corelib_sources.gypi', @@ -286,6 +292,7 @@ { 'target_name': 'generate_corelib_patch_cc_file', 'type': 'none', + 'toolsets':['host', 'target'], 'includes': [ # Load the runtime implementation sources. '../lib/lib_sources.gypi', @@ -324,8 +331,9 @@ { 'target_name': 'generate_collection_cc_file', 'type': 'none', + 'toolsets':['host', 'target'], 'variables': { - 'collection_dart': '<(SHARED_INTERMEDIATE_DIR)/collection_gen.dart', + 'collection_dart': '<(gen_source_dir)/collection_gen.dart', }, 'includes': [ # Load the shared collection library sources. @@ -381,6 +389,7 @@ { 'target_name': 'generate_collection_dev_patch_cc_file', 'type': 'none', + 'toolsets':['host', 'target'], 'includes': [ # Load the runtime implementation sources. '../lib/collection_dev_sources.gypi', @@ -419,8 +428,9 @@ { 'target_name': 'generate_collection_dev_cc_file', 'type': 'none', + 'toolsets':['host', 'target'], 'variables': { - 'collection_dev_dart': '<(SHARED_INTERMEDIATE_DIR)/collection_dev_gen.dart', + 'collection_dev_dart': '<(gen_source_dir)/collection_dev_gen.dart', }, 'includes': [ # Load the shared collection_dev library sources. @@ -476,8 +486,9 @@ { 'target_name': 'generate_crypto_cc_file', 'type': 'none', + 'toolsets':['host', 'target'], 'variables': { - 'crypto_dart': '<(SHARED_INTERMEDIATE_DIR)/crypto_gen.dart', + 'crypto_dart': '<(gen_source_dir)/crypto_gen.dart', }, 'includes': [ # Load the shared crypto sources. @@ -526,8 +537,9 @@ { 'target_name': 'generate_math_cc_file', 'type': 'none', + 'toolsets':['host', 'target'], 'variables': { - 'math_dart': '<(SHARED_INTERMEDIATE_DIR)/math_gen.dart', + 'math_dart': '<(gen_source_dir)/math_gen.dart', }, 'includes': [ # Load the shared math library sources. @@ -583,6 +595,7 @@ { 'target_name': 'generate_math_patch_cc_file', 'type': 'none', + 'toolsets':['host', 'target'], 'includes': [ # Load the shared math library sources. '../lib/math_sources.gypi', @@ -621,8 +634,9 @@ { 'target_name': 'generate_mirrors_cc_file', 'type': 'none', + 'toolsets':['host', 'target'], 'variables': { - 'mirrors_dart': '<(SHARED_INTERMEDIATE_DIR)/mirrors_gen.dart', + 'mirrors_dart': '<(gen_source_dir)/mirrors_gen.dart', }, 'includes': [ # Load the shared core library sources. @@ -678,6 +692,7 @@ { 'target_name': 'generate_mirrors_patch_cc_file', 'type': 'none', + 'toolsets':['host', 'target'], 'includes': [ # Load the patch sources. '../lib/mirrors_sources.gypi', @@ -716,8 +731,9 @@ { 'target_name': 'generate_isolate_cc_file', 'type': 'none', + 'toolsets':['host', 'target'], 'variables': { - 'isolate_dart': '<(SHARED_INTERMEDIATE_DIR)/isolate_gen.dart', + 'isolate_dart': '<(gen_source_dir)/isolate_gen.dart', }, 'includes': [ # Load the runtime implementation sources. @@ -773,6 +789,7 @@ { 'target_name': 'generate_async_patch_cc_file', 'type': 'none', + 'toolsets':['host', 'target'], 'includes': [ # Load the runtime implementation sources. '../lib/async_sources.gypi', @@ -811,6 +828,7 @@ { 'target_name': 'generate_collection_patch_cc_file', 'type': 'none', + 'toolsets':['host', 'target'], 'includes': [ # Load the runtime implementation sources. '../lib/collection_sources.gypi', @@ -849,6 +867,7 @@ { 'target_name': 'generate_isolate_patch_cc_file', 'type': 'none', + 'toolsets':['host', 'target'], 'includes': [ # Load the runtime implementation sources. '../lib/isolate_sources.gypi', @@ -887,8 +906,9 @@ { 'target_name': 'generate_json_cc_file', 'type': 'none', + 'toolsets':['host', 'target'], 'variables': { - 'json_dart': '<(SHARED_INTERMEDIATE_DIR)/json_gen.dart', + 'json_dart': '<(gen_source_dir)/json_gen.dart', }, 'includes': [ # Load the shared json sources. @@ -937,6 +957,7 @@ { 'target_name': 'generate_json_patch_cc_file', 'type': 'none', + 'toolsets':['host', 'target'], 'includes': [ # Load the shared json library sources. '../lib/json_sources.gypi', @@ -975,8 +996,9 @@ { 'target_name': 'generate_typeddata_cc_file', 'type': 'none', + 'toolsets':['host', 'target'], 'variables': { - 'typeddata_dart': '<(SHARED_INTERMEDIATE_DIR)/typeddata_gen.dart', + 'typeddata_dart': '<(gen_source_dir)/typeddata_gen.dart', }, 'includes': [ # Load the shared library sources. @@ -1032,6 +1054,7 @@ { 'target_name': 'generate_typeddata_patch_cc_file', 'type': 'none', + 'toolsets':['host', 'target'], 'includes': [ # Load the runtime implementation sources. '../lib/typeddata_sources.gypi', @@ -1070,8 +1093,9 @@ { 'target_name': 'generate_uri_cc_file', 'type': 'none', + 'toolsets':['host', 'target'], 'variables': { - 'uri_dart': '<(SHARED_INTERMEDIATE_DIR)/uri_gen.dart', + 'uri_dart': '<(gen_source_dir)/uri_gen.dart', }, 'includes': [ # Load the shared uri sources. @@ -1120,8 +1144,9 @@ { 'target_name': 'generate_utf_cc_file', 'type': 'none', + 'toolsets':['host', 'target'], 'variables': { - 'utf_dart': '<(SHARED_INTERMEDIATE_DIR)/utf_gen.dart', + 'utf_dart': '<(gen_source_dir)/utf_gen.dart', }, 'includes': [ # Load the shared utf sources. @@ -1170,6 +1195,7 @@ { 'target_name': 'generate_snapshot_test_dat_file', 'type': 'none', + 'toolsets':['host', 'target'], 'actions': [ { 'action_name': 'generate_snapshot_test_dat', diff --git a/tools/build.py b/tools/build.py index 2ee32d6aad1..2426699449a 100755 --- a/tools/build.py +++ b/tools/build.py @@ -15,11 +15,23 @@ import utils HOST_OS = utils.GuessOS() HOST_CPUS = utils.GuessCpus() -armcompilerlocation = '/opt/codesourcery/arm-2009q1' SCRIPT_DIR = os.path.dirname(sys.argv[0]) DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..')) THIRD_PARTY_ROOT = os.path.join(DART_ROOT, 'third_party') +arm_cc_error = """ +Couldn't find the arm cross compiler. +To make sure that you have the arm cross compilation tools installed, run: + +$ wget http://src.chromium.org/chrome/trunk/src/build/install-build-deps.sh +OR +$ svn co http://src.chromium.org/chrome/trunk/src/build; cd build +Then, +$ chmod u+x install-build-deps.sh +$ ./install-build-deps.sh --arm --no-chromeos-fonts +""" +DEFAULT_ARM_CROSS_COMPILER_PATH = '/usr' + def BuildOptions(): result = optparse.OptionParser() result.add_option("-m", "--mode", @@ -107,14 +119,14 @@ def ProcessOptions(options, args): def SetTools(arch, toolchainprefix): toolsOverride = None if arch == 'arm' and toolchainprefix == None: - toolchainprefix = armcompilerlocation + "/bin/arm-none-linux-gnueabi" + toolchainprefix = DEFAULT_ARM_CROSS_COMPILER_PATH + "/bin/arm-linux-gnueabi" if toolchainprefix: toolsOverride = { - "CC" : toolchainprefix + "-gcc", - "CXX" : toolchainprefix + "-g++", - "AR" : toolchainprefix + "-ar", - "LINK": toolchainprefix + "-g++", - "NM" : toolchainprefix + "-nm", + "CC.target" : toolchainprefix + "-gcc", + "CXX.target" : toolchainprefix + "-g++", + "AR.target" : toolchainprefix + "-ar", + "LINK.target": toolchainprefix + "-g++", + "NM.target" : toolchainprefix + "-nm", } return toolsOverride @@ -413,6 +425,13 @@ def Main(): args.append( k + "=" + v) if printToolOverrides: print k + " = " + v + if not os.path.isfile(toolsOverride['CC.target']): + if arch == 'arm': + print arm_cc_error + else: + print "Couldn't find compiler: %s" % toolsOverride['CC.target'] + return 1 + print ' '.join(args) process = None diff --git a/tools/gyp/configurations_make.gypi b/tools/gyp/configurations_make.gypi index b13dabd4672..a2b9e8a391c 100644 --- a/tools/gyp/configurations_make.gypi +++ b/tools/gyp/configurations_make.gypi @@ -46,12 +46,21 @@ }, 'Dart_arm_Base': { - 'cflags': [ - '-march=armv7-a', - '-mfpu=vfp', - '-mfloat-abi=softfp', - '-fno-strict-overflow', - ], + 'target_conditions': [ + ['_toolset=="target"', { + 'cflags': [ + '-marm', + '-march=armv7-a', + '-mfpu=vfp', + '-mfloat-abi=softfp', + '-Wno-psabi', # suppresses va_list warning + '-fno-strict-overflow', + ], + }], + ['_toolset=="host"', { + 'cflags': ['-m32', '-msse2'], + 'ldflags': ['-m32'], + }]] }, 'Dart_simmips_Base': {