deps: update v8 to 4.3.61.21
[platform/upstream/nodejs.git] / deps / v8 / build / toolchain.gypi
1 # 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,
33     'clang%': 0,
34     'asan%': 0,
35     'lsan%': 0,
36     'msan%': 0,
37     'tsan%': 0,
38     'ubsan%': 0,
39     'ubsan_vptr%': 0,
40     'v8_target_arch%': '<(target_arch)',
41     'v8_host_byteorder%': '<!(python -c "import sys; print sys.byteorder")',
42     # 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
64     # Force disable libstdc++ debug mode.
65     'disable_glibcxx_debug%': 0,
66
67     '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
92     # 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
132     # Link-Time Optimizations
133     'use_lto%': 0,
134
135     'variables': {
136       # This is set when building the Android WebView inside the Android build
137       # system, using the 'android' gyp backend.
138       'android_webview_build%': 0,
139     },
140     # Copy it out one scope.
141     'android_webview_build%': '<(android_webview_build)',
142   },
143   'conditions': [
144     ['host_arch=="ia32" or host_arch=="x64" or \
145       host_arch=="ppc" or host_arch=="ppc64" or \
146       clang==1', {
147       'variables': {
148         'host_cxx_is_biarch%': 1,
149        },
150      }, {
151       'variables': {
152         'host_cxx_is_biarch%': 0,
153       },
154     }],
155     ['target_arch=="ia32" or target_arch=="x64" or target_arch=="x87" or \
156       target_arch=="ppc" or target_arch=="ppc64" or \
157       clang==1', {
158       'variables': {
159         'target_cxx_is_biarch%': 1,
160        },
161      }, {
162       'variables': {
163         'target_cxx_is_biarch%': 0,
164       },
165     }],
166   ],
167   'target_defaults': {
168     'conditions': [
169       ['v8_target_arch=="arm"', {
170         'defines': [
171           'V8_TARGET_ARCH_ARM',
172         ],
173         'conditions': [
174           [ 'arm_version==7 or arm_version=="default"', {
175             'defines': [
176               'CAN_USE_ARMV7_INSTRUCTIONS',
177             ],
178           }],
179           [ 'arm_fpu=="vfpv3-d16" or arm_fpu=="default"', {
180             'defines': [
181               'CAN_USE_VFP3_INSTRUCTIONS',
182             ],
183           }],
184           [ 'arm_fpu=="vfpv3"', {
185             'defines': [
186               'CAN_USE_VFP3_INSTRUCTIONS',
187               'CAN_USE_VFP32DREGS',
188             ],
189           }],
190           [ 'arm_fpu=="neon"', {
191             'defines': [
192               'CAN_USE_VFP3_INSTRUCTIONS',
193               'CAN_USE_VFP32DREGS',
194               'CAN_USE_NEON',
195             ],
196           }],
197           [ 'arm_test_noprobe=="on"', {
198             'defines': [
199               'ARM_TEST_NO_FEATURE_PROBE',
200             ],
201           }],
202         ],
203         'target_conditions': [
204           ['_toolset=="host"', {
205             'conditions': [
206               ['v8_target_arch==host_arch and android_webview_build==0', {
207                 # Host built with an Arm CXX compiler.
208                 'conditions': [
209                   [ 'arm_version==7', {
210                     'cflags': ['-march=armv7-a',],
211                   }],
212                   [ 'arm_version==7 or arm_version=="default"', {
213                     'conditions': [
214                       [ 'arm_fpu!="default"', {
215                         'cflags': ['-mfpu=<(arm_fpu)',],
216                       }],
217                     ],
218                   }],
219                   [ 'arm_float_abi!="default"', {
220                     'cflags': ['-mfloat-abi=<(arm_float_abi)',],
221                   }],
222                   [ 'arm_thumb==1', {
223                     'cflags': ['-mthumb',],
224                   }],
225                   [ 'arm_thumb==0', {
226                     'cflags': ['-marm',],
227                   }],
228                 ],
229               }, {
230                 # 'v8_target_arch!=host_arch'
231                 # Host not built with an Arm CXX compiler (simulator build).
232                 'conditions': [
233                   [ 'arm_float_abi=="hard"', {
234                     'defines': [
235                       'USE_EABI_HARDFLOAT=1',
236                     ],
237                   }],
238                   [ 'arm_float_abi=="softfp" or arm_float_abi=="default"', {
239                     'defines': [
240                       'USE_EABI_HARDFLOAT=0',
241                     ],
242                   }],
243                 ],
244               }],
245             ],
246           }],  # _toolset=="host"
247           ['_toolset=="target"', {
248             'conditions': [
249               ['v8_target_arch==target_arch and android_webview_build==0', {
250                 # Target built with an Arm CXX compiler.
251                 'conditions': [
252                   [ 'arm_version==7', {
253                     'cflags': ['-march=armv7-a',],
254                   }],
255                   [ 'arm_version==7 or arm_version=="default"', {
256                     'conditions': [
257                       [ 'arm_fpu!="default"', {
258                         'cflags': ['-mfpu=<(arm_fpu)',],
259                       }],
260                     ],
261                   }],
262                   [ 'arm_float_abi!="default"', {
263                     'cflags': ['-mfloat-abi=<(arm_float_abi)',],
264                   }],
265                   [ 'arm_thumb==1', {
266                     'cflags': ['-mthumb',],
267                   }],
268                   [ 'arm_thumb==0', {
269                     'cflags': ['-marm',],
270                   }],
271                 ],
272               }, {
273                 # 'v8_target_arch!=target_arch'
274                 # Target not built with an Arm CXX compiler (simulator build).
275                 'conditions': [
276                   [ 'arm_float_abi=="hard"', {
277                     'defines': [
278                       'USE_EABI_HARDFLOAT=1',
279                     ],
280                   }],
281                   [ 'arm_float_abi=="softfp" or arm_float_abi=="default"', {
282                     'defines': [
283                       'USE_EABI_HARDFLOAT=0',
284                     ],
285                   }],
286                 ],
287               }],
288               # Disable LTO for v8
289               # v8 is optimized for speed, which takes precedence over
290               # size optimization in LTO.
291               ['use_lto==1', {
292                 'cflags!': [
293                   '-flto',
294                   '-ffat-lto-objects',
295                 ],
296               }],
297             ],
298           }],  # _toolset=="target"
299         ],
300       }],  # v8_target_arch=="arm"
301       ['v8_target_arch=="arm64"', {
302         'defines': [
303           'V8_TARGET_ARCH_ARM64',
304         ],
305       }],
306       ['v8_target_arch=="ppc" or v8_target_arch=="ppc64"', {
307         'defines': [
308           'V8_TARGET_ARCH_PPC',
309         ],
310         'conditions': [
311           ['v8_target_arch=="ppc64"', {
312             'defines': [
313               'V8_TARGET_ARCH_PPC64',
314             ],
315           }],
316           ['v8_host_byteorder=="little"', {
317             'defines': [
318               'V8_TARGET_ARCH_PPC_LE',
319             ],
320           }],
321           ['v8_host_byteorder=="big"', {
322             'defines': [
323               'V8_TARGET_ARCH_PPC_BE',
324             ],
325             'conditions': [
326               ['OS=="aix"', {
327                 # Work around AIX ceil, trunc and round oddities.
328                 'cflags': [ '-mcpu=power5+ -mfprnd' ],
329               }],
330               ['OS=="aix"', {
331                 # Work around AIX assembler popcntb bug.
332                 'cflags': [ '-mno-popcntb' ],
333               }],
334             ],
335           }],
336         ],
337       }],  # ppc
338       ['v8_target_arch=="ia32"', {
339         'defines': [
340           'V8_TARGET_ARCH_IA32',
341         ],
342       }],  # v8_target_arch=="ia32"
343       ['v8_target_arch=="x87"', {
344         'defines': [
345           'V8_TARGET_ARCH_X87',
346         ],
347         'cflags': ['-march=i586'],
348       }],  # v8_target_arch=="x87"
349       ['v8_target_arch=="mips"', {
350         'defines': [
351           'V8_TARGET_ARCH_MIPS',
352         ],
353         'conditions': [
354           [ 'v8_can_use_fpu_instructions=="true"', {
355             'defines': [
356               'CAN_USE_FPU_INSTRUCTIONS',
357             ],
358           }],
359           [ 'v8_use_mips_abi_hardfloat=="true"', {
360             'defines': [
361               '__mips_hard_float=1',
362               'CAN_USE_FPU_INSTRUCTIONS',
363             ],
364           }, {
365             'defines': [
366               '__mips_soft_float=1'
367             ]
368           }],
369         ],
370         'target_conditions': [
371           ['_toolset=="target"', {
372             'conditions': [
373               ['v8_target_arch==target_arch and android_webview_build==0', {
374                 # Target built with a Mips CXX compiler.
375                 'cflags': [
376                   '-EB',
377                   '-Wno-error=array-bounds',  # Workaround https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56273
378                 ],
379                 'ldflags': ['-EB'],
380                 'conditions': [
381                   [ 'v8_use_mips_abi_hardfloat=="true"', {
382                     'cflags': ['-mhard-float'],
383                     'ldflags': ['-mhard-float'],
384                   }, {
385                     'cflags': ['-msoft-float'],
386                     'ldflags': ['-msoft-float'],
387                   }],
388                   ['mips_arch_variant=="r6"', {
389                     'defines': [
390                       '_MIPS_ARCH_MIPS32R6',
391                       'FPU_MODE_FP64',
392                     ],
393                     'cflags!': ['-mfp32', '-mfpxx'],
394                     'cflags': ['-mips32r6', '-Wa,-mips32r6'],
395                     'ldflags': [
396                       '-mips32r6',
397                       '-Wl,--dynamic-linker=$(LDSO_PATH)',
398                       '-Wl,--rpath=$(LD_R_PATH)',
399                     ],
400                   }],
401                   ['mips_arch_variant=="r2"', {
402                     'conditions': [
403                       [ 'mips_fpu_mode=="fp64"', {
404                         'defines': [
405                           '_MIPS_ARCH_MIPS32R2',
406                           'FPU_MODE_FP64',
407                         ],
408                         'cflags': ['-mfp64'],
409                       }],
410                       ['mips_fpu_mode=="fpxx"', {
411                         'defines': [
412                           '_MIPS_ARCH_MIPS32R2',
413                           'FPU_MODE_FPXX',
414                         ],
415                         'cflags': ['-mfpxx'],
416                       }],
417                       ['mips_fpu_mode=="fp32"', {
418                         'defines': [
419                           '_MIPS_ARCH_MIPS32R2',
420                           'FPU_MODE_FP32',
421                         ],
422                         'cflags': ['-mfp32'],
423                       }],
424                     ],
425                     'cflags': ['-mips32r2', '-Wa,-mips32r2'],
426                     'ldflags': ['-mips32r2'],
427                   }],
428                   ['mips_arch_variant=="r1"', {
429                     'defines': [
430                       'FPU_MODE_FP32',
431                     ],
432                     'cflags!': ['-mfp64', '-mfpxx'],
433                     'cflags': ['-mips32', '-Wa,-mips32'],
434                     'ldflags': ['-mips32'],
435                   }],
436                   ['mips_arch_variant=="rx"', {
437                     'defines': [
438                       '_MIPS_ARCH_MIPS32RX',
439                       'FPU_MODE_FPXX',
440                     ],
441                     'cflags!': ['-mfp64', '-mfp32'],
442                     'cflags': ['-mips32', '-Wa,-mips32', '-mfpxx'],
443                     'ldflags': ['-mips32'],
444                   }],
445                 ],
446               }, {
447                 # 'v8_target_arch!=target_arch'
448                 # Target not built with an MIPS CXX compiler (simulator build).
449                 'conditions': [
450                   ['mips_arch_variant=="r6"', {
451                     'defines': [
452                       '_MIPS_ARCH_MIPS32R6',
453                       'FPU_MODE_FP64',
454                     ],
455                   }],
456                   ['mips_arch_variant=="r2"', {
457                     'conditions': [
458                       [ 'mips_fpu_mode=="fp64"', {
459                         'defines': [
460                           '_MIPS_ARCH_MIPS32R2',
461                           'FPU_MODE_FP64',
462                         ],
463                       }],
464                       ['mips_fpu_mode=="fpxx"', {
465                         'defines': [
466                           '_MIPS_ARCH_MIPS32R2',
467                           'FPU_MODE_FPXX',
468                         ],
469                       }],
470                       ['mips_fpu_mode=="fp32"', {
471                         'defines': [
472                           '_MIPS_ARCH_MIPS32R2',
473                           'FPU_MODE_FP32',
474                         ],
475                       }],
476                     ],
477                   }],
478                   ['mips_arch_variant=="r1"', {
479                     'defines': [
480                       'FPU_MODE_FP32',
481                     ],
482                   }],
483                   ['mips_arch_variant=="rx"', {
484                     'defines': [
485                       '_MIPS_ARCH_MIPS32RX',
486                       'FPU_MODE_FPXX',
487                     ],
488                   }],
489                 ],
490               }],
491             ],
492           }],  #_toolset=="target"
493           ['_toolset=="host"', {
494             'conditions': [
495               ['mips_arch_variant=="rx"', {
496                 'defines': [
497                   '_MIPS_ARCH_MIPS32RX',
498                   'FPU_MODE_FPXX',
499                 ],
500               }],
501               ['mips_arch_variant=="r6"', {
502                 'defines': [
503                   '_MIPS_ARCH_MIPS32R6',
504                   'FPU_MODE_FP64',
505                 ],
506               }],
507               ['mips_arch_variant=="r2"', {
508                 'conditions': [
509                   ['mips_fpu_mode=="fp64"', {
510                     'defines': [
511                       '_MIPS_ARCH_MIPS32R2',
512                       'FPU_MODE_FP64',
513                     ],
514                   }],
515                   ['mips_fpu_mode=="fpxx"', {
516                     'defines': [
517                       '_MIPS_ARCH_MIPS32R2',
518                       'FPU_MODE_FPXX',
519                     ],
520                   }],
521                   ['mips_fpu_mode=="fp32"', {
522                     'defines': [
523                       '_MIPS_ARCH_MIPS32R2',
524                       'FPU_MODE_FP32'
525                     ],
526                   }],
527                 ],
528               }],
529               ['mips_arch_variant=="r1"', {
530                 'defines': ['FPU_MODE_FP32',],
531               }],
532             ]
533           }],  #_toolset=="host"
534         ],
535       }],  # v8_target_arch=="mips"
536       ['v8_target_arch=="mipsel"', {
537         'defines': [
538           'V8_TARGET_ARCH_MIPS',
539         ],
540         'conditions': [
541           [ 'v8_can_use_fpu_instructions=="true"', {
542             'defines': [
543               'CAN_USE_FPU_INSTRUCTIONS',
544             ],
545           }],
546           [ 'v8_use_mips_abi_hardfloat=="true"', {
547             'defines': [
548               '__mips_hard_float=1',
549               'CAN_USE_FPU_INSTRUCTIONS',
550             ],
551           }, {
552             'defines': [
553               '__mips_soft_float=1'
554             ],
555           }],
556         ],
557         'target_conditions': [
558           ['_toolset=="target"', {
559             'conditions': [
560               ['v8_target_arch==target_arch and android_webview_build==0', {
561                 # Target built with a Mips CXX compiler.
562                 'cflags': [
563                   '-EL',
564                   '-Wno-error=array-bounds',  # Workaround https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56273
565                 ],
566                 'ldflags': ['-EL'],
567                 'conditions': [
568                   [ 'v8_use_mips_abi_hardfloat=="true"', {
569                     'cflags': ['-mhard-float'],
570                     'ldflags': ['-mhard-float'],
571                   }, {
572                     'cflags': ['-msoft-float'],
573                     'ldflags': ['-msoft-float'],
574                   }],
575                   ['mips_arch_variant=="r6"', {
576                     'defines': [
577                       '_MIPS_ARCH_MIPS32R6',
578                       'FPU_MODE_FP64',
579                     ],
580                     'cflags!': ['-mfp32', '-mfpxx'],
581                     'cflags': ['-mips32r6', '-Wa,-mips32r6'],
582                     'ldflags': [
583                       '-mips32r6',
584                       '-Wl,--dynamic-linker=$(LDSO_PATH)',
585                       '-Wl,--rpath=$(LD_R_PATH)',
586                     ],
587                   }],
588                   ['mips_arch_variant=="r2"', {
589                     'conditions': [
590                       [ 'mips_fpu_mode=="fp64"', {
591                         'defines': [
592                           '_MIPS_ARCH_MIPS32R2',
593                           'FPU_MODE_FP64',
594                         ],
595                         'cflags': ['-mfp64'],
596                       }],
597                       ['mips_fpu_mode=="fpxx"', {
598                         'defines': [
599                           '_MIPS_ARCH_MIPS32R2',
600                           'FPU_MODE_FPXX',
601                         ],
602                         'cflags': ['-mfpxx'],
603                       }],
604                       ['mips_fpu_mode=="fp32"', {
605                         'defines': [
606                           '_MIPS_ARCH_MIPS32R2',
607                           'FPU_MODE_FP32',
608                         ],
609                         'cflags': ['-mfp32'],
610                       }],
611                     ],
612                     'cflags': ['-mips32r2', '-Wa,-mips32r2'],
613                     'ldflags': ['-mips32r2'],
614                   }],
615                   ['mips_arch_variant=="r1"', {
616                     'cflags!': ['-mfp64', '-mfpxx'],
617                     'cflags': ['-mips32', '-Wa,-mips32'],
618                     'ldflags': ['-mips32'],
619                   }],
620                   ['mips_arch_variant=="rx"', {
621                     'defines': [
622                       '_MIPS_ARCH_MIPS32RX',
623                       'FPU_MODE_FPXX',
624                     ],
625                     'cflags!': ['-mfp64', '-mfp32'],
626                     'cflags': ['-mips32', '-Wa,-mips32', '-mfpxx'],
627                     'ldflags': ['-mips32'],
628                   }],
629                   ['mips_arch_variant=="loongson"', {
630                     'defines': [
631                       '_MIPS_ARCH_LOONGSON',
632                       'FPU_MODE_FP32',
633                     ],
634                     'cflags!': ['-mfp64', '-mfp32', '-mfpxx'],
635                     'cflags': ['-mips3', '-Wa,-mips3'],
636                   }],
637                 ],
638               }, {
639                 # 'v8_target_arch!=target_arch'
640                 # Target not built with an MIPS CXX compiler (simulator build).
641                 'conditions': [
642                   ['mips_arch_variant=="r6"', {
643                     'defines': [
644                       '_MIPS_ARCH_MIPS32R6',
645                       'FPU_MODE_FP64',
646                     ],
647                   }],
648                   ['mips_arch_variant=="r2"', {
649                     'conditions': [
650                       [ 'mips_fpu_mode=="fp64"', {
651                         'defines': [
652                           '_MIPS_ARCH_MIPS32R2',
653                           'FPU_MODE_FP64',
654                         ],
655                       }],
656                       ['mips_fpu_mode=="fpxx"', {
657                         'defines': [
658                           '_MIPS_ARCH_MIPS32R2',
659                           'FPU_MODE_FPXX',
660                         ],
661                       }],
662                       ['mips_fpu_mode=="fp32"', {
663                         'defines': [
664                           '_MIPS_ARCH_MIPS32R2',
665                           'FPU_MODE_FP32',
666                         ],
667                       }],
668                     ],
669                   }],
670                   ['mips_arch_variant=="r1"', {
671                     'defines': [
672                       'FPU_MODE_FP32',
673                     ],
674                   }],
675                   ['mips_arch_variant=="rx"', {
676                     'defines': [
677                       '_MIPS_ARCH_MIPS32RX',
678                       'FPU_MODE_FPXX',
679                     ],
680                   }],
681                   ['mips_arch_variant=="loongson"', {
682                     'defines': [
683                       '_MIPS_ARCH_LOONGSON',
684                       'FPU_MODE_FP32',
685                     ],
686                   }],
687                 ],
688               }],
689             ],
690           }], #_toolset=="target
691           ['_toolset=="host"', {
692             'conditions': [
693               ['mips_arch_variant=="rx"', {
694                 'defines': [
695                   '_MIPS_ARCH_MIPS32RX',
696                   'FPU_MODE_FPXX',
697                 ],
698               }],
699               ['mips_arch_variant=="r6"', {
700                 'defines': [
701                   '_MIPS_ARCH_MIPS32R6',
702                   'FPU_MODE_FP64',
703                 ],
704               }],
705               ['mips_arch_variant=="r2"', {
706                 'conditions': [
707                   ['mips_fpu_mode=="fp64"', {
708                     'defines': [
709                       '_MIPS_ARCH_MIPS32R2',
710                       'FPU_MODE_FP64',
711                     ],
712                   }],
713                   ['mips_fpu_mode=="fpxx"', {
714                     'defines': [
715                       '_MIPS_ARCH_MIPS32R2',
716                       'FPU_MODE_FPXX',
717                     ],
718                   }],
719                   ['mips_fpu_mode=="fp32"', {
720                     'defines': [
721                       '_MIPS_ARCH_MIPS32R2',
722                       'FPU_MODE_FP32'
723                     ],
724                   }],
725                 ],
726               }],
727               ['mips_arch_variant=="r1"', {
728                 'defines': ['FPU_MODE_FP32',],
729               }],
730               ['mips_arch_variant=="loongson"', {
731                 'defines': [
732                   '_MIPS_ARCH_LOONGSON',
733                   'FPU_MODE_FP32',
734                 ],
735               }],
736             ]
737           }],
738         ],
739       }],  # v8_target_arch=="mipsel"
740       ['v8_target_arch=="mips64el"', {
741         'defines': [
742           'V8_TARGET_ARCH_MIPS64',
743         ],
744         'conditions': [
745           [ 'v8_can_use_fpu_instructions=="true"', {
746             'defines': [
747               'CAN_USE_FPU_INSTRUCTIONS',
748             ],
749           }],
750           [ 'v8_use_mips_abi_hardfloat=="true"', {
751             'defines': [
752               '__mips_hard_float=1',
753               'CAN_USE_FPU_INSTRUCTIONS',
754             ],
755           }, {
756             'defines': [
757               '__mips_soft_float=1'
758             ],
759           }],
760          ],
761         'target_conditions': [
762           ['_toolset=="target"', {
763             'conditions': [
764               ['v8_target_arch==target_arch and android_webview_build==0', {
765                 'cflags': [
766                   '-EL',
767                   '-Wno-error=array-bounds',  # Workaround https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56273
768                 ],
769                 'ldflags': ['-EL'],
770                 'conditions': [
771                   [ 'v8_use_mips_abi_hardfloat=="true"', {
772                     'cflags': ['-mhard-float'],
773                     'ldflags': ['-mhard-float'],
774                   }, {
775                     'cflags': ['-msoft-float'],
776                     'ldflags': ['-msoft-float'],
777                   }],
778                   ['mips_arch_variant=="r6"', {
779                     'defines': ['_MIPS_ARCH_MIPS64R6',],
780                     'cflags': ['-mips64r6', '-mabi=64', '-Wa,-mips64r6'],
781                     'ldflags': [
782                       '-mips64r6', '-mabi=64',
783                       '-Wl,--dynamic-linker=$(LDSO_PATH)',
784                       '-Wl,--rpath=$(LD_R_PATH)',
785                     ],
786                   }],
787                   ['mips_arch_variant=="r2"', {
788                     'defines': ['_MIPS_ARCH_MIPS64R2',],
789                     'cflags': ['-mips64r2', '-mabi=64', '-Wa,-mips64r2'],
790                     'ldflags': [
791                       '-mips64r2', '-mabi=64',
792                       '-Wl,--dynamic-linker=$(LDSO_PATH)',
793                       '-Wl,--rpath=$(LD_R_PATH)',
794                     ],
795                   }],
796                 ],
797               }, {
798                 # 'v8_target_arch!=target_arch'
799                 # Target not built with an MIPS CXX compiler (simulator build).
800                 'conditions': [
801                   ['mips_arch_variant=="r6"', {
802                     'defines': ['_MIPS_ARCH_MIPS64R6',],
803                   }],
804                   ['mips_arch_variant=="r2"', {
805                     'defines': ['_MIPS_ARCH_MIPS64R2',],
806                   }],
807                 ],
808               }],
809             ],
810           }],  #'_toolset=="target"
811           ['_toolset=="host"', {
812             'conditions': [
813               ['mips_arch_variant=="r6"', {
814                 'defines': ['_MIPS_ARCH_MIPS64R6',],
815               }],
816               ['mips_arch_variant=="r2"', {
817                 'defines': ['_MIPS_ARCH_MIPS64R2',],
818               }],
819             ],
820           }],  #'_toolset=="host"
821         ],
822       }],  # v8_target_arch=="mips64el"
823       ['v8_target_arch=="x64"', {
824         'defines': [
825           'V8_TARGET_ARCH_X64',
826         ],
827         'xcode_settings': {
828           'ARCHS': [ 'x86_64' ],
829         },
830         'msvs_settings': {
831           'VCLinkerTool': {
832             'StackReserveSize': '2097152',
833           },
834         },
835         'msvs_configuration_platform': 'x64',
836       }],  # v8_target_arch=="x64"
837       ['v8_target_arch=="x32"', {
838         'defines': [
839           # x32 port shares the source code with x64 port.
840           'V8_TARGET_ARCH_X64',
841           'V8_TARGET_ARCH_32_BIT',
842         ],
843         'cflags': [
844           '-mx32',
845           # Inhibit warning if long long type is used.
846           '-Wno-long-long',
847         ],
848         'ldflags': [
849           '-mx32',
850         ],
851       }],  # v8_target_arch=="x32"
852       ['linux_use_gold_flags==1', {
853         # Newer gccs and clangs support -fuse-ld, use the flag to force gold
854         # selection.
855         # gcc -- http://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Optimize-Options.html
856         'ldflags': [ '-fuse-ld=gold', ],
857       }],
858       ['linux_use_bundled_binutils==1', {
859         'cflags': [
860           '-B<!(cd <(DEPTH) && pwd -P)/<(binutils_dir)',
861         ],
862       }],
863       ['linux_use_bundled_gold==1', {
864         # Put our binutils, which contains gold in the search path. We pass
865         # the path to gold to the compiler. gyp leaves unspecified what the
866         # cwd is when running the compiler, so the normal gyp path-munging
867         # fails us. This hack gets the right path.
868         'ldflags': [
869           '-B<!(cd <(DEPTH) && pwd -P)/<(binutils_dir)',
870         ],
871       }],
872       ['OS=="win"', {
873         'defines': [
874           'WIN32',
875         ],
876         # 4351: VS 2005 and later are warning us that they've fixed a bug
877         #       present in VS 2003 and earlier.
878         'msvs_disabled_warnings': [4351],
879         'msvs_configuration_attributes': {
880           'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)',
881           'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
882           'CharacterSet': '1',
883         },
884       }],
885       ['OS=="win" and v8_target_arch=="ia32"', {
886         'msvs_settings': {
887           'VCCLCompilerTool': {
888             # Ensure no surprising artifacts from 80bit double math with x86.
889             'AdditionalOptions': ['/arch:SSE2'],
890           },
891         },
892       }],
893       ['OS=="win" and v8_enable_prof==1', {
894         'msvs_settings': {
895           'VCLinkerTool': {
896             'GenerateMapFile': 'true',
897           },
898         },
899       }],
900       ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
901          or OS=="netbsd" or OS=="mac" or OS=="android" or OS=="qnx") and \
902         v8_target_arch=="ia32"', {
903         'cflags': [
904           '-msse2',
905           '-mfpmath=sse',
906           '-mmmx',  # Allows mmintrin.h for MMX intrinsics.
907         ],
908       }],
909       ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
910          or OS=="netbsd" or OS=="mac" or OS=="android" or OS=="qnx") and \
911         (v8_target_arch=="arm" or v8_target_arch=="ia32" or \
912          v8_target_arch=="x87" or v8_target_arch=="mips" or \
913          v8_target_arch=="mipsel" or v8_target_arch=="ppc")', {
914         'target_conditions': [
915           ['_toolset=="host"', {
916             'conditions': [
917               ['host_cxx_is_biarch==1', {
918                 'cflags': [ '-m32' ],
919                 'ldflags': [ '-m32' ]
920               }],
921             ],
922             'xcode_settings': {
923               'ARCHS': [ 'i386' ],
924             },
925           }],
926           ['_toolset=="target"', {
927             'conditions': [
928               ['target_cxx_is_biarch==1 and nacl_target_arch!="nacl_x64"', {
929                 'cflags': [ '-m32' ],
930                 'ldflags': [ '-m32' ],
931               }],
932               # Enable feedback-directed optimisation when building in android.
933               [ 'android_webview_build == 1', {
934                 'aosp_build_settings': {
935                   'LOCAL_FDO_SUPPORT': 'true',
936                 },
937               }],
938             ],
939             'xcode_settings': {
940               'ARCHS': [ 'i386' ],
941             },
942           }],
943         ],
944       }],
945       ['(OS=="linux" or OS=="android") and \
946         (v8_target_arch=="x64" or v8_target_arch=="arm64" or \
947          v8_target_arch=="ppc64")', {
948         'target_conditions': [
949           ['_toolset=="host"', {
950             'conditions': [
951               ['host_cxx_is_biarch==1', {
952                 'cflags': [ '-m64' ],
953                 'ldflags': [ '-m64' ]
954               }],
955              ],
956            }],
957            ['_toolset=="target"', {
958              'conditions': [
959                ['target_cxx_is_biarch==1', {
960                  'cflags': [ '-m64' ],
961                  'ldflags': [ '-m64' ],
962                }],
963                # Enable feedback-directed optimisation when building in android.
964                [ 'android_webview_build == 1', {
965                  'aosp_build_settings': {
966                    'LOCAL_FDO_SUPPORT': 'true',
967                  },
968                }],
969              ]
970            }],
971          ],
972       }],
973       ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
974          or OS=="netbsd" or OS=="qnx" or OS=="aix"', {
975         'conditions': [
976           [ 'v8_no_strict_aliasing==1', {
977             'cflags': [ '-fno-strict-aliasing' ],
978           }],
979         ],  # conditions
980       }],
981       ['OS=="solaris"', {
982         'defines': [ '__C99FEATURES__=1' ],  # isinf() etc.
983       }],
984       ['OS=="freebsd" or OS=="openbsd"', {
985         'cflags': [ '-I/usr/local/include' ],
986       }],
987       ['OS=="netbsd"', {
988         'cflags': [ '-I/usr/pkg/include' ],
989       }],
990       ['OS=="aix"', {
991         'defines': [
992           # Support for malloc(0)
993           '_LINUX_SOURCE_COMPAT=1',
994           '_ALL_SOURCE=1'],
995         'conditions': [
996           [ 'v8_target_arch=="ppc"', {
997             'ldflags': [ '-Wl,-bmaxdata:0x60000000/dsa' ],
998           }],
999           [ 'v8_target_arch=="ppc64"', {
1000             'cflags': [ '-maix64' ],
1001             'ldflags': [ '-maix64' ],
1002           }],
1003         ],
1004       }],
1005     ],  # conditions
1006     'configurations': {
1007       # Abstract configuration for v8_optimized_debug == 0.
1008       'DebugBase0': {
1009         'abstract': 1,
1010         'msvs_settings': {
1011           'VCCLCompilerTool': {
1012             'Optimization': '0',
1013             'conditions': [
1014               ['component=="shared_library"', {
1015                 'RuntimeLibrary': '3',  # /MDd
1016               }, {
1017                 'RuntimeLibrary': '1',  # /MTd
1018               }],
1019             ],
1020           },
1021           'VCLinkerTool': {
1022             'LinkIncremental': '2',
1023           },
1024         },
1025         'variables': {
1026           'v8_enable_slow_dchecks%': 1,
1027         },
1028         'conditions': [
1029           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
1030             OS=="qnx" or OS=="aix"', {
1031             'cflags!': [
1032               '-O3',
1033               '-O2',
1034               '-O1',
1035               '-Os',
1036             ],
1037             'cflags': [
1038               '-fdata-sections',
1039               '-ffunction-sections',
1040             ],
1041           }],
1042           ['OS=="mac"', {
1043             'xcode_settings': {
1044                'GCC_OPTIMIZATION_LEVEL': '0',  # -O0
1045             },
1046           }],
1047           ['v8_enable_slow_dchecks==1', {
1048             'defines': [
1049               'ENABLE_SLOW_DCHECKS',
1050             ],
1051           }],
1052         ],
1053       },  # DebugBase0
1054       # Abstract configuration for v8_optimized_debug == 1.
1055       'DebugBase1': {
1056         'abstract': 1,
1057         'msvs_settings': {
1058           'VCCLCompilerTool': {
1059             'Optimization': '2',
1060             'InlineFunctionExpansion': '2',
1061             'EnableIntrinsicFunctions': 'true',
1062             'FavorSizeOrSpeed': '0',
1063             'StringPooling': 'true',
1064             'BasicRuntimeChecks': '0',
1065             'conditions': [
1066               ['component=="shared_library"', {
1067                 'RuntimeLibrary': '3',  #/MDd
1068               }, {
1069                 'RuntimeLibrary': '1',  #/MTd
1070               }],
1071             ],
1072           },
1073           'VCLinkerTool': {
1074             'LinkIncremental': '1',
1075             'OptimizeReferences': '2',
1076             'EnableCOMDATFolding': '2',
1077           },
1078         },
1079         'variables': {
1080           'v8_enable_slow_dchecks%': 0,
1081         },
1082         'conditions': [
1083           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
1084             OS=="qnx" or OS=="aix"', {
1085             'cflags!': [
1086               '-O0',
1087               '-O1',
1088               '-Os',
1089             ],
1090             'cflags': [
1091               '-fdata-sections',
1092               '-ffunction-sections',
1093             ],
1094             'conditions': [
1095               # TODO(crbug.com/272548): Avoid -O3 in NaCl
1096               # Don't use -O3 with sanitizers.
1097               ['nacl_target_arch=="none" and asan==0 and msan==0 and lsan==0 \
1098                 and tsan==0 and ubsan==0 and ubsan_vptr==0', {
1099                 'cflags': ['-O3'],
1100                 'cflags!': ['-O2'],
1101                 }, {
1102                 'cflags': ['-O2'],
1103                 'cflags!': ['-O3'],
1104               }],
1105             ],
1106           }],
1107           ['OS=="mac"', {
1108             'xcode_settings': {
1109               'GCC_OPTIMIZATION_LEVEL': '3',  # -O3
1110               'GCC_STRICT_ALIASING': 'YES',
1111             },
1112           }],
1113           ['v8_enable_slow_dchecks==1', {
1114             'defines': [
1115               'ENABLE_SLOW_DCHECKS',
1116             ],
1117           }],
1118         ],
1119       },  # DebugBase1
1120       # Common settings for the Debug configuration.
1121       'DebugBaseCommon': {
1122         'abstract': 1,
1123         'defines': [
1124           'ENABLE_DISASSEMBLER',
1125           'V8_ENABLE_CHECKS',
1126           'OBJECT_PRINT',
1127           'VERIFY_HEAP',
1128           'DEBUG',
1129           'TRACE_MAPS'
1130         ],
1131         'conditions': [
1132           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
1133             OS=="qnx" or OS=="aix"', {
1134             'cflags': [ '-Woverloaded-virtual', '<(wno_array_bounds)', ],
1135           }],
1136           ['OS=="linux" and v8_enable_backtrace==1', {
1137             # Support for backtrace_symbols.
1138             'ldflags': [ '-rdynamic' ],
1139           }],
1140           ['OS=="linux" and disable_glibcxx_debug==0', {
1141             # Enable libstdc++ debugging facilities to help catch problems
1142             # early, see http://crbug.com/65151 .
1143             'defines': ['_GLIBCXX_DEBUG=1',],
1144           }],
1145           ['OS=="aix"', {
1146             'ldflags': [ '-Wl,-bbigtoc' ],
1147             'conditions': [
1148               ['v8_target_arch=="ppc64"', {
1149                 'cflags': [ '-maix64 -mcmodel=large' ],
1150               }],
1151             ],
1152           }],
1153           ['OS=="android"', {
1154             'variables': {
1155               'android_full_debug%': 1,
1156             },
1157             'conditions': [
1158               ['android_full_debug==0', {
1159                 # Disable full debug if we want a faster v8 in a debug build.
1160                 # TODO(2304): pass DISABLE_DEBUG_ASSERT instead of hiding DEBUG.
1161                 'defines!': [
1162                   'DEBUG',
1163                   'ENABLE_SLOW_DCHECKS',
1164                 ],
1165               }],
1166             ],
1167           }],
1168           ['linux_use_gold_flags==1', {
1169             'target_conditions': [
1170               ['_toolset=="target"', {
1171                 'ldflags': [
1172                   # Experimentation found that using four linking threads
1173                   # saved ~20% of link time.
1174                   # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/281527606915bb36
1175                   # Only apply this to the target linker, since the host
1176                   # linker might not be gold, but isn't used much anyway.
1177                   '-Wl,--threads',
1178                   '-Wl,--thread-count=4',
1179                 ],
1180               }],
1181             ],
1182           }],
1183         ],
1184       },  # DebugBaseCommon
1185       'Debug': {
1186         'inherit_from': ['DebugBaseCommon'],
1187         'conditions': [
1188           ['v8_optimized_debug==0', {
1189             'inherit_from': ['DebugBase0'],
1190           }, {
1191             'inherit_from': ['DebugBase1'],
1192           }],
1193         ],
1194       },  # Debug
1195       'Release': {
1196         'variables': {
1197           'v8_enable_slow_dchecks%': 0,
1198         },
1199         'conditions': [
1200           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" \
1201             or OS=="aix"', {
1202             'cflags!': [
1203               '-Os',
1204             ],
1205             'cflags': [
1206               '-fdata-sections',
1207               '-ffunction-sections',
1208               '<(wno_array_bounds)',
1209             ],
1210             'conditions': [
1211               # TODO(crbug.com/272548): Avoid -O3 in NaCl
1212               # Don't use -O3 with sanitizers.
1213               ['nacl_target_arch=="none" and asan==0 and msan==0 and lsan==0 \
1214                 and tsan==0 and ubsan==0 and ubsan_vptr==0', {
1215                 'cflags': ['-O3'],
1216                 'cflags!': ['-O2'],
1217               }, {
1218                 'cflags': ['-O2'],
1219                 'cflags!': ['-O3'],
1220               }],
1221             ],
1222           }],
1223           ['OS=="android"', {
1224             'cflags!': [
1225               '-O3',
1226               '-Os',
1227             ],
1228             'cflags': [
1229               '-fdata-sections',
1230               '-ffunction-sections',
1231               '-O2',
1232             ],
1233           }],
1234           ['OS=="mac"', {
1235             'xcode_settings': {
1236               'GCC_OPTIMIZATION_LEVEL': '3',  # -O3
1237
1238               # -fstrict-aliasing.  Mainline gcc
1239               # enables this at -O2 and above,
1240               # but Apple gcc does not unless it
1241               # is specified explicitly.
1242               'GCC_STRICT_ALIASING': 'YES',
1243             },
1244           }],  # OS=="mac"
1245           ['OS=="win"', {
1246             'msvs_settings': {
1247               'VCCLCompilerTool': {
1248                 'Optimization': '2',
1249                 'InlineFunctionExpansion': '2',
1250                 'EnableIntrinsicFunctions': 'true',
1251                 'FavorSizeOrSpeed': '0',
1252                 'StringPooling': 'true',
1253                 'conditions': [
1254                   ['component=="shared_library"', {
1255                     'RuntimeLibrary': '2',  #/MD
1256                   }, {
1257                     'RuntimeLibrary': '0',  #/MT
1258                   }],
1259                 ],
1260               },
1261               'VCLinkerTool': {
1262                 'LinkIncremental': '1',
1263                 'OptimizeReferences': '2',
1264                 'EnableCOMDATFolding': '2',
1265               },
1266             },
1267           }],  # OS=="win"
1268           ['v8_enable_slow_dchecks==1', {
1269             'defines': [
1270               'ENABLE_SLOW_DCHECKS',
1271             ],
1272           }],
1273         ],  # conditions
1274       },  # Release
1275     },  # configurations
1276   },  # target_defaults
1277 }