blob: e1cd791490ae0dd2f8accfc7812b3812c2a1b127 [file] [log] [blame]
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001# Copyright 2013 the V8 project authors. All rights reserved.
2# Redistribution and use in source and binary forms, with or without
3# modification, are permitted provided that the following conditions are
4# met:
5#
6# * Redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer.
8# * Redistributions in binary form must reproduce the above
9# copyright notice, this list of conditions and the following
10# disclaimer in the documentation and/or other materials provided
11# with the distribution.
12# * Neither the name of Google Inc. nor the names of its
13# contributors may be used to endorse or promote products derived
14# from this software without specific prior written permission.
15#
16# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28# Shared definitions for all V8-related targets.
29
30{
31 'variables': {
32 'msvs_use_common_release': 0,
Ben Murdochb8a8cc12014-11-26 15:28:44 +000033 'clang%': 0,
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000034 'asan%': 0,
35 'lsan%': 0,
36 'msan%': 0,
37 'tsan%': 0,
38 'ubsan%': 0,
39 'ubsan_vptr%': 0,
Ben Murdochb8a8cc12014-11-26 15:28:44 +000040 'v8_target_arch%': '<(target_arch)',
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000041 'v8_host_byteorder%': '<!(python -c "import sys; print sys.byteorder")',
Ben Murdochb8a8cc12014-11-26 15:28:44 +000042 # Native Client builds currently use the V8 ARM JIT and
43 # arm/simulator-arm.cc to defer the significant effort required
44 # for NaCl JIT support. The nacl_target_arch variable provides
45 # the 'true' target arch for places in this file that need it.
46 # TODO(bradchen): get rid of nacl_target_arch when someday
47 # NaCl V8 builds stop using the ARM simulator
48 'nacl_target_arch%': 'none', # must be set externally
49
50 # Setting 'v8_can_use_vfp32dregs' to 'true' will cause V8 to use the VFP
51 # registers d16-d31 in the generated code, both in the snapshot and for the
52 # ARM target. Leaving the default value of 'false' will avoid the use of
53 # these registers in the snapshot and use CPU feature probing when running
54 # on the target.
55 'v8_can_use_vfp32dregs%': 'false',
56 'arm_test_noprobe%': 'off',
57
58 # Similar to vfp but on MIPS.
59 'v8_can_use_fpu_instructions%': 'true',
60
61 # Similar to the ARM hard float ABI but on MIPS.
62 'v8_use_mips_abi_hardfloat%': 'true',
63
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000064 # Force disable libstdc++ debug mode.
65 'disable_glibcxx_debug%': 0,
66
Ben Murdochb8a8cc12014-11-26 15:28:44 +000067 'v8_enable_backtrace%': 0,
68
69 # Enable profiling support. Only required on Windows.
70 'v8_enable_prof%': 0,
71
72 # Some versions of GCC 4.5 seem to need -fno-strict-aliasing.
73 'v8_no_strict_aliasing%': 0,
74
75 # Chrome needs this definition unconditionally. For standalone V8 builds,
76 # it's handled in build/standalone.gypi.
77 'want_separate_host_toolset%': 1,
78
79 # Toolset the d8 binary should be compiled for. Possible values are 'host'
80 # and 'target'. If you want to run v8 tests, it needs to be set to 'target'.
81 # The setting is ignored if want_separate_host_toolset is 0.
82 'v8_toolset_for_d8%': 'target',
83
84 'host_os%': '<(OS)',
85 'werror%': '-Werror',
86 # For a shared library build, results in "libv8-<(soname_version).so".
87 'soname_version%': '',
88
89 # Allow to suppress the array bounds warning (default is no suppression).
90 'wno_array_bounds%': '',
91
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000092 # Override where to find binutils
93 'binutils_dir%': '',
94
95 'conditions': [
96 ['OS=="linux" and host_arch=="x64"', {
97 'binutils_dir%': 'third_party/binutils/Linux_x64/Release/bin',
98 }],
99 ['OS=="linux" and host_arch=="ia32"', {
100 'binutils_dir%': 'third_party/binutils/Linux_ia32/Release/bin',
101 }],
102
103 # linux_use_bundled_gold: whether to use the gold linker binary checked
104 # into third_party/binutils. Force this off via GYP_DEFINES when you
105 # are using a custom toolchain and need to control -B in ldflags.
106 # Do not use 32-bit gold on 32-bit hosts as it runs out address space
107 # for component=static_library builds.
108 ['OS=="linux" and (target_arch=="x64" or target_arch=="arm")', {
109 'linux_use_bundled_gold%': 1,
110 }, {
111 'linux_use_bundled_gold%': 0,
112 }],
113 # linux_use_bundled_binutils: whether to use the binary binutils
114 # checked into third_party/binutils. These are not multi-arch so cannot
115 # be used except on x86 and x86-64 (the only two architectures which
116 # are currently checke in). Force this off via GYP_DEFINES when you
117 # are using a custom toolchain and need to control -B in cflags.
118 ['OS=="linux" and (target_arch=="ia32" or target_arch=="x64")', {
119 'linux_use_bundled_binutils%': 1,
120 }, {
121 'linux_use_bundled_binutils%': 0,
122 }],
123 # linux_use_gold_flags: whether to use build flags that rely on gold.
124 # On by default for x64 Linux.
125 ['OS=="linux" and target_arch=="x64"', {
126 'linux_use_gold_flags%': 1,
127 }, {
128 'linux_use_gold_flags%': 0,
129 }],
130 ],
131
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000132 # Link-Time Optimizations
133 'use_lto%': 0,
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000134 },
135 'conditions': [
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000136 ['host_arch=="ia32" or host_arch=="x64" or \
137 host_arch=="ppc" or host_arch=="ppc64" or \
138 host_arch=="s390" or host_arch=="s390x" or \
139 clang==1', {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000140 'variables': {
141 'host_cxx_is_biarch%': 1,
142 },
143 }, {
144 'variables': {
145 'host_cxx_is_biarch%': 0,
146 },
147 }],
148 ['target_arch=="ia32" or target_arch=="x64" or target_arch=="x87" or \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000149 target_arch=="ppc" or target_arch=="ppc64" or target_arch=="s390" or \
150 target_arch=="s390x" or clang==1', {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000151 'variables': {
152 'target_cxx_is_biarch%': 1,
153 },
154 }, {
155 'variables': {
156 'target_cxx_is_biarch%': 0,
157 },
158 }],
159 ],
160 'target_defaults': {
161 'conditions': [
162 ['v8_target_arch=="arm"', {
163 'defines': [
164 'V8_TARGET_ARCH_ARM',
165 ],
166 'conditions': [
167 [ 'arm_version==7 or arm_version=="default"', {
168 'defines': [
169 'CAN_USE_ARMV7_INSTRUCTIONS',
170 ],
171 }],
172 [ 'arm_fpu=="vfpv3-d16" or arm_fpu=="default"', {
173 'defines': [
174 'CAN_USE_VFP3_INSTRUCTIONS',
175 ],
176 }],
177 [ 'arm_fpu=="vfpv3"', {
178 'defines': [
179 'CAN_USE_VFP3_INSTRUCTIONS',
180 'CAN_USE_VFP32DREGS',
181 ],
182 }],
183 [ 'arm_fpu=="neon"', {
184 'defines': [
185 'CAN_USE_VFP3_INSTRUCTIONS',
186 'CAN_USE_VFP32DREGS',
187 'CAN_USE_NEON',
188 ],
189 }],
190 [ 'arm_test_noprobe=="on"', {
191 'defines': [
192 'ARM_TEST_NO_FEATURE_PROBE',
193 ],
194 }],
195 ],
196 'target_conditions': [
197 ['_toolset=="host"', {
198 'conditions': [
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000199 ['v8_target_arch==host_arch', {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000200 # Host built with an Arm CXX compiler.
201 'conditions': [
202 [ 'arm_version==7', {
203 'cflags': ['-march=armv7-a',],
204 }],
205 [ 'arm_version==7 or arm_version=="default"', {
206 'conditions': [
207 [ 'arm_fpu!="default"', {
208 'cflags': ['-mfpu=<(arm_fpu)',],
209 }],
210 ],
211 }],
212 [ 'arm_float_abi!="default"', {
213 'cflags': ['-mfloat-abi=<(arm_float_abi)',],
214 }],
215 [ 'arm_thumb==1', {
216 'cflags': ['-mthumb',],
217 }],
218 [ 'arm_thumb==0', {
219 'cflags': ['-marm',],
220 }],
221 ],
222 }, {
223 # 'v8_target_arch!=host_arch'
224 # Host not built with an Arm CXX compiler (simulator build).
225 'conditions': [
226 [ 'arm_float_abi=="hard"', {
227 'defines': [
228 'USE_EABI_HARDFLOAT=1',
229 ],
230 }],
231 [ 'arm_float_abi=="softfp" or arm_float_abi=="default"', {
232 'defines': [
233 'USE_EABI_HARDFLOAT=0',
234 ],
235 }],
236 ],
237 }],
238 ],
239 }], # _toolset=="host"
240 ['_toolset=="target"', {
241 'conditions': [
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000242 ['v8_target_arch==target_arch', {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000243 # Target built with an Arm CXX compiler.
244 'conditions': [
245 [ 'arm_version==7', {
246 'cflags': ['-march=armv7-a',],
247 }],
248 [ 'arm_version==7 or arm_version=="default"', {
249 'conditions': [
250 [ 'arm_fpu!="default"', {
251 'cflags': ['-mfpu=<(arm_fpu)',],
252 }],
253 ],
254 }],
255 [ 'arm_float_abi!="default"', {
256 'cflags': ['-mfloat-abi=<(arm_float_abi)',],
257 }],
258 [ 'arm_thumb==1', {
259 'cflags': ['-mthumb',],
260 }],
261 [ 'arm_thumb==0', {
262 'cflags': ['-marm',],
263 }],
264 ],
265 }, {
266 # 'v8_target_arch!=target_arch'
267 # Target not built with an Arm CXX compiler (simulator build).
268 'conditions': [
269 [ 'arm_float_abi=="hard"', {
270 'defines': [
271 'USE_EABI_HARDFLOAT=1',
272 ],
273 }],
274 [ 'arm_float_abi=="softfp" or arm_float_abi=="default"', {
275 'defines': [
276 'USE_EABI_HARDFLOAT=0',
277 ],
278 }],
279 ],
280 }],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000281 # Disable GCC LTO for v8
282 # v8 is optimized for speed. Because GCC LTO merges flags at link
283 # time, we disable LTO to prevent any -O2 flags from taking
284 # precedence over v8's -Os flag. However, LLVM LTO does not work
285 # this way so we keep LTO enabled under LLVM.
286 ['clang==0 and use_lto==1', {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000287 'cflags!': [
288 '-flto',
289 '-ffat-lto-objects',
290 ],
291 }],
292 ],
293 }], # _toolset=="target"
294 ],
295 }], # v8_target_arch=="arm"
296 ['v8_target_arch=="arm64"', {
297 'defines': [
298 'V8_TARGET_ARCH_ARM64',
299 ],
300 }],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000301 ['v8_target_arch=="s390" or v8_target_arch=="s390x"', {
302 'defines': [
303 'V8_TARGET_ARCH_S390',
304 ],
305 'conditions': [
306 ['v8_target_arch=="s390x"', {
307 'defines': [
308 'V8_TARGET_ARCH_S390X',
309 ],
310 }],
311 ['v8_host_byteorder=="little"', {
312 'defines': [
313 'V8_TARGET_ARCH_S390_LE_SIM',
314 ],
315 }],
316 ],
317 }], # s390
318 ['v8_target_arch=="ppc" or v8_target_arch=="ppc64"', {
319 'defines': [
320 'V8_TARGET_ARCH_PPC',
321 ],
322 'conditions': [
323 ['v8_target_arch=="ppc64"', {
324 'defines': [
325 'V8_TARGET_ARCH_PPC64',
326 ],
327 }],
328 ['v8_host_byteorder=="little"', {
329 'defines': [
330 'V8_TARGET_ARCH_PPC_LE',
331 ],
332 }],
333 ['v8_host_byteorder=="big"', {
334 'defines': [
335 'V8_TARGET_ARCH_PPC_BE',
336 ],
337 'conditions': [
338 ['OS=="aix"', {
339 # Work around AIX ceil, trunc and round oddities.
340 'cflags': [ '-mcpu=power5+ -mfprnd' ],
341 }],
342 ['OS=="aix"', {
343 # Work around AIX assembler popcntb bug.
344 'cflags': [ '-mno-popcntb' ],
345 }],
346 ],
347 }],
348 ],
349 }], # ppc
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000350 ['v8_target_arch=="ia32"', {
351 'defines': [
352 'V8_TARGET_ARCH_IA32',
353 ],
354 }], # v8_target_arch=="ia32"
355 ['v8_target_arch=="x87"', {
356 'defines': [
357 'V8_TARGET_ARCH_X87',
358 ],
359 'cflags': ['-march=i586'],
360 }], # v8_target_arch=="x87"
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000361 ['(v8_target_arch=="mips" or v8_target_arch=="mipsel" \
362 or v8_target_arch=="mips64" or v8_target_arch=="mips64el") \
363 and v8_target_arch==target_arch', {
364 'target_conditions': [
365 ['_toolset=="target"', {
366 # Target built with a Mips CXX compiler.
367 'variables': {
368 'ldso_path%': '<!(/bin/echo -n $LDSO_PATH)',
369 'ld_r_path%': '<!(/bin/echo -n $LD_R_PATH)',
370 },
371 'conditions': [
372 ['ldso_path!=""', {
373 'ldflags': ['-Wl,--dynamic-linker=<(ldso_path)'],
374 }],
375 ['ld_r_path!=""', {
376 'ldflags': ['-Wl,--rpath=<(ld_r_path)'],
377 }],
378 [ 'clang==1', {
379 'cflags': ['-integrated-as'],
380 }],
381 ],
382 }],
383 ],
384 }],
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000385 ['v8_target_arch=="mips"', {
386 'defines': [
387 'V8_TARGET_ARCH_MIPS',
388 ],
389 'conditions': [
Paul Lind18a7ebb2014-12-17 22:29:32 -0800390 [ 'v8_can_use_fpu_instructions=="true"', {
391 'defines': [
392 'CAN_USE_FPU_INSTRUCTIONS',
393 ],
394 }],
395 [ 'v8_use_mips_abi_hardfloat=="true"', {
396 'defines': [
397 '__mips_hard_float=1',
398 'CAN_USE_FPU_INSTRUCTIONS',
399 ],
400 }, {
401 'defines': [
402 '__mips_soft_float=1'
403 ]
404 }],
405 ],
406 'target_conditions': [
407 ['_toolset=="target"', {
408 'conditions': [
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000409 ['v8_target_arch==target_arch', {
Paul Lind18a7ebb2014-12-17 22:29:32 -0800410 # Target built with a Mips CXX compiler.
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000411 'cflags': [
412 '-EB',
413 '-Wno-error=array-bounds', # Workaround https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56273
414 ],
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000415 'ldflags': ['-EB'],
416 'conditions': [
417 [ 'v8_use_mips_abi_hardfloat=="true"', {
418 'cflags': ['-mhard-float'],
419 'ldflags': ['-mhard-float'],
420 }, {
421 'cflags': ['-msoft-float'],
422 'ldflags': ['-msoft-float'],
423 }],
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000424 ['mips_arch_variant=="r6"', {
Paul Lind18a7ebb2014-12-17 22:29:32 -0800425 'defines': [
426 '_MIPS_ARCH_MIPS32R6',
427 'FPU_MODE_FP64',
428 ],
429 'cflags!': ['-mfp32', '-mfpxx'],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000430 'conditions': [
431 [ 'clang==0', {
432 'cflags': ['-Wa,-mips32r6'],
433 }],
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000434 ],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000435 'cflags': ['-mips32r6'],
436 'ldflags': ['-mips32r6'],
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000437 }],
438 ['mips_arch_variant=="r2"', {
Paul Lind18a7ebb2014-12-17 22:29:32 -0800439 'conditions': [
440 [ 'mips_fpu_mode=="fp64"', {
441 'defines': [
442 '_MIPS_ARCH_MIPS32R2',
443 'FPU_MODE_FP64',
444 ],
445 'cflags': ['-mfp64'],
446 }],
447 ['mips_fpu_mode=="fpxx"', {
448 'defines': [
449 '_MIPS_ARCH_MIPS32R2',
450 'FPU_MODE_FPXX',
451 ],
452 'cflags': ['-mfpxx'],
453 }],
454 ['mips_fpu_mode=="fp32"', {
455 'defines': [
456 '_MIPS_ARCH_MIPS32R2',
457 'FPU_MODE_FP32',
458 ],
459 'cflags': ['-mfp32'],
460 }],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000461 [ 'clang==0', {
462 'cflags': ['-Wa,-mips32r2'],
463 }],
Paul Lind18a7ebb2014-12-17 22:29:32 -0800464 ],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000465 'cflags': ['-mips32r2'],
Paul Lind18a7ebb2014-12-17 22:29:32 -0800466 'ldflags': ['-mips32r2'],
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000467 }],
468 ['mips_arch_variant=="r1"', {
Paul Lind18a7ebb2014-12-17 22:29:32 -0800469 'defines': [
470 'FPU_MODE_FP32',
471 ],
472 'cflags!': ['-mfp64', '-mfpxx'],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000473 'conditions': [
474 [ 'clang==0', {
475 'cflags': ['-Wa,-mips32'],
476 }],
477 ],
478 'cflags': ['-mips32'],
Paul Lind18a7ebb2014-12-17 22:29:32 -0800479 'ldflags': ['-mips32'],
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000480 }],
481 ['mips_arch_variant=="rx"', {
Paul Lind18a7ebb2014-12-17 22:29:32 -0800482 'defines': [
483 '_MIPS_ARCH_MIPS32RX',
484 'FPU_MODE_FPXX',
485 ],
486 'cflags!': ['-mfp64', '-mfp32'],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000487 'conditions': [
488 [ 'clang==0', {
489 'cflags': ['-Wa,-mips32'],
490 }],
491 ],
492 'cflags': ['-mips32', '-mfpxx'],
Paul Lind18a7ebb2014-12-17 22:29:32 -0800493 'ldflags': ['-mips32'],
494 }],
495 ],
496 }, {
497 # 'v8_target_arch!=target_arch'
498 # Target not built with an MIPS CXX compiler (simulator build).
499 'conditions': [
500 ['mips_arch_variant=="r6"', {
501 'defines': [
502 '_MIPS_ARCH_MIPS32R6',
503 'FPU_MODE_FP64',
504 ],
505 }],
506 ['mips_arch_variant=="r2"', {
507 'conditions': [
508 [ 'mips_fpu_mode=="fp64"', {
509 'defines': [
510 '_MIPS_ARCH_MIPS32R2',
511 'FPU_MODE_FP64',
512 ],
513 }],
514 ['mips_fpu_mode=="fpxx"', {
515 'defines': [
516 '_MIPS_ARCH_MIPS32R2',
517 'FPU_MODE_FPXX',
518 ],
519 }],
520 ['mips_fpu_mode=="fp32"', {
521 'defines': [
522 '_MIPS_ARCH_MIPS32R2',
523 'FPU_MODE_FP32',
524 ],
525 }],
526 ],
527 }],
528 ['mips_arch_variant=="r1"', {
529 'defines': [
530 'FPU_MODE_FP32',
531 ],
532 }],
533 ['mips_arch_variant=="rx"', {
534 'defines': [
535 '_MIPS_ARCH_MIPS32RX',
536 'FPU_MODE_FPXX',
537 ],
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000538 }],
539 ],
540 }],
541 ],
Paul Lind18a7ebb2014-12-17 22:29:32 -0800542 }], #_toolset=="target"
543 ['_toolset=="host"', {
544 'conditions': [
545 ['mips_arch_variant=="rx"', {
546 'defines': [
547 '_MIPS_ARCH_MIPS32RX',
548 'FPU_MODE_FPXX',
549 ],
550 }],
551 ['mips_arch_variant=="r6"', {
552 'defines': [
553 '_MIPS_ARCH_MIPS32R6',
554 'FPU_MODE_FP64',
555 ],
556 }],
557 ['mips_arch_variant=="r2"', {
558 'conditions': [
559 ['mips_fpu_mode=="fp64"', {
560 'defines': [
561 '_MIPS_ARCH_MIPS32R2',
562 'FPU_MODE_FP64',
563 ],
564 }],
565 ['mips_fpu_mode=="fpxx"', {
566 'defines': [
567 '_MIPS_ARCH_MIPS32R2',
568 'FPU_MODE_FPXX',
569 ],
570 }],
571 ['mips_fpu_mode=="fp32"', {
572 'defines': [
573 '_MIPS_ARCH_MIPS32R2',
574 'FPU_MODE_FP32'
575 ],
576 }],
577 ],
578 }],
579 ['mips_arch_variant=="r1"', {
580 'defines': ['FPU_MODE_FP32',],
581 }],
582 ]
583 }], #_toolset=="host"
584 ],
585 }], # v8_target_arch=="mips"
586 ['v8_target_arch=="mipsel"', {
587 'defines': [
588 'V8_TARGET_ARCH_MIPS',
589 ],
590 'conditions': [
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000591 [ 'v8_can_use_fpu_instructions=="true"', {
592 'defines': [
593 'CAN_USE_FPU_INSTRUCTIONS',
594 ],
595 }],
596 [ 'v8_use_mips_abi_hardfloat=="true"', {
597 'defines': [
598 '__mips_hard_float=1',
599 'CAN_USE_FPU_INSTRUCTIONS',
600 ],
601 }, {
602 'defines': [
603 '__mips_soft_float=1'
604 ],
605 }],
Paul Lind18a7ebb2014-12-17 22:29:32 -0800606 ],
607 'target_conditions': [
608 ['_toolset=="target"', {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000609 'conditions': [
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000610 ['v8_target_arch==target_arch', {
Paul Lind18a7ebb2014-12-17 22:29:32 -0800611 # Target built with a Mips CXX compiler.
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000612 'cflags': [
613 '-EL',
614 '-Wno-error=array-bounds', # Workaround https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56273
615 ],
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000616 'ldflags': ['-EL'],
617 'conditions': [
618 [ 'v8_use_mips_abi_hardfloat=="true"', {
619 'cflags': ['-mhard-float'],
620 'ldflags': ['-mhard-float'],
621 }, {
622 'cflags': ['-msoft-float'],
623 'ldflags': ['-msoft-float'],
624 }],
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000625 ['mips_arch_variant=="r6"', {
Paul Lind18a7ebb2014-12-17 22:29:32 -0800626 'defines': [
627 '_MIPS_ARCH_MIPS32R6',
628 'FPU_MODE_FP64',
629 ],
630 'cflags!': ['-mfp32', '-mfpxx'],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000631 'conditions': [
632 [ 'clang==0', {
633 'cflags': ['-Wa,-mips32r6'],
634 }],
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000635 ],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000636 'cflags': ['-mips32r6'],
637 'ldflags': ['-mips32r6'],
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000638 }],
639 ['mips_arch_variant=="r2"', {
Paul Lind18a7ebb2014-12-17 22:29:32 -0800640 'conditions': [
641 [ 'mips_fpu_mode=="fp64"', {
642 'defines': [
643 '_MIPS_ARCH_MIPS32R2',
644 'FPU_MODE_FP64',
645 ],
646 'cflags': ['-mfp64'],
647 }],
648 ['mips_fpu_mode=="fpxx"', {
649 'defines': [
650 '_MIPS_ARCH_MIPS32R2',
651 'FPU_MODE_FPXX',
652 ],
653 'cflags': ['-mfpxx'],
654 }],
655 ['mips_fpu_mode=="fp32"', {
656 'defines': [
657 '_MIPS_ARCH_MIPS32R2',
658 'FPU_MODE_FP32',
659 ],
660 'cflags': ['-mfp32'],
661 }],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000662 [ 'clang==0', {
663 'cflags': ['-Wa,-mips32r2'],
664 }],
Paul Lind18a7ebb2014-12-17 22:29:32 -0800665 ],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000666 'cflags': ['-mips32r2'],
Paul Lind18a7ebb2014-12-17 22:29:32 -0800667 'ldflags': ['-mips32r2'],
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000668 }],
669 ['mips_arch_variant=="r1"', {
Paul Lind18a7ebb2014-12-17 22:29:32 -0800670 'cflags!': ['-mfp64', '-mfpxx'],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000671 'conditions': [
672 [ 'clang==0', {
673 'cflags': ['-Wa,-mips32'],
674 }],
675 ],
676 'cflags': ['-mips32'],
Paul Lind18a7ebb2014-12-17 22:29:32 -0800677 'ldflags': ['-mips32'],
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000678 }],
679 ['mips_arch_variant=="rx"', {
Paul Lind18a7ebb2014-12-17 22:29:32 -0800680 'defines': [
681 '_MIPS_ARCH_MIPS32RX',
682 'FPU_MODE_FPXX',
683 ],
684 'cflags!': ['-mfp64', '-mfp32'],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000685 'conditions': [
686 [ 'clang==0', {
687 'cflags': ['-Wa,-mips32'],
688 }],
689 ],
690 'cflags': ['-mips32', '-mfpxx'],
Paul Lind18a7ebb2014-12-17 22:29:32 -0800691 'ldflags': ['-mips32'],
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000692 }],
693 ['mips_arch_variant=="loongson"', {
Paul Lind18a7ebb2014-12-17 22:29:32 -0800694 'defines': [
695 '_MIPS_ARCH_LOONGSON',
696 'FPU_MODE_FP32',
697 ],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000698 'cflags!': ['-mfp64', '-mfpxx'],
699 'conditions': [
700 [ 'clang==0', {
701 'cflags': ['-Wa,-mips3'],
702 }],
703 ],
704 'cflags': ['-mips3', '-mfp32'],
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000705 }],
706 ],
Paul Lind18a7ebb2014-12-17 22:29:32 -0800707 }, {
708 # 'v8_target_arch!=target_arch'
709 # Target not built with an MIPS CXX compiler (simulator build).
710 'conditions': [
711 ['mips_arch_variant=="r6"', {
712 'defines': [
713 '_MIPS_ARCH_MIPS32R6',
714 'FPU_MODE_FP64',
715 ],
716 }],
717 ['mips_arch_variant=="r2"', {
718 'conditions': [
719 [ 'mips_fpu_mode=="fp64"', {
720 'defines': [
721 '_MIPS_ARCH_MIPS32R2',
722 'FPU_MODE_FP64',
723 ],
724 }],
725 ['mips_fpu_mode=="fpxx"', {
726 'defines': [
727 '_MIPS_ARCH_MIPS32R2',
728 'FPU_MODE_FPXX',
729 ],
730 }],
731 ['mips_fpu_mode=="fp32"', {
732 'defines': [
733 '_MIPS_ARCH_MIPS32R2',
734 'FPU_MODE_FP32',
735 ],
736 }],
737 ],
738 }],
739 ['mips_arch_variant=="r1"', {
740 'defines': [
741 'FPU_MODE_FP32',
742 ],
743 }],
744 ['mips_arch_variant=="rx"', {
745 'defines': [
746 '_MIPS_ARCH_MIPS32RX',
747 'FPU_MODE_FPXX',
748 ],
749 }],
750 ['mips_arch_variant=="loongson"', {
751 'defines': [
752 '_MIPS_ARCH_LOONGSON',
753 'FPU_MODE_FP32',
754 ],
755 }],
756 ],
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000757 }],
758 ],
Paul Lind18a7ebb2014-12-17 22:29:32 -0800759 }], #_toolset=="target
760 ['_toolset=="host"', {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000761 'conditions': [
Paul Lind18a7ebb2014-12-17 22:29:32 -0800762 ['mips_arch_variant=="rx"', {
763 'defines': [
764 '_MIPS_ARCH_MIPS32RX',
765 'FPU_MODE_FPXX',
766 ],
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000767 }],
Paul Lind18a7ebb2014-12-17 22:29:32 -0800768 ['mips_arch_variant=="r6"', {
769 'defines': [
770 '_MIPS_ARCH_MIPS32R6',
771 'FPU_MODE_FP64',
772 ],
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000773 }],
Paul Lind18a7ebb2014-12-17 22:29:32 -0800774 ['mips_arch_variant=="r2"', {
775 'conditions': [
776 ['mips_fpu_mode=="fp64"', {
777 'defines': [
778 '_MIPS_ARCH_MIPS32R2',
779 'FPU_MODE_FP64',
780 ],
781 }],
782 ['mips_fpu_mode=="fpxx"', {
783 'defines': [
784 '_MIPS_ARCH_MIPS32R2',
785 'FPU_MODE_FPXX',
786 ],
787 }],
788 ['mips_fpu_mode=="fp32"', {
789 'defines': [
790 '_MIPS_ARCH_MIPS32R2',
791 'FPU_MODE_FP32'
792 ],
793 }],
794 ],
795 }],
796 ['mips_arch_variant=="r1"', {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000797 'defines': ['FPU_MODE_FP32',],
798 }],
Paul Lind18a7ebb2014-12-17 22:29:32 -0800799 ['mips_arch_variant=="loongson"', {
800 'defines': [
801 '_MIPS_ARCH_LOONGSON',
802 'FPU_MODE_FP32',
803 ],
804 }],
805 ]
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000806 }],
807 ],
808 }], # v8_target_arch=="mipsel"
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000809 ['v8_target_arch=="mips64el" or v8_target_arch=="mips64"', {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000810 'defines': [
811 'V8_TARGET_ARCH_MIPS64',
812 ],
813 'conditions': [
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000814 [ 'v8_can_use_fpu_instructions=="true"', {
815 'defines': [
816 'CAN_USE_FPU_INSTRUCTIONS',
817 ],
818 }],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000819 [ 'v8_host_byteorder=="little"', {
820 'defines': [
821 'V8_TARGET_ARCH_MIPS64_LE',
822 ],
823 }],
824 [ 'v8_host_byteorder=="big"', {
825 'defines': [
826 'V8_TARGET_ARCH_MIPS64_BE',
827 ],
828 }],
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000829 [ 'v8_use_mips_abi_hardfloat=="true"', {
830 'defines': [
831 '__mips_hard_float=1',
832 'CAN_USE_FPU_INSTRUCTIONS',
833 ],
834 }, {
835 'defines': [
836 '__mips_soft_float=1'
837 ],
838 }],
Paul Lind18a7ebb2014-12-17 22:29:32 -0800839 ],
840 'target_conditions': [
841 ['_toolset=="target"', {
842 'conditions': [
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000843 ['v8_target_arch==target_arch', {
844 'cflags': [
845 '-Wno-error=array-bounds', # Workaround https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56273
846 ],
Paul Lind18a7ebb2014-12-17 22:29:32 -0800847 'conditions': [
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000848 ['v8_target_arch=="mips64el"', {
849 'cflags': ['-EL'],
850 'ldflags': ['-EL'],
851 }],
852 ['v8_target_arch=="mips64"', {
853 'cflags': ['-EB'],
854 'ldflags': ['-EB'],
855 }],
Paul Lind18a7ebb2014-12-17 22:29:32 -0800856 [ 'v8_use_mips_abi_hardfloat=="true"', {
857 'cflags': ['-mhard-float'],
858 'ldflags': ['-mhard-float'],
859 }, {
860 'cflags': ['-msoft-float'],
861 'ldflags': ['-msoft-float'],
862 }],
863 ['mips_arch_variant=="r6"', {
864 'defines': ['_MIPS_ARCH_MIPS64R6',],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000865 'conditions': [
866 [ 'clang==0', {
867 'cflags': ['-Wa,-mips64r6'],
868 }],
Paul Lind18a7ebb2014-12-17 22:29:32 -0800869 ],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000870 'cflags': ['-mips64r6', '-mabi=64'],
871 'ldflags': ['-mips64r6', '-mabi=64'],
Paul Lind18a7ebb2014-12-17 22:29:32 -0800872 }],
873 ['mips_arch_variant=="r2"', {
874 'defines': ['_MIPS_ARCH_MIPS64R2',],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000875 'conditions': [
876 [ 'clang==0', {
877 'cflags': ['-Wa,-mips64r2'],
878 }],
Paul Lind18a7ebb2014-12-17 22:29:32 -0800879 ],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000880 'cflags': ['-mips64r2', '-mabi=64'],
881 'ldflags': ['-mips64r2', '-mabi=64'],
Paul Lind18a7ebb2014-12-17 22:29:32 -0800882 }],
883 ],
884 }, {
885 # 'v8_target_arch!=target_arch'
886 # Target not built with an MIPS CXX compiler (simulator build).
887 'conditions': [
888 ['mips_arch_variant=="r6"', {
889 'defines': ['_MIPS_ARCH_MIPS64R6',],
890 }],
891 ['mips_arch_variant=="r2"', {
892 'defines': ['_MIPS_ARCH_MIPS64R2',],
893 }],
894 ],
895 }],
896 ],
897 }], #'_toolset=="target"
898 ['_toolset=="host"', {
899 'conditions': [
900 ['mips_arch_variant=="r6"', {
901 'defines': ['_MIPS_ARCH_MIPS64R6',],
902 }],
903 ['mips_arch_variant=="r2"', {
904 'defines': ['_MIPS_ARCH_MIPS64R2',],
905 }],
906 ],
907 }], #'_toolset=="host"
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000908 ],
909 }], # v8_target_arch=="mips64el"
910 ['v8_target_arch=="x64"', {
911 'defines': [
912 'V8_TARGET_ARCH_X64',
913 ],
914 'xcode_settings': {
915 'ARCHS': [ 'x86_64' ],
916 },
917 'msvs_settings': {
918 'VCLinkerTool': {
919 'StackReserveSize': '2097152',
920 },
921 },
922 'msvs_configuration_platform': 'x64',
923 }], # v8_target_arch=="x64"
924 ['v8_target_arch=="x32"', {
925 'defines': [
926 # x32 port shares the source code with x64 port.
927 'V8_TARGET_ARCH_X64',
928 'V8_TARGET_ARCH_32_BIT',
929 ],
930 'cflags': [
931 '-mx32',
932 # Inhibit warning if long long type is used.
933 '-Wno-long-long',
934 ],
935 'ldflags': [
936 '-mx32',
937 ],
938 }], # v8_target_arch=="x32"
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000939 ['linux_use_gold_flags==1', {
940 # Newer gccs and clangs support -fuse-ld, use the flag to force gold
941 # selection.
942 # gcc -- http://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Optimize-Options.html
943 'ldflags': [ '-fuse-ld=gold', ],
944 }],
945 ['linux_use_bundled_binutils==1', {
946 'cflags': [
947 '-B<!(cd <(DEPTH) && pwd -P)/<(binutils_dir)',
948 ],
949 }],
950 ['linux_use_bundled_gold==1', {
951 # Put our binutils, which contains gold in the search path. We pass
952 # the path to gold to the compiler. gyp leaves unspecified what the
953 # cwd is when running the compiler, so the normal gyp path-munging
954 # fails us. This hack gets the right path.
955 'ldflags': [
956 '-B<!(cd <(DEPTH) && pwd -P)/<(binutils_dir)',
957 ],
958 }],
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000959 ['OS=="win"', {
960 'defines': [
961 'WIN32',
962 ],
963 # 4351: VS 2005 and later are warning us that they've fixed a bug
964 # present in VS 2003 and earlier.
965 'msvs_disabled_warnings': [4351],
966 'msvs_configuration_attributes': {
967 'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)',
968 'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
969 'CharacterSet': '1',
970 },
971 }],
972 ['OS=="win" and v8_target_arch=="ia32"', {
973 'msvs_settings': {
974 'VCCLCompilerTool': {
975 # Ensure no surprising artifacts from 80bit double math with x86.
976 'AdditionalOptions': ['/arch:SSE2'],
977 },
978 },
979 }],
980 ['OS=="win" and v8_enable_prof==1', {
981 'msvs_settings': {
982 'VCLinkerTool': {
983 'GenerateMapFile': 'true',
984 },
985 },
986 }],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +0000987 ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
988 or OS=="netbsd" or OS=="mac" or OS=="android" or OS=="qnx") and \
989 v8_target_arch=="ia32"', {
990 'cflags': [
991 '-msse2',
992 '-mfpmath=sse',
993 '-mmmx', # Allows mmintrin.h for MMX intrinsics.
994 ],
995 }],
996 ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000997 or OS=="netbsd" or OS=="mac" or OS=="android" or OS=="qnx") and \
998 (v8_target_arch=="arm" or v8_target_arch=="ia32" or \
999 v8_target_arch=="x87" or v8_target_arch=="mips" or \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001000 v8_target_arch=="mipsel" or v8_target_arch=="ppc" or \
1001 v8_target_arch=="s390")', {
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001002 'target_conditions': [
1003 ['_toolset=="host"', {
1004 'conditions': [
1005 ['host_cxx_is_biarch==1', {
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001006 'conditions': [
1007 ['host_arch=="s390" or host_arch=="s390x"', {
1008 'cflags': [ '-m31' ],
1009 'ldflags': [ '-m31' ]
1010 },{
1011 'cflags': [ '-m32' ],
1012 'ldflags': [ '-m32' ]
1013 }],
1014 ],
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001015 }],
1016 ],
1017 'xcode_settings': {
1018 'ARCHS': [ 'i386' ],
1019 },
1020 }],
1021 ['_toolset=="target"', {
1022 'conditions': [
1023 ['target_cxx_is_biarch==1 and nacl_target_arch!="nacl_x64"', {
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001024 'conditions': [
1025 ['host_arch=="s390" or host_arch=="s390x"', {
1026 'cflags': [ '-m31' ],
1027 'ldflags': [ '-m31' ]
1028 },{
1029 'cflags': [ '-m32' ],
1030 'ldflags': [ '-m32' ],
1031 }],
1032 ],
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001033 }],
1034 ],
1035 'xcode_settings': {
1036 'ARCHS': [ 'i386' ],
1037 },
1038 }],
1039 ],
1040 }],
1041 ['(OS=="linux" or OS=="android") and \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001042 (v8_target_arch=="x64" or v8_target_arch=="arm64" or \
1043 v8_target_arch=="ppc64" or v8_target_arch=="s390x")', {
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001044 'target_conditions': [
1045 ['_toolset=="host"', {
1046 'conditions': [
1047 ['host_cxx_is_biarch==1', {
1048 'cflags': [ '-m64' ],
1049 'ldflags': [ '-m64' ]
1050 }],
1051 ],
1052 }],
1053 ['_toolset=="target"', {
1054 'conditions': [
1055 ['target_cxx_is_biarch==1', {
1056 'cflags': [ '-m64' ],
1057 'ldflags': [ '-m64' ],
1058 }],
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001059 ]
1060 }],
1061 ],
1062 }],
1063 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001064 or OS=="netbsd" or OS=="qnx" or OS=="aix"', {
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001065 'conditions': [
1066 [ 'v8_no_strict_aliasing==1', {
1067 'cflags': [ '-fno-strict-aliasing' ],
1068 }],
1069 ], # conditions
1070 }],
1071 ['OS=="solaris"', {
1072 'defines': [ '__C99FEATURES__=1' ], # isinf() etc.
1073 }],
1074 ['OS=="freebsd" or OS=="openbsd"', {
1075 'cflags': [ '-I/usr/local/include' ],
1076 }],
1077 ['OS=="netbsd"', {
1078 'cflags': [ '-I/usr/pkg/include' ],
1079 }],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001080 ['OS=="aix"', {
1081 'defines': [
1082 # Support for malloc(0)
1083 '_LINUX_SOURCE_COMPAT=1',
1084 '_ALL_SOURCE=1'],
1085 'conditions': [
1086 [ 'v8_target_arch=="ppc"', {
1087 'ldflags': [ '-Wl,-bmaxdata:0x60000000/dsa' ],
1088 }],
1089 [ 'v8_target_arch=="ppc64"', {
1090 'cflags': [ '-maix64' ],
1091 'ldflags': [ '-maix64' ],
1092 }],
1093 ],
1094 }],
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001095 ], # conditions
1096 'configurations': {
1097 # Abstract configuration for v8_optimized_debug == 0.
1098 'DebugBase0': {
1099 'abstract': 1,
1100 'msvs_settings': {
1101 'VCCLCompilerTool': {
1102 'Optimization': '0',
1103 'conditions': [
1104 ['component=="shared_library"', {
1105 'RuntimeLibrary': '3', # /MDd
1106 }, {
1107 'RuntimeLibrary': '1', # /MTd
1108 }],
1109 ],
1110 },
1111 'VCLinkerTool': {
1112 'LinkIncremental': '2',
1113 },
1114 },
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001115 'variables': {
1116 'v8_enable_slow_dchecks%': 1,
1117 },
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001118 'conditions': [
1119 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001120 OS=="qnx" or OS=="aix"', {
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001121 'cflags!': [
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001122 '-O3',
1123 '-O2',
1124 '-O1',
1125 '-Os',
1126 ],
1127 'cflags': [
1128 '-fdata-sections',
1129 '-ffunction-sections',
1130 ],
1131 }],
1132 ['OS=="mac"', {
1133 'xcode_settings': {
1134 'GCC_OPTIMIZATION_LEVEL': '0', # -O0
1135 },
1136 }],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001137 ['v8_enable_slow_dchecks==1', {
1138 'defines': [
1139 'ENABLE_SLOW_DCHECKS',
1140 ],
1141 }],
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001142 ],
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001143 }, # DebugBase0
1144 # Abstract configuration for v8_optimized_debug == 1.
1145 'DebugBase1': {
1146 'abstract': 1,
1147 'msvs_settings': {
1148 'VCCLCompilerTool': {
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001149 'Optimization': '2',
1150 'InlineFunctionExpansion': '2',
1151 'EnableIntrinsicFunctions': 'true',
1152 'FavorSizeOrSpeed': '0',
1153 'StringPooling': 'true',
1154 'BasicRuntimeChecks': '0',
1155 'conditions': [
1156 ['component=="shared_library"', {
1157 'RuntimeLibrary': '3', #/MDd
1158 }, {
1159 'RuntimeLibrary': '1', #/MTd
1160 }],
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001161 ],
1162 },
1163 'VCLinkerTool': {
1164 'LinkIncremental': '1',
1165 'OptimizeReferences': '2',
1166 'EnableCOMDATFolding': '2',
1167 },
1168 },
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001169 'variables': {
1170 'v8_enable_slow_dchecks%': 0,
1171 },
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001172 'conditions': [
1173 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001174 OS=="qnx" or OS=="aix"', {
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001175 'cflags!': [
1176 '-O0',
1177 '-O1',
1178 '-Os',
1179 ],
1180 'cflags': [
1181 '-fdata-sections',
1182 '-ffunction-sections',
1183 ],
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001184 'conditions': [
1185 # TODO(crbug.com/272548): Avoid -O3 in NaCl
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001186 # Don't use -O3 with sanitizers.
1187 ['nacl_target_arch=="none" and asan==0 and msan==0 and lsan==0 \
1188 and tsan==0 and ubsan==0 and ubsan_vptr==0', {
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001189 'cflags': ['-O3'],
1190 'cflags!': ['-O2'],
1191 }, {
1192 'cflags': ['-O2'],
1193 'cflags!': ['-O3'],
1194 }],
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001195 ],
1196 }],
1197 ['OS=="mac"', {
1198 'xcode_settings': {
1199 'GCC_OPTIMIZATION_LEVEL': '3', # -O3
1200 'GCC_STRICT_ALIASING': 'YES',
1201 },
1202 }],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001203 ['v8_enable_slow_dchecks==1', {
1204 'defines': [
1205 'ENABLE_SLOW_DCHECKS',
1206 ],
1207 }],
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001208 ],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001209 }, # DebugBase1
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001210 # Common settings for the Debug configuration.
1211 'DebugBaseCommon': {
1212 'abstract': 1,
1213 'defines': [
1214 'ENABLE_DISASSEMBLER',
1215 'V8_ENABLE_CHECKS',
1216 'OBJECT_PRINT',
1217 'VERIFY_HEAP',
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001218 'DEBUG',
1219 'TRACE_MAPS'
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001220 ],
1221 'conditions': [
1222 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001223 OS=="qnx" or OS=="aix"', {
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001224 'cflags': [ '-Woverloaded-virtual', '<(wno_array_bounds)', ],
1225 }],
1226 ['OS=="linux" and v8_enable_backtrace==1', {
1227 # Support for backtrace_symbols.
1228 'ldflags': [ '-rdynamic' ],
1229 }],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001230 ['OS=="linux" and disable_glibcxx_debug==0', {
1231 # Enable libstdc++ debugging facilities to help catch problems
1232 # early, see http://crbug.com/65151 .
1233 'defines': ['_GLIBCXX_DEBUG=1',],
1234 }],
1235 ['OS=="aix"', {
1236 'ldflags': [ '-Wl,-bbigtoc' ],
1237 'conditions': [
1238 ['v8_target_arch=="ppc64"', {
1239 'cflags': [ '-maix64 -mcmodel=large' ],
1240 }],
1241 ],
1242 }],
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001243 ['OS=="android"', {
1244 'variables': {
1245 'android_full_debug%': 1,
1246 },
1247 'conditions': [
1248 ['android_full_debug==0', {
1249 # Disable full debug if we want a faster v8 in a debug build.
1250 # TODO(2304): pass DISABLE_DEBUG_ASSERT instead of hiding DEBUG.
1251 'defines!': [
1252 'DEBUG',
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001253 'ENABLE_SLOW_DCHECKS',
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001254 ],
1255 }],
1256 ],
1257 }],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001258 # TODO(pcc): Re-enable in LTO builds once we've fixed the intermittent
1259 # link failures (crbug.com/513074).
1260 ['linux_use_gold_flags==1 and use_lto==0', {
1261 'target_conditions': [
1262 ['_toolset=="target"', {
1263 'ldflags': [
1264 # Experimentation found that using four linking threads
1265 # saved ~20% of link time.
1266 # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/281527606915bb36
1267 # Only apply this to the target linker, since the host
1268 # linker might not be gold, but isn't used much anyway.
1269 '-Wl,--threads',
1270 '-Wl,--thread-count=4',
1271 ],
1272 }],
1273 ],
1274 }],
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001275 ],
1276 }, # DebugBaseCommon
1277 'Debug': {
1278 'inherit_from': ['DebugBaseCommon'],
1279 'conditions': [
1280 ['v8_optimized_debug==0', {
1281 'inherit_from': ['DebugBase0'],
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001282 }, {
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001283 'inherit_from': ['DebugBase1'],
1284 }],
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001285 ],
1286 }, # Debug
1287 'Release': {
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001288 'variables': {
1289 'v8_enable_slow_dchecks%': 0,
1290 },
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001291 'conditions': [
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001292 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" \
1293 or OS=="aix"', {
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001294 'cflags!': [
1295 '-Os',
1296 ],
1297 'cflags': [
1298 '-fdata-sections',
1299 '-ffunction-sections',
1300 '<(wno_array_bounds)',
1301 ],
1302 'conditions': [
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001303 # TODO(crbug.com/272548): Avoid -O3 in NaCl
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001304 # Don't use -O3 with sanitizers.
1305 ['nacl_target_arch=="none" and asan==0 and msan==0 and lsan==0 \
1306 and tsan==0 and ubsan==0 and ubsan_vptr==0', {
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001307 'cflags': ['-O3'],
1308 'cflags!': ['-O2'],
1309 }, {
1310 'cflags': ['-O2'],
1311 'cflags!': ['-O3'],
1312 }],
1313 ],
1314 }],
1315 ['OS=="android"', {
1316 'cflags!': [
1317 '-O3',
1318 '-Os',
1319 ],
1320 'cflags': [
1321 '-fdata-sections',
1322 '-ffunction-sections',
1323 '-O2',
1324 ],
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001325 }],
1326 ['OS=="mac"', {
1327 'xcode_settings': {
1328 'GCC_OPTIMIZATION_LEVEL': '3', # -O3
1329
1330 # -fstrict-aliasing. Mainline gcc
1331 # enables this at -O2 and above,
1332 # but Apple gcc does not unless it
1333 # is specified explicitly.
1334 'GCC_STRICT_ALIASING': 'YES',
1335 },
1336 }], # OS=="mac"
1337 ['OS=="win"', {
1338 'msvs_settings': {
1339 'VCCLCompilerTool': {
1340 'Optimization': '2',
1341 'InlineFunctionExpansion': '2',
1342 'EnableIntrinsicFunctions': 'true',
1343 'FavorSizeOrSpeed': '0',
1344 'StringPooling': 'true',
1345 'conditions': [
1346 ['component=="shared_library"', {
1347 'RuntimeLibrary': '2', #/MD
1348 }, {
1349 'RuntimeLibrary': '0', #/MT
1350 }],
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001351 ],
1352 },
1353 'VCLinkerTool': {
1354 'LinkIncremental': '1',
1355 'OptimizeReferences': '2',
1356 'EnableCOMDATFolding': '2',
1357 },
1358 },
1359 }], # OS=="win"
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001360 ['v8_enable_slow_dchecks==1', {
1361 'defines': [
1362 'ENABLE_SLOW_DCHECKS',
1363 ],
1364 }],
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001365 ], # conditions
1366 }, # Release
1367 }, # configurations
1368 }, # target_defaults
1369}