| OLD | NEW |
| 1 # Copyright (c) 2014 The Native Client Authors. All rights reserved. | 1 # Copyright (c) 2014 The Native Client Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 # We use a special toolchain to build nacl_helper_bootstrap. This | 5 # We use a special toolchain to build nacl_helper_bootstrap. This |
| 6 # seems a bit excessive for compiling one source file. But it is | 6 # seems a bit excessive for compiling one source file. But it is |
| 7 # the most reasonable way to instantiate the configs with different | 7 # the most reasonable way to instantiate the configs with different |
| 8 # settings such as use_gold=false. The minimal set of configs used | 8 # settings such as use_gold=false. The minimal set of configs used |
| 9 # for that file (see below) will sometimes try to use the switch | 9 # for that file (see below) will sometimes try to use the switch |
| 10 # -gsplit-dwarf under use_gold=true. But without some other configs | 10 # -gsplit-dwarf under use_gold=true. But without some other configs |
| 11 # that add a -B option pointing at a custom-built binutils, on some | 11 # that add a -B option pointing at a custom-built binutils, on some |
| 12 # builders (e.g. on older bots) Clang will fail with -gsplit-dwarf. | 12 # builders (e.g. on older bots) Clang will fail with -gsplit-dwarf. |
| 13 # Fortunately, -gsplit-dwarf is pointless for this build anyway | 13 # Fortunately, -gsplit-dwarf is pointless for this build anyway |
| 14 # since there is just one small file. And we're not actually using | 14 # since there is just one small file. And we're not actually using |
| 15 # Gold for the link, so use_gold=true is a false statement and might | 15 # Gold for the link, so use_gold=true is a false statement and might |
| 16 # cause other problems. | 16 # cause other problems. |
| 17 | 17 |
| 18 here = get_label_info(".", "dir") | 18 # TODO(dpranke): There needs to be a better way to determine if |
| 19 bootstrap_toolchain = here + "/toolchain:nacl_bootstrap_" + target_cpu | 19 # we are using the custom CrOS toolchains, but for now we check is_clang, |
| 20 # which is the same way we check in //build/config/BUILDCONFIG.gn. |
| 21 _is_cros_target_toolchain = is_chromeos && !is_clang |
| 22 if (target_os == "chromeos") { |
| 23 import("//build/toolchain/cros_toolchain.gni") |
| 24 } |
| 25 |
| 26 if (_is_cros_target_toolchain) { |
| 27 bootstrap_toolchain = "//build/toolchain/cros:nacl_bootstrap" |
| 28 } else { |
| 29 here = get_label_info(".", "dir") |
| 30 bootstrap_toolchain = here + "/toolchain:nacl_bootstrap_" + target_cpu |
| 31 } |
| 20 | 32 |
| 21 if (current_toolchain == bootstrap_toolchain) { | 33 if (current_toolchain == bootstrap_toolchain) { |
| 22 bootstrap_lib_path = "$target_out_dir/libnacl_bootstrap_lib.a" | 34 bootstrap_lib_path = "$target_out_dir/libnacl_bootstrap_lib.a" |
| 23 bootstrap_raw_path = "$target_out_dir/nacl_bootstrap_raw" | 35 bootstrap_raw_path = "$target_out_dir/nacl_bootstrap_raw" |
| 24 bootstrap_exe_path = "$root_out_dir/nacl_helper_bootstrap" | 36 bootstrap_exe_path = "$root_out_dir/nacl_helper_bootstrap" |
| 25 | 37 |
| 26 linker_script_path = rebase_path("nacl_bootstrap.x") | 38 linker_script_path = rebase_path("nacl_bootstrap.x") |
| 27 | 39 |
| 28 if (current_cpu == "x64") { | 40 if (current_cpu == "x64") { |
| 29 nacl_reserve_top = "0x0" | 41 nacl_reserve_top = "0x0" |
| 30 linker_emulation = "elf_x86_64" | 42 linker_emulation = "elf_x86_64" |
| 31 } | 43 } |
| 32 if (current_cpu == "x86") { | 44 if (current_cpu == "x86") { |
| 33 nacl_reserve_top = "0x40000000" | 45 nacl_reserve_top = "0x40000000" |
| 34 linker_emulation = "elf_i386" | 46 linker_emulation = "elf_i386" |
| 35 } | 47 } |
| 36 if (current_cpu == "arm") { | 48 if (current_cpu == "arm") { |
| 37 nacl_reserve_top = "0x40002000" | 49 nacl_reserve_top = "0x40002000" |
| 38 linker_emulation = "armelf_linux_eabi" | 50 linker_emulation = "armelf_linux_eabi" |
| 39 } | 51 } |
| 40 if (current_cpu == "mipsel") { | 52 if (current_cpu == "mipsel") { |
| 41 nacl_reserve_top = "0x40008000" | 53 nacl_reserve_top = "0x40008000" |
| 42 linker_emulation = "elf32ltsmip" | 54 linker_emulation = "elf32ltsmip" |
| 43 } | 55 } |
| 44 | 56 |
| 45 if (is_android) { | 57 if (_is_cros_target_toolchain) { |
| 58 compiler = cros_target_cxx |
| 59 } else if (is_android) { |
| 46 compiler = "g++" | 60 compiler = "g++" |
| 47 } else if (current_cpu == "arm") { | 61 } else if (current_cpu == "arm") { |
| 48 compiler = "arm-linux-gnueabihf-g++" | 62 compiler = "arm-linux-gnueabihf-g++" |
| 49 } else { | 63 } else { |
| 50 compiler = "g++" | 64 compiler = "g++" |
| 51 } | 65 } |
| 52 | 66 |
| 53 if (target_os == "chromeos" && defined(cros_target_cxx) && | |
| 54 cros_target_cxx != "") { | |
| 55 compiler = cros_target_cxx | |
| 56 } | |
| 57 | |
| 58 static_library("nacl_bootstrap_lib") { | 67 static_library("nacl_bootstrap_lib") { |
| 59 # This code has very specific requirements related to its static | 68 # This code has very specific requirements related to its static |
| 60 # linking and minimal libc use. It cannot support the normal variety | 69 # linking and minimal libc use. It cannot support the normal variety |
| 61 # of build configs that the rest of the code is built with. So it | 70 # of build configs that the rest of the code is built with. So it |
| 62 # resets the list of configsto empty, and then builds up from scratch | 71 # resets the list of configsto empty, and then builds up from scratch |
| 63 # using only the basics that work here. | 72 # using only the basics that work here. |
| 64 configs = [] | 73 configs = [] |
| 65 configs += [ | 74 configs += [ |
| 66 "//build/config/compiler:compiler_cpu_abi", | 75 "//build/config/compiler:compiler_cpu_abi", |
| 67 "//build/config/compiler:runtime_library", | 76 "//build/config/compiler:runtime_library", |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 copy("bootstrap") { | 169 copy("bootstrap") { |
| 161 bootstrap = ":munge_nacl_helper_bootstrap($bootstrap_toolchain)" | 170 bootstrap = ":munge_nacl_helper_bootstrap($bootstrap_toolchain)" |
| 162 | 171 |
| 163 bootstrap_out_dir = get_label_info(bootstrap, "root_out_dir") | 172 bootstrap_out_dir = get_label_info(bootstrap, "root_out_dir") |
| 164 | 173 |
| 165 deps = [ bootstrap ] | 174 deps = [ bootstrap ] |
| 166 sources = [ "$bootstrap_out_dir/nacl_helper_bootstrap" ] | 175 sources = [ "$bootstrap_out_dir/nacl_helper_bootstrap" ] |
| 167 outputs = [ "$root_out_dir/nacl_helper_bootstrap" ] | 176 outputs = [ "$root_out_dir/nacl_helper_bootstrap" ] |
| 168 } | 177 } |
| 169 } | 178 } |
| OLD | NEW |