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 # TODO(dpranke): There needs to be a better way to determine if | 18 here = get_label_info(".", "dir") |
19 # we are using the custom CrOS toolchains, but for now we check is_clang, | 19 bootstrap_toolchain = here + "/toolchain:nacl_bootstrap_" + target_cpu |
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 } | |
32 | 20 |
33 if (current_toolchain == bootstrap_toolchain) { | 21 if (current_toolchain == bootstrap_toolchain) { |
34 bootstrap_lib_path = "$target_out_dir/libnacl_bootstrap_lib.a" | 22 bootstrap_lib_path = "$target_out_dir/libnacl_bootstrap_lib.a" |
35 bootstrap_raw_path = "$target_out_dir/nacl_bootstrap_raw" | 23 bootstrap_raw_path = "$target_out_dir/nacl_bootstrap_raw" |
36 bootstrap_exe_path = "$root_out_dir/nacl_helper_bootstrap" | 24 bootstrap_exe_path = "$root_out_dir/nacl_helper_bootstrap" |
37 | 25 |
38 linker_script_path = rebase_path("nacl_bootstrap.x") | 26 linker_script_path = rebase_path("nacl_bootstrap.x") |
39 | 27 |
40 if (current_cpu == "x64") { | 28 if (current_cpu == "x64") { |
41 nacl_reserve_top = "0x0" | 29 nacl_reserve_top = "0x0" |
42 linker_emulation = "elf_x86_64" | 30 linker_emulation = "elf_x86_64" |
43 } | 31 } |
44 if (current_cpu == "x86") { | 32 if (current_cpu == "x86") { |
45 nacl_reserve_top = "0x40000000" | 33 nacl_reserve_top = "0x40000000" |
46 linker_emulation = "elf_i386" | 34 linker_emulation = "elf_i386" |
47 } | 35 } |
48 if (current_cpu == "arm") { | 36 if (current_cpu == "arm") { |
49 nacl_reserve_top = "0x40002000" | 37 nacl_reserve_top = "0x40002000" |
50 linker_emulation = "armelf_linux_eabi" | 38 linker_emulation = "armelf_linux_eabi" |
51 } | 39 } |
52 if (current_cpu == "mipsel") { | 40 if (current_cpu == "mipsel") { |
53 nacl_reserve_top = "0x40008000" | 41 nacl_reserve_top = "0x40008000" |
54 linker_emulation = "elf32ltsmip" | 42 linker_emulation = "elf32ltsmip" |
55 } | 43 } |
56 | 44 |
57 if (_is_cros_target_toolchain) { | 45 if (is_android) { |
58 compiler = cros_target_cxx | |
59 } else if (is_android) { | |
60 compiler = "g++" | 46 compiler = "g++" |
61 } else if (current_cpu == "arm") { | 47 } else if (current_cpu == "arm") { |
62 compiler = "arm-linux-gnueabihf-g++" | 48 compiler = "arm-linux-gnueabihf-g++" |
63 } else { | 49 } else { |
64 compiler = "g++" | 50 compiler = "g++" |
65 } | 51 } |
66 | 52 |
| 53 if (target_os == "chromeos" && defined(cros_target_cxx) && |
| 54 cros_target_cxx != "") { |
| 55 compiler = cros_target_cxx |
| 56 } |
| 57 |
67 static_library("nacl_bootstrap_lib") { | 58 static_library("nacl_bootstrap_lib") { |
68 # This code has very specific requirements related to its static | 59 # This code has very specific requirements related to its static |
69 # linking and minimal libc use. It cannot support the normal variety | 60 # linking and minimal libc use. It cannot support the normal variety |
70 # of build configs that the rest of the code is built with. So it | 61 # of build configs that the rest of the code is built with. So it |
71 # resets the list of configsto empty, and then builds up from scratch | 62 # resets the list of configsto empty, and then builds up from scratch |
72 # using only the basics that work here. | 63 # using only the basics that work here. |
73 configs = [] | 64 configs = [] |
74 configs += [ | 65 configs += [ |
75 "//build/config/compiler:compiler_cpu_abi", | 66 "//build/config/compiler:compiler_cpu_abi", |
76 "//build/config/compiler:runtime_library", | 67 "//build/config/compiler:runtime_library", |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 copy("bootstrap") { | 160 copy("bootstrap") { |
170 bootstrap = ":munge_nacl_helper_bootstrap($bootstrap_toolchain)" | 161 bootstrap = ":munge_nacl_helper_bootstrap($bootstrap_toolchain)" |
171 | 162 |
172 bootstrap_out_dir = get_label_info(bootstrap, "root_out_dir") | 163 bootstrap_out_dir = get_label_info(bootstrap, "root_out_dir") |
173 | 164 |
174 deps = [ bootstrap ] | 165 deps = [ bootstrap ] |
175 sources = [ "$bootstrap_out_dir/nacl_helper_bootstrap" ] | 166 sources = [ "$bootstrap_out_dir/nacl_helper_bootstrap" ] |
176 outputs = [ "$root_out_dir/nacl_helper_bootstrap" ] | 167 outputs = [ "$root_out_dir/nacl_helper_bootstrap" ] |
177 } | 168 } |
178 } | 169 } |
OLD | NEW |