• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    'cfi_vptr%': 0,
36    'lsan%': 0,
37    'msan%': 0,
38    'tsan%': 0,
39    'ubsan%': 0,
40    'ubsan_vptr%': 0,
41    'has_valgrind%': 0,
42    'coverage%': 0,
43    'v8_target_arch%': '<(target_arch)',
44    'v8_host_byteorder%': '<!(python -c "import sys; print(sys.byteorder)")',
45    'force_dynamic_crt%': 0,
46
47    # Setting 'v8_can_use_vfp32dregs' to 'true' will cause V8 to use the VFP
48    # registers d16-d31 in the generated code, both in the snapshot and for the
49    # ARM target. Leaving the default value of 'false' will avoid the use of
50    # these registers in the snapshot and use CPU feature probing when running
51    # on the target.
52    'v8_can_use_vfp32dregs%': 'false',
53    'arm_test_noprobe%': 'off',
54
55    # Similar to vfp but on MIPS.
56    'v8_can_use_fpu_instructions%': 'true',
57
58    # Similar to the ARM hard float ABI but on MIPS.
59    'v8_use_mips_abi_hardfloat%': 'true',
60
61    # MIPS MSA support
62    'mips_use_msa%': 0,
63
64    # Print to stdout on Android.
65    'v8_android_log_stdout%': 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 gypfiles/standalone.gypi.
77    'want_separate_host_toolset%': 1,
78
79    # Toolset the shell binary should be compiled for. Possible values are
80    # 'host' and 'target'.
81    # The setting is ignored if want_separate_host_toolset is 0.
82    'v8_toolset_for_shell%': '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
104    # Indicates if gcmole tools are downloaded by a hook.
105    'gcmole%': 0,
106  },
107
108  # [GYP] this needs to be outside of the top level 'variables'
109  'conditions': [
110    ['host_arch=="ia32" or host_arch=="x64" or \
111      host_arch=="ppc" or host_arch=="ppc64" or \
112      host_arch=="s390x" or \
113      clang==1', {
114      'variables': {
115        'host_cxx_is_biarch%': 1,
116       },
117     }, {
118      'variables': {
119        'host_cxx_is_biarch%': 0,
120      },
121    }],
122    ['target_arch=="ia32" or target_arch=="x64" or \
123      target_arch=="ppc" or target_arch=="ppc64" or \
124      target_arch=="s390x" or clang==1', {
125      'variables': {
126        'target_cxx_is_biarch%': 1,
127       },
128     }, {
129      'variables': {
130        'target_cxx_is_biarch%': 0,
131      },
132    }],
133  ],
134  'target_defaults': {
135    'include_dirs': [
136      '<(V8_ROOT)',
137      '<(V8_ROOT)/include',
138    ],
139    'conditions': [
140      ['clang', {
141        'cflags': [ '-Werror', '-Wno-unknown-pragmas' ],
142      },{
143        'cflags!': [ '-Wall', '-Wextra' ],
144        'cflags': [ '-Wno-return-type' ],
145      }],
146      ['v8_target_arch=="arm"', {
147        'defines': [
148          'V8_TARGET_ARCH_ARM',
149        ],
150        'conditions': [
151          [ 'arm_version==7 or arm_version=="default"', {
152            'defines': [
153              'CAN_USE_ARMV7_INSTRUCTIONS',
154            ],
155          }],
156          [ 'arm_fpu=="vfpv3-d16" or arm_fpu=="default"', {
157            'defines': [
158              'CAN_USE_VFP3_INSTRUCTIONS',
159            ],
160          }],
161          [ 'arm_fpu=="vfpv3"', {
162            'defines': [
163              'CAN_USE_VFP3_INSTRUCTIONS',
164              'CAN_USE_VFP32DREGS',
165            ],
166          }],
167          [ 'arm_fpu=="neon"', {
168            'defines': [
169              'CAN_USE_VFP3_INSTRUCTIONS',
170              'CAN_USE_VFP32DREGS',
171              'CAN_USE_NEON',
172            ],
173          }],
174          [ 'arm_test_noprobe=="on"', {
175            'defines': [
176              'ARM_TEST_NO_FEATURE_PROBE',
177            ],
178          }],
179        ],
180        'target_conditions': [
181          ['_toolset=="host"', {
182            'conditions': [
183              ['v8_target_arch==host_arch', {
184                # Host built with an Arm CXX compiler.
185                'conditions': [
186                  [ 'arm_version==7', {
187                    'cflags': ['-march=armv7-a',],
188                  }],
189                  [ 'arm_version==7 or arm_version=="default"', {
190                    'conditions': [
191                      [ 'arm_fpu!="default"', {
192                        'cflags': ['-mfpu=<(arm_fpu)',],
193                      }],
194                    ],
195                  }],
196                  [ 'arm_float_abi!="default"', {
197                    'cflags': ['-mfloat-abi=<(arm_float_abi)',],
198                  }],
199                  [ 'arm_thumb==1', {
200                    'cflags': ['-mthumb',],
201                  }],
202                  [ 'arm_thumb==0', {
203                    'cflags': ['-marm',],
204                  }],
205                ],
206              }, {
207                # 'v8_target_arch!=host_arch'
208                # Host not built with an Arm CXX compiler (simulator build).
209                'conditions': [
210                  [ 'arm_float_abi=="hard"', {
211                    'defines': [
212                      'USE_EABI_HARDFLOAT=1',
213                    ],
214                  }],
215                  [ 'arm_float_abi=="softfp" or arm_float_abi=="default"', {
216                    'defines': [
217                      'USE_EABI_HARDFLOAT=0',
218                    ],
219                  }],
220                ],
221              }],
222            ],
223          }],  # _toolset=="host"
224          ['_toolset=="target"', {
225            'conditions': [
226              ['v8_target_arch==target_arch', {
227                # Target built with an Arm CXX compiler.
228                'conditions': [
229                  [ 'arm_version==7', {
230                    'cflags': ['-march=armv7-a',],
231                  }],
232                  [ 'arm_version==7 or arm_version=="default"', {
233                    'conditions': [
234                      [ 'arm_fpu!="default"', {
235                        'cflags': ['-mfpu=<(arm_fpu)',],
236                      }],
237                    ],
238                  }],
239                  [ 'arm_float_abi!="default"', {
240                    'cflags': ['-mfloat-abi=<(arm_float_abi)',],
241                  }],
242                  [ 'arm_thumb==1', {
243                    'cflags': ['-mthumb',],
244                  }],
245                  [ 'arm_thumb==0', {
246                    'cflags': ['-marm',],
247                  }],
248                ],
249              }, {
250                # 'v8_target_arch!=target_arch'
251                # Target not built with an Arm CXX compiler (simulator build).
252                'conditions': [
253                  [ 'arm_float_abi=="hard"', {
254                    'defines': [
255                      'USE_EABI_HARDFLOAT=1',
256                    ],
257                  }],
258                  [ 'arm_float_abi=="softfp" or arm_float_abi=="default"', {
259                    'defines': [
260                      'USE_EABI_HARDFLOAT=0',
261                    ],
262                  }],
263                ],
264              }],
265            ],
266          }],  # _toolset=="target"
267        ],
268      }],  # v8_target_arch=="arm"
269      ['v8_target_arch=="arm64"', {
270        'defines': [
271          'V8_TARGET_ARCH_ARM64',
272        ],
273        'conditions': [
274          ['v8_control_flow_integrity==1', {
275            'cflags': [ '-mbranch-protection=standard' ],
276          }],
277        ],
278      }],
279      ['v8_target_arch=="s390x"', {
280        'defines': [
281          'V8_TARGET_ARCH_S390',
282        ],
283        'cflags': [ '-ffp-contract=off' ],
284        'conditions': [
285          ['v8_target_arch=="s390x"', {
286            'defines': [
287              'V8_TARGET_ARCH_S390X',
288            ],
289          }],
290          ['v8_host_byteorder=="little"', {
291            'defines': [
292              'V8_TARGET_ARCH_S390_LE_SIM',
293            ],
294          }, {
295            'cflags': [ '-march=z196' ],
296          }],
297          ],
298      }],  # s390x
299      ['v8_target_arch=="ppc" or v8_target_arch=="ppc64"', {
300        'conditions': [
301          ['v8_target_arch=="ppc"', {
302            'defines': [
303              'V8_TARGET_ARCH_PPC',
304            ],
305          }],
306          ['v8_target_arch=="ppc64"', {
307            'defines': [
308              'V8_TARGET_ARCH_PPC64',
309            ],
310          }],
311          ['v8_host_byteorder=="little"', {
312            'defines': [
313              'V8_TARGET_ARCH_PPC_LE',
314            ],
315          }],
316          ['v8_host_byteorder=="big"', {
317            'defines': [
318              'V8_TARGET_ARCH_PPC_BE',
319            ],
320            'conditions': [
321              ['OS=="aix"', {
322                # Work around AIX ceil, trunc and round oddities.
323                'cflags': [ '-mcpu=power5+ -mfprnd' ],
324              }],
325              ['OS=="aix"', {
326                # Work around AIX assembler popcntb bug.
327                'cflags': [ '-mno-popcntb' ],
328              }],
329            ],
330          }],
331        ],
332      }],  # ppc
333      ['v8_target_arch=="ia32"', {
334        'defines': [
335          'V8_TARGET_ARCH_IA32',
336        ],
337      }],  # v8_target_arch=="ia32"
338      ['v8_target_arch=="mips" or v8_target_arch=="mipsel" \
339        or v8_target_arch=="mips64" or v8_target_arch=="mips64el"', {
340        'target_conditions': [
341          ['_toolset=="target"', {
342            'conditions': [
343              ['v8_target_arch==target_arch', {
344                # Target built with a Mips CXX compiler.
345                'variables': {
346                  'ldso_path%': '<!(/bin/echo -n $LDSO_PATH)',
347                  'ld_r_path%': '<!(/bin/echo -n $LD_R_PATH)',
348                },
349                'conditions': [
350                  ['ldso_path!=""', {
351                    'ldflags': ['-Wl,--dynamic-linker=<(ldso_path)'],
352                  }],
353                  ['ld_r_path!=""', {
354                    'ldflags': ['-Wl,--rpath=<(ld_r_path)'],
355                  }],
356                  [ 'clang==1', {
357                    'cflags': ['-integrated-as'],
358                  }],
359                  ['OS!="mac"', {
360                    'defines': ['_MIPS_TARGET_HW',],
361                  }, {
362                    'defines': ['_MIPS_TARGET_SIMULATOR',],
363                  }],
364                ],
365              }, {
366                'defines': ['_MIPS_TARGET_SIMULATOR',],
367              }],
368            ],
369          }],  #'_toolset=="target"
370          ['_toolset=="host"', {
371            'conditions': [
372              ['v8_target_arch==target_arch and OS!="mac"', {
373                'defines': ['_MIPS_TARGET_HW',],
374              }, {
375                'defines': ['_MIPS_TARGET_SIMULATOR',],
376              }],
377            ],
378          }],  #'_toolset=="host"
379        ],
380      }],
381      ['v8_target_arch=="mips"', {
382        'defines': [
383          'V8_TARGET_ARCH_MIPS',
384        ],
385        'conditions': [
386          [ 'v8_can_use_fpu_instructions=="true"', {
387            'defines': [
388              'CAN_USE_FPU_INSTRUCTIONS',
389            ],
390          }],
391          [ 'v8_use_mips_abi_hardfloat=="true"', {
392            'defines': [
393              '__mips_hard_float=1',
394              'CAN_USE_FPU_INSTRUCTIONS',
395            ],
396          }, {
397            'defines': [
398              '__mips_soft_float=1'
399            ]
400          }],
401        ],
402        'target_conditions': [
403          ['_toolset=="target"', {
404            'conditions': [
405              ['v8_target_arch==target_arch', {
406                # Target built with a Mips CXX compiler.
407                'cflags': [
408                  '-EB',
409                  '-Wno-error=array-bounds',  # Workaround https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56273
410                ],
411                'ldflags': ['-EB'],
412                'conditions': [
413                  [ 'v8_use_mips_abi_hardfloat=="true"', {
414                    'cflags': ['-mhard-float'],
415                    'ldflags': ['-mhard-float'],
416                  }, {
417                    'cflags': ['-msoft-float'],
418                    'ldflags': ['-msoft-float'],
419                  }],
420                  ['mips_arch_variant=="r6"', {
421                    'defines': [
422                      '_MIPS_ARCH_MIPS32R6',
423                      'FPU_MODE_FP64',
424                    ],
425                    'cflags!': ['-mfp32', '-mfpxx'],
426                    'conditions': [
427                      [ 'clang==0', {
428                        'cflags': ['-Wa,-mips32r6'],
429                      }],
430                    ],
431                    'cflags': ['-mips32r6'],
432                    'ldflags': ['-mips32r6'],
433                  }],
434                  ['mips_arch_variant=="r6" and mips_use_msa==1', {
435                    'defines': [ '_MIPS_MSA' ],
436                  }],
437                  ['mips_arch_variant=="r2"', {
438                    'conditions': [
439                      [ 'mips_fpu_mode=="fp64"', {
440                        'defines': [
441                          '_MIPS_ARCH_MIPS32R2',
442                          'FPU_MODE_FP64',
443                        ],
444                        'cflags': ['-mfp64'],
445                      }],
446                      ['mips_fpu_mode=="fpxx"', {
447                        'defines': [
448                          '_MIPS_ARCH_MIPS32R2',
449                          'FPU_MODE_FPXX',
450                        ],
451                        'cflags': ['-mfpxx'],
452                      }],
453                      ['mips_fpu_mode=="fp32"', {
454                        'defines': [
455                          '_MIPS_ARCH_MIPS32R2',
456                          'FPU_MODE_FP32',
457                        ],
458                        'cflags': ['-mfp32'],
459                      }],
460                      [ 'clang==0', {
461                        'cflags': ['-Wa,-mips32r2'],
462                      }],
463                    ],
464                    'cflags': ['-mips32r2'],
465                    'ldflags': ['-mips32r2'],
466                  }],
467                  ['mips_arch_variant=="r1"', {
468                    'defines': [
469                      'FPU_MODE_FP32',
470                    ],
471                    'cflags!': ['-mfp64', '-mfpxx'],
472                    'conditions': [
473                      [ 'clang==0', {
474                        'cflags': ['-Wa,-mips32'],
475                      }],
476                    ],
477                    'cflags': ['-mips32'],
478                    'ldflags': ['-mips32'],
479                  }],
480                  ['mips_arch_variant=="rx"', {
481                    'defines': [
482                      '_MIPS_ARCH_MIPS32RX',
483                      'FPU_MODE_FPXX',
484                    ],
485                    'cflags!': ['-mfp64', '-mfp32'],
486                    'conditions': [
487                      [ 'clang==0', {
488                        'cflags': ['-Wa,-mips32'],
489                      }],
490                    ],
491                    'cflags': ['-mips32', '-mfpxx'],
492                    'ldflags': ['-mips32'],
493                  }],
494                ],
495              }, {
496                # 'v8_target_arch!=target_arch'
497                # Target not built with an MIPS CXX compiler (simulator build).
498                'conditions': [
499                  ['mips_arch_variant=="r6"', {
500                    'defines': [
501                      '_MIPS_ARCH_MIPS32R6',
502                      'FPU_MODE_FP64',
503                    ],
504                  }],
505                  ['mips_arch_variant=="r6" and mips_use_msa==1', {
506                    'defines': [ '_MIPS_MSA' ],
507                  }],
508                  ['mips_arch_variant=="r2"', {
509                    'conditions': [
510                      [ 'mips_fpu_mode=="fp64"', {
511                        'defines': [
512                          '_MIPS_ARCH_MIPS32R2',
513                          'FPU_MODE_FP64',
514                        ],
515                      }],
516                      ['mips_fpu_mode=="fpxx"', {
517                        'defines': [
518                          '_MIPS_ARCH_MIPS32R2',
519                          'FPU_MODE_FPXX',
520                        ],
521                      }],
522                      ['mips_fpu_mode=="fp32"', {
523                        'defines': [
524                          '_MIPS_ARCH_MIPS32R2',
525                          'FPU_MODE_FP32',
526                        ],
527                      }],
528                    ],
529                  }],
530                  ['mips_arch_variant=="r1"', {
531                    'defines': [
532                      'FPU_MODE_FP32',
533                    ],
534                  }],
535                  ['mips_arch_variant=="rx"', {
536                    'defines': [
537                      '_MIPS_ARCH_MIPS32RX',
538                      'FPU_MODE_FPXX',
539                    ],
540                  }],
541                ],
542              }],
543            ],
544          }],  #_toolset=="target"
545          ['_toolset=="host"', {
546            'conditions': [
547              ['mips_arch_variant=="rx"', {
548                'defines': [
549                  '_MIPS_ARCH_MIPS32RX',
550                  'FPU_MODE_FPXX',
551                ],
552              }],
553              ['mips_arch_variant=="r6"', {
554                'defines': [
555                  '_MIPS_ARCH_MIPS32R6',
556                  'FPU_MODE_FP64',
557                ],
558              }],
559              ['mips_arch_variant=="r6" and mips_use_msa==1', {
560                'defines': [ '_MIPS_MSA' ],
561              }],
562              ['mips_arch_variant=="r2"', {
563                'conditions': [
564                  ['mips_fpu_mode=="fp64"', {
565                    'defines': [
566                      '_MIPS_ARCH_MIPS32R2',
567                      'FPU_MODE_FP64',
568                    ],
569                  }],
570                  ['mips_fpu_mode=="fpxx"', {
571                    'defines': [
572                      '_MIPS_ARCH_MIPS32R2',
573                      'FPU_MODE_FPXX',
574                    ],
575                  }],
576                  ['mips_fpu_mode=="fp32"', {
577                    'defines': [
578                      '_MIPS_ARCH_MIPS32R2',
579                      'FPU_MODE_FP32'
580                    ],
581                  }],
582                ],
583              }],
584              ['mips_arch_variant=="r1"', {
585                'defines': ['FPU_MODE_FP32',],
586              }],
587            ]
588          }],  #_toolset=="host"
589        ],
590      }],  # v8_target_arch=="mips"
591      ['v8_target_arch=="mipsel"', {
592        'defines': [
593          'V8_TARGET_ARCH_MIPS',
594        ],
595        'conditions': [
596          [ 'v8_can_use_fpu_instructions=="true"', {
597            'defines': [
598              'CAN_USE_FPU_INSTRUCTIONS',
599            ],
600          }],
601          [ 'v8_use_mips_abi_hardfloat=="true"', {
602            'defines': [
603              '__mips_hard_float=1',
604              'CAN_USE_FPU_INSTRUCTIONS',
605            ],
606          }, {
607            'defines': [
608              '__mips_soft_float=1'
609            ],
610          }],
611        ],
612        'target_conditions': [
613          ['_toolset=="target"', {
614            'conditions': [
615              ['v8_target_arch==target_arch', {
616                # Target built with a Mips CXX compiler.
617                'cflags': [
618                  '-EL',
619                  '-Wno-error=array-bounds',  # Workaround https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56273
620                ],
621                'ldflags': ['-EL'],
622                'conditions': [
623                  [ 'v8_use_mips_abi_hardfloat=="true"', {
624                    'cflags': ['-mhard-float'],
625                    'ldflags': ['-mhard-float'],
626                  }, {
627                    'cflags': ['-msoft-float'],
628                    'ldflags': ['-msoft-float'],
629                  }],
630                  ['mips_arch_variant=="r6"', {
631                    'defines': [
632                      '_MIPS_ARCH_MIPS32R6',
633                      'FPU_MODE_FP64',
634                    ],
635                    'cflags!': ['-mfp32', '-mfpxx'],
636                    'conditions': [
637                      [ 'clang==0', {
638                        'cflags': ['-Wa,-mips32r6'],
639                      }],
640                    ],
641                    'cflags': ['-mips32r6'],
642                    'ldflags': ['-mips32r6'],
643                  }],
644                  ['mips_arch_variant=="r6" and mips_use_msa==1', {
645                    'defines': [ '_MIPS_MSA' ],
646                  }],
647                  ['mips_arch_variant=="r2"', {
648                    'conditions': [
649                      [ 'mips_fpu_mode=="fp64"', {
650                        'defines': [
651                          '_MIPS_ARCH_MIPS32R2',
652                          'FPU_MODE_FP64',
653                        ],
654                        'cflags': ['-mfp64'],
655                      }],
656                      ['mips_fpu_mode=="fpxx"', {
657                        'defines': [
658                          '_MIPS_ARCH_MIPS32R2',
659                          'FPU_MODE_FPXX',
660                        ],
661                        'cflags': ['-mfpxx'],
662                      }],
663                      ['mips_fpu_mode=="fp32"', {
664                        'defines': [
665                          '_MIPS_ARCH_MIPS32R2',
666                          'FPU_MODE_FP32',
667                        ],
668                        'cflags': ['-mfp32'],
669                      }],
670                      [ 'clang==0', {
671                        'cflags': ['-Wa,-mips32r2'],
672                      }],
673                    ],
674                    'cflags': ['-mips32r2'],
675                    'ldflags': ['-mips32r2'],
676                  }],
677                  ['mips_arch_variant=="r1"', {
678                    'defines': [
679                      'FPU_MODE_FP32',
680                    ],
681                    'cflags!': ['-mfp64', '-mfpxx'],
682                    'conditions': [
683                      [ 'clang==0', {
684                        'cflags': ['-Wa,-mips32'],
685                      }],
686                    ],
687                    'cflags': ['-mips32'],
688                    'ldflags': ['-mips32'],
689                  }],
690                  ['mips_arch_variant=="rx"', {
691                    'defines': [
692                      '_MIPS_ARCH_MIPS32RX',
693                      'FPU_MODE_FPXX',
694                    ],
695                    'cflags!': ['-mfp64', '-mfp32'],
696                    'conditions': [
697                      [ 'clang==0', {
698                        'cflags': ['-Wa,-mips32'],
699                      }],
700                    ],
701                    'cflags': ['-mips32', '-mfpxx'],
702                    'ldflags': ['-mips32'],
703                  }],
704                  ['mips_arch_variant=="loongson"', {
705                    'defines': [
706                      '_MIPS_ARCH_LOONGSON',
707                      'FPU_MODE_FP32',
708                    ],
709                    'cflags!': ['-mfp64', '-mfpxx'],
710                    'conditions': [
711                      [ 'clang==0', {
712                        'cflags': ['-Wa,-mips3'],
713                      }],
714                    ],
715                    'cflags': ['-mips3', '-mfp32'],
716                  }],
717                ],
718              }, {
719                # 'v8_target_arch!=target_arch'
720                # Target not built with an MIPS CXX compiler (simulator build).
721                'conditions': [
722                  ['mips_arch_variant=="r6"', {
723                    'defines': [
724                      '_MIPS_ARCH_MIPS32R6',
725                      'FPU_MODE_FP64',
726                    ],
727                  }],
728                  ['mips_arch_variant=="r6" and mips_use_msa==1', {
729                    'defines': [ '_MIPS_MSA' ],
730                  }],
731                  ['mips_arch_variant=="r2"', {
732                    'conditions': [
733                      [ 'mips_fpu_mode=="fp64"', {
734                        'defines': [
735                          '_MIPS_ARCH_MIPS32R2',
736                          'FPU_MODE_FP64',
737                        ],
738                      }],
739                      ['mips_fpu_mode=="fpxx"', {
740                        'defines': [
741                          '_MIPS_ARCH_MIPS32R2',
742                          'FPU_MODE_FPXX',
743                        ],
744                      }],
745                      ['mips_fpu_mode=="fp32"', {
746                        'defines': [
747                          '_MIPS_ARCH_MIPS32R2',
748                          'FPU_MODE_FP32',
749                        ],
750                      }],
751                    ],
752                  }],
753                  ['mips_arch_variant=="r1"', {
754                    'defines': [
755                      'FPU_MODE_FP32',
756                    ],
757                  }],
758                  ['mips_arch_variant=="rx"', {
759                    'defines': [
760                      '_MIPS_ARCH_MIPS32RX',
761                      'FPU_MODE_FPXX',
762                    ],
763                  }],
764                  ['mips_arch_variant=="loongson"', {
765                    'defines': [
766                      '_MIPS_ARCH_LOONGSON',
767                      'FPU_MODE_FP32',
768                    ],
769                  }],
770                ],
771              }],
772            ],
773          }], #_toolset=="target
774          ['_toolset=="host"', {
775            'conditions': [
776              ['mips_arch_variant=="rx"', {
777                'defines': [
778                  '_MIPS_ARCH_MIPS32RX',
779                  'FPU_MODE_FPXX',
780                ],
781              }],
782              ['mips_arch_variant=="r6"', {
783                'defines': [
784                  '_MIPS_ARCH_MIPS32R6',
785                  'FPU_MODE_FP64',
786                ],
787              }],
788              ['mips_arch_variant=="r6" and mips_use_msa==1', {
789                'defines': [ '_MIPS_MSA' ],
790              }],
791              ['mips_arch_variant=="r2"', {
792                'conditions': [
793                  ['mips_fpu_mode=="fp64"', {
794                    'defines': [
795                      '_MIPS_ARCH_MIPS32R2',
796                      'FPU_MODE_FP64',
797                    ],
798                  }],
799                  ['mips_fpu_mode=="fpxx"', {
800                    'defines': [
801                      '_MIPS_ARCH_MIPS32R2',
802                      'FPU_MODE_FPXX',
803                    ],
804                  }],
805                  ['mips_fpu_mode=="fp32"', {
806                    'defines': [
807                      '_MIPS_ARCH_MIPS32R2',
808                      'FPU_MODE_FP32'
809                    ],
810                  }],
811                ],
812              }],
813              ['mips_arch_variant=="r1"', {
814                'defines': ['FPU_MODE_FP32',],
815              }],
816              ['mips_arch_variant=="loongson"', {
817                'defines': [
818                  '_MIPS_ARCH_LOONGSON',
819                  'FPU_MODE_FP32',
820                ],
821              }],
822            ]
823          }],
824        ],
825      }],  # v8_target_arch=="mipsel"
826      ['v8_target_arch=="mips64el" or v8_target_arch=="mips64"', {
827        'defines': [
828          'V8_TARGET_ARCH_MIPS64',
829        ],
830        'conditions': [
831          [ 'v8_can_use_fpu_instructions=="true"', {
832            'defines': [
833              'CAN_USE_FPU_INSTRUCTIONS',
834            ],
835          }],
836          [ 'v8_host_byteorder=="little"', {
837            'defines': [
838              'V8_TARGET_ARCH_MIPS64_LE',
839            ],
840          }],
841          [ 'v8_host_byteorder=="big"', {
842            'defines': [
843              'V8_TARGET_ARCH_MIPS64_BE',
844            ],
845          }],
846          [ 'v8_use_mips_abi_hardfloat=="true"', {
847            'defines': [
848              '__mips_hard_float=1',
849              'CAN_USE_FPU_INSTRUCTIONS',
850            ],
851          }, {
852            'defines': [
853              '__mips_soft_float=1'
854            ],
855          }],
856         ],
857        'target_conditions': [
858          ['_toolset=="target"', {
859            'conditions': [
860              ['v8_target_arch==target_arch', {
861                'cflags': [
862                  '-Wno-error=array-bounds',  # Workaround https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56273
863                ],
864                'conditions': [
865                  ['v8_target_arch=="mips64el"', {
866                    'cflags': ['-EL'],
867                    'ldflags': ['-EL'],
868                  }],
869                  ['v8_target_arch=="mips64"', {
870                    'cflags': ['-EB'],
871                    'ldflags': ['-EB'],
872                  }],
873                  [ 'v8_use_mips_abi_hardfloat=="true"', {
874                    'cflags': ['-mhard-float'],
875                    'ldflags': ['-mhard-float'],
876                  }, {
877                    'cflags': ['-msoft-float'],
878                    'ldflags': ['-msoft-float'],
879                  }],
880                  ['mips_arch_variant=="r6"', {
881                    'defines': ['_MIPS_ARCH_MIPS64R6',],
882                    'conditions': [
883                      [ 'clang==0', {
884                        'cflags': ['-Wa,-mips64r6'],
885                      }],
886                    ],
887                    'cflags': ['-mips64r6', '-mabi=64'],
888                    'ldflags': ['-mips64r6', '-mabi=64'],
889                  }],
890                  ['mips_arch_variant=="r6" and mips_use_msa==1', {
891                    'defines': [ '_MIPS_MSA' ],
892                  }],
893                  ['mips_arch_variant=="r2"', {
894                    'defines': ['_MIPS_ARCH_MIPS64R2',],
895                    'conditions': [
896                      [ 'clang==0', {
897                        'cflags': ['-Wa,-mips64r2'],
898                      }],
899                    ],
900                    'cflags': ['-mips64r2', '-mabi=64'],
901                    'ldflags': ['-mips64r2', '-mabi=64'],
902                  }],
903                ],
904              }, {
905                # 'v8_target_arch!=target_arch'
906                # Target not built with an MIPS CXX compiler (simulator build).
907                'conditions': [
908                  ['mips_arch_variant=="r6"', {
909                    'defines': ['_MIPS_ARCH_MIPS64R6',],
910                  }],
911                  ['mips_arch_variant=="r6" and mips_use_msa==1', {
912                    'defines': [ '_MIPS_MSA' ],
913                  }],
914                  ['mips_arch_variant=="r2"', {
915                    'defines': ['_MIPS_ARCH_MIPS64R2',],
916                  }],
917                ],
918              }],
919            ],
920          }],  #'_toolset=="target"
921          ['_toolset=="host"', {
922            'conditions': [
923              ['mips_arch_variant=="r6"', {
924                'defines': ['_MIPS_ARCH_MIPS64R6',],
925              }],
926              ['mips_arch_variant=="r6" and mips_use_msa==1', {
927                'defines': [ '_MIPS_MSA' ],
928              }],
929              ['mips_arch_variant=="r2"', {
930                'defines': ['_MIPS_ARCH_MIPS64R2',],
931              }],
932            ],
933          }],  #'_toolset=="host"
934        ],
935      }],  # v8_target_arch=="mips64el"
936      ['v8_target_arch=="x64"', {
937        'defines': [
938          'V8_TARGET_ARCH_X64',
939        ],
940        'xcode_settings': {
941          'ARCHS': [ 'x86_64' ],
942        },
943        'msvs_settings': {
944          'VCLinkerTool': {
945            'StackReserveSize': '2097152',
946          },
947        },
948        'msvs_configuration_platform': 'x64',
949      }],  # v8_target_arch=="x64"
950      ['v8_target_arch=="x32"', {
951        'defines': [
952          # x32 port shares the source code with x64 port.
953          'V8_TARGET_ARCH_X64',
954          'V8_TARGET_ARCH_32_BIT',
955        ],
956        'cflags': [
957          '-mx32',
958          # Inhibit warning if long long type is used.
959          '-Wno-long-long',
960        ],
961        'ldflags': [
962          '-mx32',
963        ],
964      }],  # v8_target_arch=="x32"
965      ['OS=="win"', {
966        'defines': [
967          'WIN32',
968          'NOMINMAX',  # Refs: https://chromium-review.googlesource.com/c/v8/v8/+/1456620
969        ],
970        # 4351: VS 2005 and later are warning us that they've fixed a bug
971        #       present in VS 2003 and earlier.
972        'msvs_disabled_warnings': [4351],
973        'msvs_configuration_attributes': {
974          'CharacterSet': '1',
975        },
976      }],
977      ['OS=="win" and v8_target_arch=="ia32"', {
978        'msvs_settings': {
979          'VCCLCompilerTool': {
980            # Ensure no surprising artifacts from 80bit double math with x86.
981            'AdditionalOptions': ['/arch:SSE2'],
982          },
983        },
984      }],
985      ['OS=="win" and v8_enable_prof==1', {
986        'msvs_settings': {
987          'VCLinkerTool': {
988            'GenerateMapFile': 'true',
989          },
990        },
991      }],
992      ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
993         or OS=="netbsd" or OS=="mac" or OS=="android" or OS=="qnx") and \
994        v8_target_arch=="ia32"', {
995        'cflags': [
996          '-msse2',
997          '-mfpmath=sse',
998          '-mmmx',  # Allows mmintrin.h for MMX intrinsics.
999        ],
1000      }],
1001      ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
1002         or OS=="netbsd" or OS=="mac" or OS=="android" or OS=="qnx") and \
1003        (v8_target_arch=="arm" or v8_target_arch=="ia32" or \
1004         v8_target_arch=="mips" or v8_target_arch=="mipsel" or \
1005         v8_target_arch=="ppc")', {
1006        'target_conditions': [
1007          ['_toolset=="host"', {
1008            'conditions': [
1009              ['host_cxx_is_biarch==1', {
1010                'conditions': [
1011                  ['host_arch=="s390x"', {
1012                    'cflags': [ '-m31' ],
1013                    'ldflags': [ '-m31' ]
1014                  },{
1015                   'cflags': [ '-m32' ],
1016                   'ldflags': [ '-m32' ]
1017                  }],
1018                ],
1019              }],
1020            ],
1021            'xcode_settings': {
1022              'ARCHS': [ 'i386' ],
1023            },
1024          }],
1025          ['_toolset=="target"', {
1026            'conditions': [
1027              ['target_cxx_is_biarch==1', {
1028                'conditions': [
1029                  ['host_arch=="s390x"', {
1030                    'cflags': [ '-m31' ],
1031                    'ldflags': [ '-m31' ]
1032                  },{
1033                   'cflags': [ '-m32' ],
1034                   'ldflags': [ '-m32' ],
1035                  }],
1036                ],
1037              }],
1038            ],
1039            'xcode_settings': {
1040              'ARCHS': [ 'i386' ],
1041            },
1042          }],
1043        ],
1044      }],
1045      ['(OS=="linux" or OS=="android") and \
1046        (v8_target_arch=="x64" or v8_target_arch=="arm64" or \
1047         v8_target_arch=="ppc64" or v8_target_arch=="s390x")', {
1048        'target_conditions': [
1049          ['_toolset=="host"', {
1050            'conditions': [
1051              ['host_cxx_is_biarch==1', {
1052                'cflags': [ '-m64' ],
1053                'ldflags': [ '-m64' ]
1054              }],
1055             ],
1056           }],
1057          ['_toolset=="target"', {
1058             'conditions': [
1059               ['target_cxx_is_biarch==1', {
1060                 'cflags': [ '-m64' ],
1061                 'ldflags': [ '-m64' ],
1062               }],
1063             ]
1064           }],
1065         ],
1066      }],
1067      ['OS=="android" and v8_android_log_stdout==1', {
1068        'defines': [
1069          'V8_ANDROID_LOG_STDOUT',
1070        ],
1071      }],
1072      ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
1073         or OS=="netbsd" or OS=="qnx" or OS=="aix"', {
1074        'conditions': [
1075          [ 'v8_no_strict_aliasing==1', {
1076            'cflags': [ '-fno-strict-aliasing' ],
1077          }],
1078        ],  # conditions
1079      }],
1080      ['OS=="solaris"', {
1081        'defines': [ '__C99FEATURES__=1' ],  # isinf() etc.
1082      }],
1083      ['OS=="freebsd" or OS=="openbsd"', {
1084        'cflags': [ '-I/usr/local/include' ],
1085      }],
1086      ['OS=="netbsd"', {
1087        'cflags': [ '-I/usr/pkg/include' ],
1088      }],
1089      ['OS=="aix"', {
1090        'defines': [
1091          # Support for malloc(0)
1092          '_LINUX_SOURCE_COMPAT=1',
1093          '__STDC_FORMAT_MACROS',
1094          '_ALL_SOURCE=1'],
1095        'conditions': [
1096          [ 'v8_target_arch=="ppc"', {
1097            'ldflags': [ '-Wl,-bmaxdata:0x60000000/dsa' ],
1098          }],
1099          [ 'v8_target_arch=="ppc64"', {
1100            'cflags': [ '-maix64', '-fdollars-in-identifiers' ],
1101            'ldflags': [ '-maix64 -Wl,-bbigtoc' ],
1102          }],
1103        ],
1104      }],
1105    ],  # conditions
1106    'configurations': {
1107      'Debug': {
1108        'defines': [
1109          'ENABLE_DISASSEMBLER',
1110          'V8_ENABLE_CHECKS',
1111          'OBJECT_PRINT',
1112          'VERIFY_HEAP',
1113          'DEBUG',
1114          'V8_TRACE_MAPS',
1115          'V8_ENABLE_ALLOCATION_TIMEOUT',
1116          'V8_ENABLE_FORCE_SLOW_PATH',
1117        ],
1118        'conditions': [
1119          ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
1120            OS=="qnx" or OS=="aix"', {
1121            'cflags': [ '-Woverloaded-virtual', '<(wno_array_bounds)', ],
1122          }],
1123          ['OS=="linux" and v8_enable_backtrace==1', {
1124            # Support for backtrace_symbols.
1125            'ldflags': [ '-rdynamic' ],
1126          }],
1127          ['OS=="aix"', {
1128            'ldflags': [ '-Wl,-bbigtoc' ],
1129            'conditions': [
1130              ['v8_target_arch=="ppc64"', {
1131                'cflags': [ '-maix64 -mcmodel=large' ],
1132              }],
1133            ],
1134          }],
1135          ['OS=="android"', {
1136            'variables': {
1137              'android_full_debug%': 1,
1138            },
1139            'conditions': [
1140              ['android_full_debug==0', {
1141                # Disable full debug if we want a faster v8 in a debug build.
1142                # TODO(2304): pass DISABLE_DEBUG_ASSERT instead of hiding DEBUG.
1143                'defines!': [
1144                  'DEBUG',
1145                  'ENABLE_SLOW_DCHECKS',
1146                ],
1147              }],
1148            ],
1149          }],
1150          ['v8_optimized_debug==0', {
1151            'msvs_settings': {
1152              'VCCLCompilerTool': {
1153                'Optimization': '0',
1154                'conditions': [
1155                  ['component=="shared_library" or force_dynamic_crt==1', {
1156                    'RuntimeLibrary': '3',  # /MDd
1157                  }, {
1158                     'RuntimeLibrary': '1',  # /MTd
1159                   }],
1160                ],
1161              },
1162              'VCLinkerTool': {
1163                'LinkIncremental': '2',
1164              },
1165            },
1166            'variables': {
1167              'v8_enable_slow_dchecks%': 1,
1168            },
1169            'conditions': [
1170              ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
1171            OS=="qnx" or OS=="aix"', {
1172                'cflags!': [
1173                  '-O3',
1174                  '-O2',
1175                  '-O1',
1176                  '-Os',
1177                ],
1178                'cflags': [
1179                  '-fdata-sections',
1180                  '-ffunction-sections',
1181                ],
1182              }],
1183              ['OS=="mac"', {
1184                'xcode_settings': {
1185                  'GCC_OPTIMIZATION_LEVEL': '0',  # -O0
1186                },
1187              }],
1188              ['v8_enable_slow_dchecks==1', {
1189                'defines': [
1190                  'ENABLE_SLOW_DCHECKS',
1191                ],
1192              }],
1193            ],
1194          }, {
1195            'msvs_settings': {
1196              'VCCLCompilerTool': {
1197                'Optimization': '2',
1198                'InlineFunctionExpansion': '2',
1199                'EnableIntrinsicFunctions': 'true',
1200                'FavorSizeOrSpeed': '0',
1201                'StringPooling': 'true',
1202                'BasicRuntimeChecks': '0',
1203                'conditions': [
1204                  ['component=="shared_library" or force_dynamic_crt==1', {
1205                    'RuntimeLibrary': '3',  #/MDd
1206                  }, {
1207                     'RuntimeLibrary': '1',  #/MTd
1208                   }],
1209                ],
1210              },
1211              'VCLinkerTool': {
1212                'LinkIncremental': '1',
1213                'OptimizeReferences': '2',
1214                'EnableCOMDATFolding': '2',
1215              },
1216            },
1217            'variables': {
1218              'v8_enable_slow_dchecks%': 0,
1219            },
1220            'conditions': [
1221              ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
1222            OS=="qnx" or OS=="aix"', {
1223                'cflags!': [
1224                  '-O0',
1225                  '-O1',
1226                  '-Os',
1227                ],
1228                'cflags': [
1229                  '-fdata-sections',
1230                  '-ffunction-sections',
1231                ],
1232                'conditions': [
1233                  # Don't use -O3 with sanitizers.
1234                  ['asan==0 and msan==0 and lsan==0 \
1235                and tsan==0 and ubsan==0 and ubsan_vptr==0', {
1236                    'cflags': ['-O3'],
1237                    'cflags!': ['-O2'],
1238                  }, {
1239                     'cflags': ['-O2'],
1240                     'cflags!': ['-O3'],
1241                   }],
1242                ],
1243              }],
1244              ['OS=="mac"', {
1245                'xcode_settings': {
1246                  'GCC_OPTIMIZATION_LEVEL': '3',  # -O3
1247                  'GCC_STRICT_ALIASING': 'YES',
1248                },
1249              }],
1250              ['v8_enable_slow_dchecks==1', {
1251                'defines': [
1252                  'ENABLE_SLOW_DCHECKS',
1253                ],
1254              }],
1255            ],
1256          }],
1257          # Temporary refs: https://github.com/nodejs/node/pull/23801
1258          ['v8_enable_handle_zapping==1', {
1259            'defines': ['ENABLE_HANDLE_ZAPPING',],
1260          }],
1261        ],
1262
1263      },  # DebugBaseCommon
1264      'Release': {
1265        'variables': {
1266          'v8_enable_slow_dchecks%': 0,
1267        },
1268         # Temporary refs: https://github.com/nodejs/node/pull/23801
1269        'defines!': ['ENABLE_HANDLE_ZAPPING',],
1270        'conditions': [
1271          ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" \
1272            or OS=="aix"', {
1273            'cflags!': [
1274              '-Os',
1275            ],
1276            'cflags': [
1277              '-fdata-sections',
1278              '-ffunction-sections',
1279              '<(wno_array_bounds)',
1280            ],
1281            'conditions': [
1282              # Don't use -O3 with sanitizers.
1283              ['asan==0 and msan==0 and lsan==0 \
1284                and tsan==0 and ubsan==0 and ubsan_vptr==0', {
1285                'cflags': ['-O3'],
1286                'cflags!': ['-O2'],
1287              }, {
1288                'cflags': ['-O2'],
1289                'cflags!': ['-O3'],
1290              }],
1291            ],
1292          }],
1293          ['OS=="android"', {
1294            'cflags!': [
1295              '-O3',
1296              '-Os',
1297            ],
1298            'cflags': [
1299              '-fdata-sections',
1300              '-ffunction-sections',
1301              '-O2',
1302            ],
1303          }],
1304          ['OS=="mac"', {
1305            'xcode_settings': {
1306              'GCC_OPTIMIZATION_LEVEL': '3',  # -O3
1307
1308              # -fstrict-aliasing.  Mainline gcc
1309              # enables this at -O2 and above,
1310              # but Apple gcc does not unless it
1311              # is specified explicitly.
1312              'GCC_STRICT_ALIASING': 'YES',
1313            },
1314          }],  # OS=="mac"
1315          ['OS=="win"', {
1316            'msvs_settings': {
1317              'VCCLCompilerTool': {
1318                'Optimization': '2',
1319                'InlineFunctionExpansion': '2',
1320                'EnableIntrinsicFunctions': 'true',
1321                'FavorSizeOrSpeed': '0',
1322                'StringPooling': 'true',
1323                'conditions': [
1324                  ['component=="shared_library" or force_dynamic_crt==1', {
1325                    'RuntimeLibrary': '2',  #/MD
1326                  }, {
1327                    'RuntimeLibrary': '0',  #/MT
1328                  }],
1329                ],
1330              },
1331              'VCLinkerTool': {
1332                'LinkIncremental': '1',
1333                'OptimizeReferences': '2',
1334                'EnableCOMDATFolding': '2',
1335              },
1336            },
1337          }],  # OS=="win"
1338          ['v8_enable_slow_dchecks==1', {
1339            'defines': [
1340              'ENABLE_SLOW_DCHECKS',
1341            ],
1342          }],
1343        ],  # conditions
1344      },  # Release
1345    },  # configurations
1346    'msvs_disabled_warnings': [
1347      4129,  # unrecognized character escape sequence (torque-generated)
1348      4245,  # Conversion with signed/unsigned mismatch.
1349      4267,  # Conversion with possible loss of data.
1350      4324,  # Padding structure due to alignment.
1351      # 4351, # [refack] Old issue with array init.
1352      4355,  # 'this' used in base member initializer list
1353      4661,  # no suitable definition provided for explicit template instantiation request
1354      4701,  # Potentially uninitialized local variable.
1355      4702,  # Unreachable code.
1356      4703,  # Potentially uninitialized local pointer variable.
1357      4709,  # Comma operator within array index expr (bugged).
1358      # 4714,  # Function marked forceinline not inlined.
1359      4715,  # Not all control paths return a value. (see https://crbug.com/v8/7658)
1360      4718,  # Recursive call has no side-effect.
1361      4723,  # https://crbug.com/v8/7771
1362      4724,  # https://crbug.com/v8/7771
1363      4800,  # Forcing value to bool.
1364    ],
1365  },  # target_defaults
1366}
1367