OLD | NEW |
---|---|
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium 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 # ============================================================================= | 5 # ============================================================================= |
6 # PLATFORM SELECTION | 6 # PLATFORM SELECTION |
7 # ============================================================================= | 7 # ============================================================================= |
8 # | 8 # |
9 # There are two main things to set: "os" and "cpu". The "toolchain" is the name | 9 # There are two main things to set: "os" and "cpu". The "toolchain" is the name |
10 # of the GN thing that encodes combinations of these things. | 10 # of the GN thing that encodes combinations of these things. |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 current_os == "linux" || current_os == "chromeos" | 135 current_os == "linux" || current_os == "chromeos" |
136 | 136 |
137 # Allows the path to a custom target toolchain to be injected as a single | 137 # Allows the path to a custom target toolchain to be injected as a single |
138 # argument, and set as the default toolchain. | 138 # argument, and set as the default toolchain. |
139 custom_toolchain = "" | 139 custom_toolchain = "" |
140 | 140 |
141 # This should not normally be set as a build argument. It's here so that | 141 # This should not normally be set as a build argument. It's here so that |
142 # every toolchain can pass through the "global" value via toolchain_args(). | 142 # every toolchain can pass through the "global" value via toolchain_args(). |
143 host_toolchain = "" | 143 host_toolchain = "" |
144 | 144 |
145 # This arg is used when we want to tell the JIT-code-generating v8 code | |
146 # that we want to have it generate code for an architecture that is different | |
147 # than the architecture that v8 will actually run on, and that we will | |
148 # then run the code under an emulator. For example, we might run v8 | |
149 # on x86, but generate arm code and run that under emulation. | |
150 # | |
151 # This arg is defined here rather than in the v8 project because we want | |
152 # some of the common architecture-specific args (like arm_float_abi or | |
153 # mips_arch_variant) to be set to their defaults either if the current_cpu | |
Michael Achenbach
2016/07/07 07:24:22
nit: For consistency, maybe write either "current_
Dirk Pranke
2016/07/07 17:28:12
Will do (using target_cpu).
| |
154 # applies *or* if the v8_target_cpu applies. | |
155 v8_target_cpu = "" | |
156 | |
157 # Compile for Memory Sanitizer to find uninitialized reads. | |
158 # | |
159 # TODO: This is here so that we can set a good default for v8_target_cpu | |
160 # when running under the sanitizer, but this is something of a layering | |
161 # violation and it would be nice if there was some other way to do this. | |
162 is_msan = false | |
Dirk Pranke
2016/07/07 02:42:00
I don't like this being here, but the only alterna
Michael Achenbach
2016/07/07 07:24:22
I'd find it ok if developers need to specify v8_ta
Dirk Pranke
2016/07/07 17:28:12
Ah, I thought that x64 v8 msan didn't work at all.
brettw
2016/07/07 17:56:21
I have a negative reaction to this since I spent a
Michael Achenbach
2016/07/08 06:57:11
I'm not totally sure if x64 msan would work well w
| |
163 | |
145 # DON'T ADD MORE FLAGS HERE. Read the comment above. | 164 # DON'T ADD MORE FLAGS HERE. Read the comment above. |
146 } | 165 } |
147 | 166 |
167 if (v8_target_cpu == "") { | |
brettw
2016/07/07 17:56:21
I really think we should avoid having V8 stuff in
| |
168 if (is_msan) { | |
169 # Running the V8-generated code on an ARM simulator is a powerful hack that | |
170 # allows the tool to see the memory accesses from JITted code. Without this | |
171 # flag, JS code causes false positive reports from MSan. | |
172 v8_target_cpu = "arm64" | |
173 } else { | |
174 v8_target_cpu = target_cpu | |
175 } | |
176 } | |
177 | |
178 declare_args() { | |
Michael Achenbach
2016/07/07 07:24:22
Curiosity: Is there a semantic difference in havin
Dirk Pranke
2016/07/07 17:28:12
Generically speaking, yes. See crbug.com/542846. T
| |
179 # This argument is declared here so that it can be overridden in | |
180 # toolchains. It should never be explicitly set by the user. | |
michaelbai
2016/07/07 18:41:26
The v8_current_cpu will show up in the result of "
| |
181 v8_current_cpu = v8_target_cpu | |
182 } | |
183 | |
148 assert(!(is_debug && is_official_build), "Can't do official debug builds") | 184 assert(!(is_debug && is_official_build), "Can't do official debug builds") |
149 | 185 |
150 # ============================================================================== | 186 # ============================================================================== |
151 # TOOLCHAIN SETUP | 187 # TOOLCHAIN SETUP |
152 # ============================================================================== | 188 # ============================================================================== |
153 # | 189 # |
154 # Here we set the default toolchain, as well as the variable host_toolchain | 190 # Here we set the default toolchain, as well as the variable host_toolchain |
155 # which will identify the toolchain corresponding to the local system when | 191 # which will identify the toolchain corresponding to the local system when |
156 # doing cross-compiles. When not cross-compiling, this will be the same as the | 192 # doing cross-compiles. When not cross-compiling, this will be the same as the |
157 # default toolchain. | 193 # default toolchain. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
208 assert(host_os == "linux", | 244 assert(host_os == "linux", |
209 "ChromeOS builds are only supported on Linux hosts.") | 245 "ChromeOS builds are only supported on Linux hosts.") |
210 if (is_clang) { | 246 if (is_clang) { |
211 _default_toolchain = "//build/toolchain/cros:clang_target" | 247 _default_toolchain = "//build/toolchain/cros:clang_target" |
212 } else { | 248 } else { |
213 _default_toolchain = "//build/toolchain/cros:target" | 249 _default_toolchain = "//build/toolchain/cros:target" |
214 } | 250 } |
215 } else if (target_os == "ios") { | 251 } else if (target_os == "ios") { |
216 _default_toolchain = "//build/toolchain/mac:ios_clang_$target_cpu" | 252 _default_toolchain = "//build/toolchain/mac:ios_clang_$target_cpu" |
217 } else if (target_os == "linux") { | 253 } else if (target_os == "linux") { |
254 if (v8_current_cpu != current_cpu) { | |
255 _target_cpus = "${target_cpu}_v8_${v8_current_cpu}" | |
256 } else { | |
257 _target_cpus = target_cpu | |
258 } | |
218 if (is_clang) { | 259 if (is_clang) { |
219 _default_toolchain = "//build/toolchain/linux:clang_$target_cpu" | 260 _default_toolchain = "//build/toolchain/linux:clang_${_target_cpus}" |
220 } else { | 261 } else { |
221 _default_toolchain = "//build/toolchain/linux:$target_cpu" | 262 _default_toolchain = "//build/toolchain/linux:${_target_cpus}" |
222 } | 263 } |
223 } else if (target_os == "mac") { | 264 } else if (target_os == "mac") { |
224 assert(host_os == "mac", "Mac cross-compiles are unsupported.") | 265 assert(host_os == "mac", "Mac cross-compiles are unsupported.") |
225 _default_toolchain = host_toolchain | 266 _default_toolchain = host_toolchain |
226 } else if (target_os == "win") { | 267 } else if (target_os == "win") { |
227 # On Windows we use the same toolchain for host and target by default. | 268 # On Windows we use the same toolchain for host and target by default. |
228 assert(target_os == host_os, "Win cross-compiles only work on win hosts.") | 269 assert(target_os == host_os, "Win cross-compiles only work on win hosts.") |
229 if (is_clang) { | 270 if (is_clang) { |
230 _default_toolchain = "//build/toolchain/win:clang_$target_cpu" | 271 _default_toolchain = "//build/toolchain/win:clang_$target_cpu" |
231 } else { | 272 } else { |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
658 forward_variables_from(invoker, "*", [ "visibility" ]) | 699 forward_variables_from(invoker, "*", [ "visibility" ]) |
659 | 700 |
660 # All shared libraries must have the sanitizer deps to properly link in | 701 # All shared libraries must have the sanitizer deps to properly link in |
661 # asan mode (this target will be empty in other cases). | 702 # asan mode (this target will be empty in other cases). |
662 if (!defined(deps)) { | 703 if (!defined(deps)) { |
663 deps = [] | 704 deps = [] |
664 } | 705 } |
665 deps += [ "//build/config/sanitizers:deps" ] | 706 deps += [ "//build/config/sanitizers:deps" ] |
666 } | 707 } |
667 } | 708 } |
OLD | NEW |