Home | History | Annotate | Download | only in gypfiles
      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     'has_valgrind%': 0,
     41     'coverage%': 0,
     42     'v8_target_arch%': '<(target_arch)',
     43     'v8_host_byteorder%': '<!(python -c "import sys; print sys.byteorder")',
     44     # Native Client builds currently use the V8 ARM JIT and
     45     # arm/simulator-arm.cc to defer the significant effort required
     46     # for NaCl JIT support. The nacl_target_arch variable provides
     47     # the 'true' target arch for places in this file that need it.
     48     # TODO(bradchen): get rid of nacl_target_arch when someday
     49     # NaCl V8 builds stop using the ARM simulator
     50     'nacl_target_arch%': 'none',     # must be set externally
     51 
     52     # Setting 'v8_can_use_vfp32dregs' to 'true' will cause V8 to use the VFP
     53     # registers d16-d31 in the generated code, both in the snapshot and for the
     54     # ARM target. Leaving the default value of 'false' will avoid the use of
     55     # these registers in the snapshot and use CPU feature probing when running
     56     # on the target.
     57     'v8_can_use_vfp32dregs%': 'false',
     58     'arm_test_noprobe%': 'off',
     59 
     60     # Similar to vfp but on MIPS.
     61     'v8_can_use_fpu_instructions%': 'true',
     62 
     63     # Similar to the ARM hard float ABI but on MIPS.
     64     'v8_use_mips_abi_hardfloat%': 'true',
     65 
     66     # Force disable libstdc++ debug mode.
     67     'disable_glibcxx_debug%': 0,
     68 
     69     'v8_enable_backtrace%': 0,
     70 
     71     # Enable profiling support. Only required on Windows.
     72     'v8_enable_prof%': 0,
     73 
     74     # Some versions of GCC 4.5 seem to need -fno-strict-aliasing.
     75     'v8_no_strict_aliasing%': 0,
     76 
     77     # Chrome needs this definition unconditionally. For standalone V8 builds,
     78     # it's handled in gypfiles/standalone.gypi.
     79     'want_separate_host_toolset%': 1,
     80 
     81     # Toolset the shell binary should be compiled for. Possible values are
     82     # 'host' and 'target'.
     83     # The setting is ignored if want_separate_host_toolset is 0.
     84     'v8_toolset_for_shell%': 'target',
     85 
     86     'host_os%': '<(OS)',
     87     'werror%': '-Werror',
     88     # For a shared library build, results in "libv8-<(soname_version).so".
     89     'soname_version%': '',
     90 
     91     # Allow to suppress the array bounds warning (default is no suppression).
     92     'wno_array_bounds%': '',
     93 
     94     # Override where to find binutils
     95     'binutils_dir%': '',
     96 
     97     'conditions': [
     98       ['OS=="linux" and host_arch=="x64"', {
     99         'binutils_dir%': 'third_party/binutils/Linux_x64/Release/bin',
    100       }],
    101       ['OS=="linux" and host_arch=="ia32"', {
    102         'binutils_dir%': 'third_party/binutils/Linux_ia32/Release/bin',
    103       }],
    104 
    105       # linux_use_bundled_gold: whether to use the gold linker binary checked
    106       # into third_party/binutils.  Force this off via GYP_DEFINES when you
    107       # are using a custom toolchain and need to control -B in ldflags.
    108       # Do not use 32-bit gold on 32-bit hosts as it runs out address space
    109       # for component=static_library builds.
    110       ['OS=="linux" and (target_arch=="x64" or target_arch=="arm")', {
    111         'linux_use_bundled_gold%': 1,
    112       }, {
    113         'linux_use_bundled_gold%': 0,
    114       }],
    115       # linux_use_bundled_binutils: whether to use the binary binutils
    116       # checked into third_party/binutils.  These are not multi-arch so cannot
    117       # be used except on x86 and x86-64 (the only two architectures which
    118       # are currently checke in).  Force this off via GYP_DEFINES when you
    119       # are using a custom toolchain and need to control -B in cflags.
    120       ['OS=="linux" and (target_arch=="ia32" or target_arch=="x64")', {
    121         'linux_use_bundled_binutils%': 1,
    122       }, {
    123         'linux_use_bundled_binutils%': 0,
    124       }],
    125       # linux_use_gold_flags: whether to use build flags that rely on gold.
    126       # On by default for x64 Linux.
    127       ['OS=="linux" and target_arch=="x64"', {
    128         'linux_use_gold_flags%': 1,
    129       }, {
    130         'linux_use_gold_flags%': 0,
    131       }],
    132     ],
    133 
    134     # Link-Time Optimizations
    135     'use_lto%': 0,
    136 
    137     # Indicates if gcmole tools are downloaded by a hook.
    138     'gcmole%': 0,
    139   },
    140   'conditions': [
    141     ['host_arch=="ia32" or host_arch=="x64" or \
    142       host_arch=="ppc" or host_arch=="ppc64" or \
    143       host_arch=="s390" or host_arch=="s390x" or \
    144       clang==1', {
    145       'variables': {
    146         'host_cxx_is_biarch%': 1,
    147        },
    148      }, {
    149       'variables': {
    150         'host_cxx_is_biarch%': 0,
    151       },
    152     }],
    153     ['target_arch=="ia32" or target_arch=="x64" or target_arch=="x87" or \
    154       target_arch=="ppc" or target_arch=="ppc64" or target_arch=="s390" or \
    155       target_arch=="s390x" or clang==1', {
    156       'variables': {
    157         'target_cxx_is_biarch%': 1,
    158        },
    159      }, {
    160       'variables': {
    161         'target_cxx_is_biarch%': 0,
    162       },
    163     }],
    164   ],
    165   'target_defaults': {
    166     'conditions': [
    167       ['v8_target_arch=="arm"', {
    168         'defines': [
    169           'V8_TARGET_ARCH_ARM',
    170         ],
    171         'conditions': [
    172           [ 'arm_version==7 or arm_version=="default"', {
    173             'defines': [
    174               'CAN_USE_ARMV7_INSTRUCTIONS',
    175             ],
    176           }],
    177           [ 'arm_fpu=="vfpv3-d16" or arm_fpu=="default"', {
    178             'defines': [
    179               'CAN_USE_VFP3_INSTRUCTIONS',
    180             ],
    181           }],
    182           [ 'arm_fpu=="vfpv3"', {
    183             'defines': [
    184               'CAN_USE_VFP3_INSTRUCTIONS',
    185               'CAN_USE_VFP32DREGS',
    186             ],
    187           }],
    188           [ 'arm_fpu=="neon"', {
    189             'defines': [
    190               'CAN_USE_VFP3_INSTRUCTIONS',
    191               'CAN_USE_VFP32DREGS',
    192               'CAN_USE_NEON',
    193             ],
    194           }],
    195           [ 'arm_test_noprobe=="on"', {
    196             'defines': [
    197               'ARM_TEST_NO_FEATURE_PROBE',
    198             ],
    199           }],
    200         ],
    201         'target_conditions': [
    202           ['_toolset=="host"', {
    203             'conditions': [
    204               ['v8_target_arch==host_arch', {
    205                 # Host built with an Arm CXX compiler.
    206                 'conditions': [
    207                   [ 'arm_version==7', {
    208                     'cflags': ['-march=armv7-a',],
    209                   }],
    210                   [ 'arm_version==7 or arm_version=="default"', {
    211                     'conditions': [
    212                       [ 'arm_fpu!="default"', {
    213                         'cflags': ['-mfpu=<(arm_fpu)',],
    214                       }],
    215                     ],
    216                   }],
    217                   [ 'arm_float_abi!="default"', {
    218                     'cflags': ['-mfloat-abi=<(arm_float_abi)',],
    219                   }],
    220                   [ 'arm_thumb==1', {
    221                     'cflags': ['-mthumb',],
    222                   }],
    223                   [ 'arm_thumb==0', {
    224                     'cflags': ['-marm',],
    225                   }],
    226                 ],
    227               }, {
    228                 # 'v8_target_arch!=host_arch'
    229                 # Host not built with an Arm CXX compiler (simulator build).
    230                 'conditions': [
    231                   [ 'arm_float_abi=="hard"', {
    232                     'defines': [
    233                       'USE_EABI_HARDFLOAT=1',
    234                     ],
    235                   }],
    236                   [ 'arm_float_abi=="softfp" or arm_float_abi=="default"', {
    237                     'defines': [
    238                       'USE_EABI_HARDFLOAT=0',
    239                     ],
    240                   }],
    241                 ],
    242               }],
    243             ],
    244           }],  # _toolset=="host"
    245           ['_toolset=="target"', {
    246             'conditions': [
    247               ['v8_target_arch==target_arch', {
    248                 # Target built with an Arm CXX compiler.
    249                 'conditions': [
    250                   [ 'arm_version==7', {
    251                     'cflags': ['-march=armv7-a',],
    252                   }],
    253                   [ 'arm_version==7 or arm_version=="default"', {
    254                     'conditions': [
    255                       [ 'arm_fpu!="default"', {
    256                         'cflags': ['-mfpu=<(arm_fpu)',],
    257                       }],
    258                     ],
    259                   }],
    260                   [ 'arm_float_abi!="default"', {
    261                     'cflags': ['-mfloat-abi=<(arm_float_abi)',],
    262                   }],
    263                   [ 'arm_thumb==1', {
    264                     'cflags': ['-mthumb',],
    265                   }],
    266                   [ 'arm_thumb==0', {
    267                     'cflags': ['-marm',],
    268                   }],
    269                 ],
    270               }, {
    271                 # 'v8_target_arch!=target_arch'
    272                 # Target not built with an Arm CXX compiler (simulator build).
    273                 'conditions': [
    274                   [ 'arm_float_abi=="hard"', {
    275                     'defines': [
    276                       'USE_EABI_HARDFLOAT=1',
    277                     ],
    278                   }],
    279                   [ 'arm_float_abi=="softfp" or arm_float_abi=="default"', {
    280                     'defines': [
    281                       'USE_EABI_HARDFLOAT=0',
    282                     ],
    283                   }],
    284                 ],
    285               }],
    286               # Disable GCC LTO for v8
    287               # v8 is optimized for speed. Because GCC LTO merges flags at link
    288               # time, we disable LTO to prevent any -O2 flags from taking
    289               # precedence over v8's -Os flag. However, LLVM LTO does not work
    290               # this way so we keep LTO enabled under LLVM.
    291               ['clang==0 and 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=="s390" or v8_target_arch=="s390x"', {
    307         'defines': [
    308           'V8_TARGET_ARCH_S390',
    309         ],
    310         'conditions': [
    311           ['v8_target_arch=="s390x"', {
    312             'defines': [
    313               'V8_TARGET_ARCH_S390X',
    314             ],
    315           }],
    316           ['v8_host_byteorder=="little"', {
    317             'defines': [
    318               'V8_TARGET_ARCH_S390_LE_SIM',
    319             ],
    320           }],
    321           ],
    322       }],  # s390
    323       ['v8_target_arch=="ppc" or v8_target_arch=="ppc64"', {
    324         'defines': [
    325           'V8_TARGET_ARCH_PPC',
    326         ],
    327         'conditions': [
    328           ['v8_target_arch=="ppc64"', {
    329             'defines': [
    330               'V8_TARGET_ARCH_PPC64',
    331             ],
    332           }],
    333           ['v8_host_byteorder=="little"', {
    334             'defines': [
    335               'V8_TARGET_ARCH_PPC_LE',
    336             ],
    337           }],
    338           ['v8_host_byteorder=="big"', {
    339             'defines': [
    340               'V8_TARGET_ARCH_PPC_BE',
    341             ],
    342             'conditions': [
    343               ['OS=="aix"', {
    344                 # Work around AIX ceil, trunc and round oddities.
    345                 'cflags': [ '-mcpu=power5+ -mfprnd' ],
    346               }],
    347               ['OS=="aix"', {
    348                 # Work around AIX assembler popcntb bug.
    349                 'cflags': [ '-mno-popcntb' ],
    350               }],
    351             ],
    352           }],
    353         ],
    354       }],  # ppc
    355       ['v8_target_arch=="ia32"', {
    356         'defines': [
    357           'V8_TARGET_ARCH_IA32',
    358         ],
    359       }],  # v8_target_arch=="ia32"
    360       ['v8_target_arch=="x87"', {
    361         'defines': [
    362           'V8_TARGET_ARCH_X87',
    363         ],
    364         'cflags': ['-march=i586'],
    365       }],  # v8_target_arch=="x87"
    366       ['(v8_target_arch=="mips" or v8_target_arch=="mipsel" \
    367         or v8_target_arch=="mips64" or v8_target_arch=="mips64el") \
    368          and v8_target_arch==target_arch', {
    369         'target_conditions': [
    370           ['_toolset=="target"', {
    371             # Target built with a Mips CXX compiler.
    372             'variables': {
    373               'ldso_path%': '<!(/bin/echo -n $LDSO_PATH)',
    374               'ld_r_path%': '<!(/bin/echo -n $LD_R_PATH)',
    375             },
    376             'conditions': [
    377               ['ldso_path!=""', {
    378                 'ldflags': ['-Wl,--dynamic-linker=<(ldso_path)'],
    379               }],
    380               ['ld_r_path!=""', {
    381                 'ldflags': ['-Wl,--rpath=<(ld_r_path)'],
    382               }],
    383               [ 'clang==1', {
    384                 'cflags': ['-integrated-as'],
    385               }],
    386             ],
    387           }],
    388         ],
    389       }],
    390       ['v8_target_arch=="mips"', {
    391         'defines': [
    392           'V8_TARGET_ARCH_MIPS',
    393         ],
    394         'conditions': [
    395           [ 'v8_can_use_fpu_instructions=="true"', {
    396             'defines': [
    397               'CAN_USE_FPU_INSTRUCTIONS',
    398             ],
    399           }],
    400           [ 'v8_use_mips_abi_hardfloat=="true"', {
    401             'defines': [
    402               '__mips_hard_float=1',
    403               'CAN_USE_FPU_INSTRUCTIONS',
    404             ],
    405           }, {
    406             'defines': [
    407               '__mips_soft_float=1'
    408             ]
    409           }],
    410         ],
    411         'target_conditions': [
    412           ['_toolset=="target"', {
    413             'conditions': [
    414               ['v8_target_arch==target_arch', {
    415                 # Target built with a Mips CXX compiler.
    416                 'cflags': [
    417                   '-EB',
    418                   '-Wno-error=array-bounds',  # Workaround https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56273
    419                 ],
    420                 'ldflags': ['-EB'],
    421                 'conditions': [
    422                   [ 'v8_use_mips_abi_hardfloat=="true"', {
    423                     'cflags': ['-mhard-float'],
    424                     'ldflags': ['-mhard-float'],
    425                   }, {
    426                     'cflags': ['-msoft-float'],
    427                     'ldflags': ['-msoft-float'],
    428                   }],
    429                   ['mips_arch_variant=="r6"', {
    430                     'defines': [
    431                       '_MIPS_ARCH_MIPS32R6',
    432                       'FPU_MODE_FP64',
    433                     ],
    434                     'cflags!': ['-mfp32', '-mfpxx'],
    435                     'conditions': [
    436                       [ 'clang==0', {
    437                         'cflags': ['-Wa,-mips32r6'],
    438                       }],
    439                     ],
    440                     'cflags': ['-mips32r6'],
    441                     'ldflags': ['-mips32r6'],
    442                   }],
    443                   ['mips_arch_variant=="r2"', {
    444                     'conditions': [
    445                       [ 'mips_fpu_mode=="fp64"', {
    446                         'defines': [
    447                           '_MIPS_ARCH_MIPS32R2',
    448                           'FPU_MODE_FP64',
    449                         ],
    450                         'cflags': ['-mfp64'],
    451                       }],
    452                       ['mips_fpu_mode=="fpxx"', {
    453                         'defines': [
    454                           '_MIPS_ARCH_MIPS32R2',
    455                           'FPU_MODE_FPXX',
    456                         ],
    457                         'cflags': ['-mfpxx'],
    458                       }],
    459                       ['mips_fpu_mode=="fp32"', {
    460                         'defines': [
    461                           '_MIPS_ARCH_MIPS32R2',
    462                           'FPU_MODE_FP32',
    463                         ],
    464                         'cflags': ['-mfp32'],
    465                       }],
    466                       [ 'clang==0', {
    467                         'cflags': ['-Wa,-mips32r2'],
    468                       }],
    469                     ],
    470                     'cflags': ['-mips32r2'],
    471                     'ldflags': ['-mips32r2'],
    472                   }],
    473                   ['mips_arch_variant=="r1"', {
    474                     'defines': [
    475                       'FPU_MODE_FP32',
    476                     ],
    477                     'cflags!': ['-mfp64', '-mfpxx'],
    478                     'conditions': [
    479                       [ 'clang==0', {
    480                         'cflags': ['-Wa,-mips32'],
    481                       }],
    482                     ],
    483                     'cflags': ['-mips32'],
    484                     'ldflags': ['-mips32'],
    485                   }],
    486                   ['mips_arch_variant=="rx"', {
    487                     'defines': [
    488                       '_MIPS_ARCH_MIPS32RX',
    489                       'FPU_MODE_FPXX',
    490                     ],
    491                     'cflags!': ['-mfp64', '-mfp32'],
    492                     'conditions': [
    493                       [ 'clang==0', {
    494                         'cflags': ['-Wa,-mips32'],
    495                       }],
    496                     ],
    497                     'cflags': ['-mips32', '-mfpxx'],
    498                     'ldflags': ['-mips32'],
    499                   }],
    500                 ],
    501               }, {
    502                 # 'v8_target_arch!=target_arch'
    503                 # Target not built with an MIPS CXX compiler (simulator build).
    504                 'conditions': [
    505                   ['mips_arch_variant=="r6"', {
    506                     'defines': [
    507                       '_MIPS_ARCH_MIPS32R6',
    508                       'FPU_MODE_FP64',
    509                     ],
    510                   }],
    511                   ['mips_arch_variant=="r2"', {
    512                     'conditions': [
    513                       [ 'mips_fpu_mode=="fp64"', {
    514                         'defines': [
    515                           '_MIPS_ARCH_MIPS32R2',
    516                           'FPU_MODE_FP64',
    517                         ],
    518                       }],
    519                       ['mips_fpu_mode=="fpxx"', {
    520                         'defines': [
    521                           '_MIPS_ARCH_MIPS32R2',
    522                           'FPU_MODE_FPXX',
    523                         ],
    524                       }],
    525                       ['mips_fpu_mode=="fp32"', {
    526                         'defines': [
    527                           '_MIPS_ARCH_MIPS32R2',
    528                           'FPU_MODE_FP32',
    529                         ],
    530                       }],
    531                     ],
    532                   }],
    533                   ['mips_arch_variant=="r1"', {
    534                     'defines': [
    535                       'FPU_MODE_FP32',
    536                     ],
    537                   }],
    538                   ['mips_arch_variant=="rx"', {
    539                     'defines': [
    540                       '_MIPS_ARCH_MIPS32RX',
    541                       'FPU_MODE_FPXX',
    542                     ],
    543                   }],
    544                 ],
    545               }],
    546             ],
    547           }],  #_toolset=="target"
    548           ['_toolset=="host"', {
    549             'conditions': [
    550               ['mips_arch_variant=="rx"', {
    551                 'defines': [
    552                   '_MIPS_ARCH_MIPS32RX',
    553                   'FPU_MODE_FPXX',
    554                 ],
    555               }],
    556               ['mips_arch_variant=="r6"', {
    557                 'defines': [
    558                   '_MIPS_ARCH_MIPS32R6',
    559                   'FPU_MODE_FP64',
    560                 ],
    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=="r2"', {
    645                     'conditions': [
    646                       [ 'mips_fpu_mode=="fp64"', {
    647                         'defines': [
    648                           '_MIPS_ARCH_MIPS32R2',
    649                           'FPU_MODE_FP64',
    650                         ],
    651                         'cflags': ['-mfp64'],
    652                       }],
    653                       ['mips_fpu_mode=="fpxx"', {
    654                         'defines': [
    655                           '_MIPS_ARCH_MIPS32R2',
    656                           'FPU_MODE_FPXX',
    657                         ],
    658                         'cflags': ['-mfpxx'],
    659                       }],
    660                       ['mips_fpu_mode=="fp32"', {
    661                         'defines': [
    662                           '_MIPS_ARCH_MIPS32R2',
    663                           'FPU_MODE_FP32',
    664                         ],
    665                         'cflags': ['-mfp32'],
    666                       }],
    667                       [ 'clang==0', {
    668                         'cflags': ['-Wa,-mips32r2'],
    669                       }],
    670                     ],
    671                     'cflags': ['-mips32r2'],
    672                     'ldflags': ['-mips32r2'],
    673                   }],
    674                   ['mips_arch_variant=="r1"', {
    675                     'defines': [
    676                       'FPU_MODE_FP32',
    677                     ],
    678                     'cflags!': ['-mfp64', '-mfpxx'],
    679                     'conditions': [
    680                       [ 'clang==0', {
    681                         'cflags': ['-Wa,-mips32'],
    682                       }],
    683                     ],
    684                     'cflags': ['-mips32'],
    685                     'ldflags': ['-mips32'],
    686                   }],
    687                   ['mips_arch_variant=="rx"', {
    688                     'defines': [
    689                       '_MIPS_ARCH_MIPS32RX',
    690                       'FPU_MODE_FPXX',
    691                     ],
    692                     'cflags!': ['-mfp64', '-mfp32'],
    693                     'conditions': [
    694                       [ 'clang==0', {
    695                         'cflags': ['-Wa,-mips32'],
    696                       }],
    697                     ],
    698                     'cflags': ['-mips32', '-mfpxx'],
    699                     'ldflags': ['-mips32'],
    700                   }],
    701                   ['mips_arch_variant=="loongson"', {
    702                     'defines': [
    703                       '_MIPS_ARCH_LOONGSON',
    704                       'FPU_MODE_FP32',
    705                     ],
    706                     'cflags!': ['-mfp64', '-mfpxx'],
    707                     'conditions': [
    708                       [ 'clang==0', {
    709                         'cflags': ['-Wa,-mips3'],
    710                       }],
    711                     ],
    712                     'cflags': ['-mips3', '-mfp32'],
    713                   }],
    714                 ],
    715               }, {
    716                 # 'v8_target_arch!=target_arch'
    717                 # Target not built with an MIPS CXX compiler (simulator build).
    718                 'conditions': [
    719                   ['mips_arch_variant=="r6"', {
    720                     'defines': [
    721                       '_MIPS_ARCH_MIPS32R6',
    722                       'FPU_MODE_FP64',
    723                     ],
    724                   }],
    725                   ['mips_arch_variant=="r2"', {
    726                     'conditions': [
    727                       [ 'mips_fpu_mode=="fp64"', {
    728                         'defines': [
    729                           '_MIPS_ARCH_MIPS32R2',
    730                           'FPU_MODE_FP64',
    731                         ],
    732                       }],
    733                       ['mips_fpu_mode=="fpxx"', {
    734                         'defines': [
    735                           '_MIPS_ARCH_MIPS32R2',
    736                           'FPU_MODE_FPXX',
    737                         ],
    738                       }],
    739                       ['mips_fpu_mode=="fp32"', {
    740                         'defines': [
    741                           '_MIPS_ARCH_MIPS32R2',
    742                           'FPU_MODE_FP32',
    743                         ],
    744                       }],
    745                     ],
    746                   }],
    747                   ['mips_arch_variant=="r1"', {
    748                     'defines': [
    749                       'FPU_MODE_FP32',
    750                     ],
    751                   }],
    752                   ['mips_arch_variant=="rx"', {
    753                     'defines': [
    754                       '_MIPS_ARCH_MIPS32RX',
    755                       'FPU_MODE_FPXX',
    756                     ],
    757                   }],
    758                   ['mips_arch_variant=="loongson"', {
    759                     'defines': [
    760                       '_MIPS_ARCH_LOONGSON',
    761                       'FPU_MODE_FP32',
    762                     ],
    763                   }],
    764                 ],
    765               }],
    766             ],
    767           }], #_toolset=="target
    768           ['_toolset=="host"', {
    769             'conditions': [
    770               ['mips_arch_variant=="rx"', {
    771                 'defines': [
    772                   '_MIPS_ARCH_MIPS32RX',
    773                   'FPU_MODE_FPXX',
    774                 ],
    775               }],
    776               ['mips_arch_variant=="r6"', {
    777                 'defines': [
    778                   '_MIPS_ARCH_MIPS32R6',
    779                   'FPU_MODE_FP64',
    780                 ],
    781               }],
    782               ['mips_arch_variant=="r2"', {
    783                 'conditions': [
    784                   ['mips_fpu_mode=="fp64"', {
    785                     'defines': [
    786                       '_MIPS_ARCH_MIPS32R2',
    787                       'FPU_MODE_FP64',
    788                     ],
    789                   }],
    790                   ['mips_fpu_mode=="fpxx"', {
    791                     'defines': [
    792                       '_MIPS_ARCH_MIPS32R2',
    793                       'FPU_MODE_FPXX',
    794                     ],
    795                   }],
    796                   ['mips_fpu_mode=="fp32"', {
    797                     'defines': [
    798                       '_MIPS_ARCH_MIPS32R2',
    799                       'FPU_MODE_FP32'
    800                     ],
    801                   }],
    802                 ],
    803               }],
    804               ['mips_arch_variant=="r1"', {
    805                 'defines': ['FPU_MODE_FP32',],
    806               }],
    807               ['mips_arch_variant=="loongson"', {
    808                 'defines': [
    809                   '_MIPS_ARCH_LOONGSON',
    810                   'FPU_MODE_FP32',
    811                 ],
    812               }],
    813             ]
    814           }],
    815         ],
    816       }],  # v8_target_arch=="mipsel"
    817       ['v8_target_arch=="mips64el" or v8_target_arch=="mips64"', {
    818         'defines': [
    819           'V8_TARGET_ARCH_MIPS64',
    820         ],
    821         'conditions': [
    822           [ 'v8_can_use_fpu_instructions=="true"', {
    823             'defines': [
    824               'CAN_USE_FPU_INSTRUCTIONS',
    825             ],
    826           }],
    827           [ 'v8_host_byteorder=="little"', {
    828             'defines': [
    829               'V8_TARGET_ARCH_MIPS64_LE',
    830             ],
    831           }],
    832           [ 'v8_host_byteorder=="big"', {
    833             'defines': [
    834               'V8_TARGET_ARCH_MIPS64_BE',
    835             ],
    836           }],
    837           [ 'v8_use_mips_abi_hardfloat=="true"', {
    838             'defines': [
    839               '__mips_hard_float=1',
    840               'CAN_USE_FPU_INSTRUCTIONS',
    841             ],
    842           }, {
    843             'defines': [
    844               '__mips_soft_float=1'
    845             ],
    846           }],
    847          ],
    848         'target_conditions': [
    849           ['_toolset=="target"', {
    850             'conditions': [
    851               ['v8_target_arch==target_arch', {
    852                 'cflags': [
    853                   '-Wno-error=array-bounds',  # Workaround https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56273
    854                 ],
    855                 'conditions': [
    856                   ['v8_target_arch=="mips64el"', {
    857                     'cflags': ['-EL'],
    858                     'ldflags': ['-EL'],
    859                   }],
    860                   ['v8_target_arch=="mips64"', {
    861                     'cflags': ['-EB'],
    862                     'ldflags': ['-EB'],
    863                   }],
    864                   [ 'v8_use_mips_abi_hardfloat=="true"', {
    865                     'cflags': ['-mhard-float'],
    866                     'ldflags': ['-mhard-float'],
    867                   }, {
    868                     'cflags': ['-msoft-float'],
    869                     'ldflags': ['-msoft-float'],
    870                   }],
    871                   ['mips_arch_variant=="r6"', {
    872                     'defines': ['_MIPS_ARCH_MIPS64R6',],
    873                     'conditions': [
    874                       [ 'clang==0', {
    875                         'cflags': ['-Wa,-mips64r6'],
    876                       }],
    877                     ],
    878                     'cflags': ['-mips64r6', '-mabi=64'],
    879                     'ldflags': ['-mips64r6', '-mabi=64'],
    880                   }],
    881                   ['mips_arch_variant=="r2"', {
    882                     'defines': ['_MIPS_ARCH_MIPS64R2',],
    883                     'conditions': [
    884                       [ 'clang==0', {
    885                         'cflags': ['-Wa,-mips64r2'],
    886                       }],
    887                     ],
    888                     'cflags': ['-mips64r2', '-mabi=64'],
    889                     'ldflags': ['-mips64r2', '-mabi=64'],
    890                   }],
    891                 ],
    892               }, {
    893                 # 'v8_target_arch!=target_arch'
    894                 # Target not built with an MIPS CXX compiler (simulator build).
    895                 'conditions': [
    896                   ['mips_arch_variant=="r6"', {
    897                     'defines': ['_MIPS_ARCH_MIPS64R6',],
    898                   }],
    899                   ['mips_arch_variant=="r2"', {
    900                     'defines': ['_MIPS_ARCH_MIPS64R2',],
    901                   }],
    902                 ],
    903               }],
    904             ],
    905           }],  #'_toolset=="target"
    906           ['_toolset=="host"', {
    907             'conditions': [
    908               ['mips_arch_variant=="r6"', {
    909                 'defines': ['_MIPS_ARCH_MIPS64R6',],
    910               }],
    911               ['mips_arch_variant=="r2"', {
    912                 'defines': ['_MIPS_ARCH_MIPS64R2',],
    913               }],
    914             ],
    915           }],  #'_toolset=="host"
    916         ],
    917       }],  # v8_target_arch=="mips64el"
    918       ['v8_target_arch=="x64"', {
    919         'defines': [
    920           'V8_TARGET_ARCH_X64',
    921         ],
    922         'xcode_settings': {
    923           'ARCHS': [ 'x86_64' ],
    924         },
    925         'msvs_settings': {
    926           'VCLinkerTool': {
    927             'StackReserveSize': '2097152',
    928           },
    929         },
    930         'msvs_configuration_platform': 'x64',
    931       }],  # v8_target_arch=="x64"
    932       ['v8_target_arch=="x32"', {
    933         'defines': [
    934           # x32 port shares the source code with x64 port.
    935           'V8_TARGET_ARCH_X64',
    936           'V8_TARGET_ARCH_32_BIT',
    937         ],
    938         'cflags': [
    939           '-mx32',
    940           # Inhibit warning if long long type is used.
    941           '-Wno-long-long',
    942         ],
    943         'ldflags': [
    944           '-mx32',
    945         ],
    946       }],  # v8_target_arch=="x32"
    947       ['linux_use_gold_flags==1', {
    948         # Newer gccs and clangs support -fuse-ld, use the flag to force gold
    949         # selection.
    950         # gcc -- http://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Optimize-Options.html
    951         'ldflags': [ '-fuse-ld=gold', ],
    952       }],
    953       ['linux_use_bundled_binutils==1', {
    954         'cflags': [
    955           '-B<!(cd <(DEPTH) && pwd -P)/<(binutils_dir)',
    956         ],
    957       }],
    958       ['linux_use_bundled_gold==1', {
    959         # Put our binutils, which contains gold in the search path. We pass
    960         # the path to gold to the compiler. gyp leaves unspecified what the
    961         # cwd is when running the compiler, so the normal gyp path-munging
    962         # fails us. This hack gets the right path.
    963         'ldflags': [
    964           '-B<!(cd <(DEPTH) && pwd -P)/<(binutils_dir)',
    965         ],
    966       }],
    967       ['OS=="win"', {
    968         'defines': [
    969           'WIN32',
    970         ],
    971         # 4351: VS 2005 and later are warning us that they've fixed a bug
    972         #       present in VS 2003 and earlier.
    973         'msvs_disabled_warnings': [4351],
    974         'msvs_configuration_attributes': {
    975           'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)',
    976           'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
    977           'CharacterSet': '1',
    978         },
    979       }],
    980       ['OS=="win" and v8_target_arch=="ia32"', {
    981         'msvs_settings': {
    982           'VCCLCompilerTool': {
    983             # Ensure no surprising artifacts from 80bit double math with x86.
    984             'AdditionalOptions': ['/arch:SSE2'],
    985           },
    986         },
    987       }],
    988       ['OS=="win" and v8_enable_prof==1', {
    989         'msvs_settings': {
    990           'VCLinkerTool': {
    991             'GenerateMapFile': 'true',
    992           },
    993         },
    994       }],
    995       ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
    996          or OS=="netbsd" or OS=="mac" or OS=="android" or OS=="qnx") and \
    997         v8_target_arch=="ia32"', {
    998         'cflags': [
    999           '-msse2',
   1000           '-mfpmath=sse',
   1001           '-mmmx',  # Allows mmintrin.h for MMX intrinsics.
   1002         ],
   1003       }],
   1004       ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
   1005          or OS=="netbsd" or OS=="mac" or OS=="android" or OS=="qnx") and \
   1006         (v8_target_arch=="arm" or v8_target_arch=="ia32" or \
   1007          v8_target_arch=="x87" or v8_target_arch=="mips" or \
   1008          v8_target_arch=="mipsel" or v8_target_arch=="ppc" or \
   1009          v8_target_arch=="s390")', {
   1010         'target_conditions': [
   1011           ['_toolset=="host"', {
   1012             'conditions': [
   1013               ['host_cxx_is_biarch==1', {
   1014                 'conditions': [
   1015                   ['host_arch=="s390" or host_arch=="s390x"', {
   1016                     'cflags': [ '-m31' ],
   1017                     'ldflags': [ '-m31' ]
   1018                   },{
   1019                    'cflags': [ '-m32' ],
   1020                    'ldflags': [ '-m32' ]
   1021                   }],
   1022                 ],
   1023               }],
   1024             ],
   1025             'xcode_settings': {
   1026               'ARCHS': [ 'i386' ],
   1027             },
   1028           }],
   1029           ['_toolset=="target"', {
   1030             'conditions': [
   1031               ['target_cxx_is_biarch==1 and nacl_target_arch!="nacl_x64"', {
   1032                 'conditions': [
   1033                   ['host_arch=="s390" or host_arch=="s390x"', {
   1034                     'cflags': [ '-m31' ],
   1035                     'ldflags': [ '-m31' ]
   1036                   },{
   1037                    'cflags': [ '-m32' ],
   1038                    'ldflags': [ '-m32' ],
   1039                   }],
   1040                 ],
   1041               }],
   1042             ],
   1043             'xcode_settings': {
   1044               'ARCHS': [ 'i386' ],
   1045             },
   1046           }],
   1047         ],
   1048       }],
   1049       ['(OS=="linux" or OS=="android") and \
   1050         (v8_target_arch=="x64" or v8_target_arch=="arm64" or \
   1051          v8_target_arch=="ppc64" or v8_target_arch=="s390x")', {
   1052         'target_conditions': [
   1053           ['_toolset=="host"', {
   1054             'conditions': [
   1055               ['host_cxx_is_biarch==1', {
   1056                 'cflags': [ '-m64' ],
   1057                 'ldflags': [ '-m64' ]
   1058               }],
   1059              ],
   1060            }],
   1061            ['_toolset=="target"', {
   1062              'conditions': [
   1063                ['target_cxx_is_biarch==1', {
   1064                  'cflags': [ '-m64' ],
   1065                  'ldflags': [ '-m64' ],
   1066                }],
   1067              ]
   1068            }],
   1069          ],
   1070       }],
   1071       ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
   1072          or OS=="netbsd" or OS=="qnx" or OS=="aix"', {
   1073         'conditions': [
   1074           [ 'v8_no_strict_aliasing==1', {
   1075             'cflags': [ '-fno-strict-aliasing' ],
   1076           }],
   1077         ],  # conditions
   1078       }],
   1079       ['OS=="solaris"', {
   1080         'defines': [ '__C99FEATURES__=1' ],  # isinf() etc.
   1081       }],
   1082       ['OS=="freebsd" or OS=="openbsd"', {
   1083         'cflags': [ '-I/usr/local/include' ],
   1084       }],
   1085       ['OS=="netbsd"', {
   1086         'cflags': [ '-I/usr/pkg/include' ],
   1087       }],
   1088       ['OS=="aix"', {
   1089         'defines': [
   1090           # Support for malloc(0)
   1091           '_LINUX_SOURCE_COMPAT=1',
   1092           '__STDC_FORMAT_MACROS',
   1093           '_ALL_SOURCE=1'],
   1094         'conditions': [
   1095           [ 'v8_target_arch=="ppc"', {
   1096             'ldflags': [ '-Wl,-bmaxdata:0x60000000/dsa' ],
   1097           }],
   1098           [ 'v8_target_arch=="ppc64"', {
   1099             'cflags': [ '-maix64' ],
   1100             'ldflags': [ '-maix64 -Wl,-bbigtoc' ],
   1101           }],
   1102         ],
   1103       }],
   1104     ],  # conditions
   1105     'configurations': {
   1106       # Abstract configuration for v8_optimized_debug == 0.
   1107       'DebugBase0': {
   1108         'abstract': 1,
   1109         'msvs_settings': {
   1110           'VCCLCompilerTool': {
   1111             'Optimization': '0',
   1112             'conditions': [
   1113               ['component=="shared_library"', {
   1114                 'RuntimeLibrary': '3',  # /MDd
   1115               }, {
   1116                 'RuntimeLibrary': '1',  # /MTd
   1117               }],
   1118             ],
   1119           },
   1120           'VCLinkerTool': {
   1121             'LinkIncremental': '2',
   1122           },
   1123         },
   1124         'variables': {
   1125           'v8_enable_slow_dchecks%': 1,
   1126         },
   1127         'conditions': [
   1128           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
   1129             OS=="qnx" or OS=="aix"', {
   1130             'cflags!': [
   1131               '-O3',
   1132               '-O2',
   1133               '-O1',
   1134               '-Os',
   1135             ],
   1136             'cflags': [
   1137               '-fdata-sections',
   1138               '-ffunction-sections',
   1139             ],
   1140           }],
   1141           ['OS=="mac"', {
   1142             'xcode_settings': {
   1143                'GCC_OPTIMIZATION_LEVEL': '0',  # -O0
   1144             },
   1145           }],
   1146           ['v8_enable_slow_dchecks==1', {
   1147             'defines': [
   1148               'ENABLE_SLOW_DCHECKS',
   1149             ],
   1150           }],
   1151         ],
   1152       },  # DebugBase0
   1153       # Abstract configuration for v8_optimized_debug == 1.
   1154       'DebugBase1': {
   1155         'abstract': 1,
   1156         'msvs_settings': {
   1157           'VCCLCompilerTool': {
   1158             'Optimization': '2',
   1159             'InlineFunctionExpansion': '2',
   1160             'EnableIntrinsicFunctions': 'true',
   1161             'FavorSizeOrSpeed': '0',
   1162             'StringPooling': 'true',
   1163             'BasicRuntimeChecks': '0',
   1164             'conditions': [
   1165               ['component=="shared_library"', {
   1166                 'RuntimeLibrary': '3',  #/MDd
   1167               }, {
   1168                 'RuntimeLibrary': '1',  #/MTd
   1169               }],
   1170             ],
   1171           },
   1172           'VCLinkerTool': {
   1173             'LinkIncremental': '1',
   1174             'OptimizeReferences': '2',
   1175             'EnableCOMDATFolding': '2',
   1176           },
   1177         },
   1178         'variables': {
   1179           'v8_enable_slow_dchecks%': 0,
   1180         },
   1181         'conditions': [
   1182           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
   1183             OS=="qnx" or OS=="aix"', {
   1184             'cflags!': [
   1185               '-O0',
   1186               '-O1',
   1187               '-Os',
   1188             ],
   1189             'cflags': [
   1190               '-fdata-sections',
   1191               '-ffunction-sections',
   1192             ],
   1193             'conditions': [
   1194               # TODO(crbug.com/272548): Avoid -O3 in NaCl
   1195               # Don't use -O3 with sanitizers.
   1196               ['nacl_target_arch=="none" and asan==0 and msan==0 and lsan==0 \
   1197                 and tsan==0 and ubsan==0 and ubsan_vptr==0', {
   1198                 'cflags': ['-O3'],
   1199                 'cflags!': ['-O2'],
   1200                 }, {
   1201                 'cflags': ['-O2'],
   1202                 'cflags!': ['-O3'],
   1203               }],
   1204             ],
   1205           }],
   1206           ['OS=="mac"', {
   1207             'xcode_settings': {
   1208               'GCC_OPTIMIZATION_LEVEL': '3',  # -O3
   1209               'GCC_STRICT_ALIASING': 'YES',
   1210             },
   1211           }],
   1212           ['v8_enable_slow_dchecks==1', {
   1213             'defines': [
   1214               'ENABLE_SLOW_DCHECKS',
   1215             ],
   1216           }],
   1217         ],
   1218       },  # DebugBase1
   1219       # Common settings for the Debug configuration.
   1220       'DebugBaseCommon': {
   1221         'abstract': 1,
   1222         'defines': [
   1223           'ENABLE_DISASSEMBLER',
   1224           'V8_ENABLE_CHECKS',
   1225           'OBJECT_PRINT',
   1226           'VERIFY_HEAP',
   1227           'DEBUG',
   1228           'TRACE_MAPS'
   1229         ],
   1230         'conditions': [
   1231           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
   1232             OS=="qnx" or OS=="aix"', {
   1233             'cflags': [ '-Woverloaded-virtual', '<(wno_array_bounds)', ],
   1234           }],
   1235           ['OS=="linux" and v8_enable_backtrace==1', {
   1236             # Support for backtrace_symbols.
   1237             'ldflags': [ '-rdynamic' ],
   1238           }],
   1239           ['OS=="linux" and disable_glibcxx_debug==0', {
   1240             # Enable libstdc++ debugging facilities to help catch problems
   1241             # early, see http://crbug.com/65151 .
   1242             'defines': ['_GLIBCXX_DEBUG=1',],
   1243           }],
   1244           ['OS=="aix"', {
   1245             'ldflags': [ '-Wl,-bbigtoc' ],
   1246             'conditions': [
   1247               ['v8_target_arch=="ppc64"', {
   1248                 'cflags': [ '-maix64 -mcmodel=large' ],
   1249               }],
   1250             ],
   1251           }],
   1252           ['OS=="android"', {
   1253             'variables': {
   1254               'android_full_debug%': 1,
   1255             },
   1256             'conditions': [
   1257               ['android_full_debug==0', {
   1258                 # Disable full debug if we want a faster v8 in a debug build.
   1259                 # TODO(2304): pass DISABLE_DEBUG_ASSERT instead of hiding DEBUG.
   1260                 'defines!': [
   1261                   'DEBUG',
   1262                   'ENABLE_SLOW_DCHECKS',
   1263                 ],
   1264               }],
   1265             ],
   1266           }],
   1267           # TODO(pcc): Re-enable in LTO builds once we've fixed the intermittent
   1268           # link failures (crbug.com/513074).
   1269           ['linux_use_gold_flags==1 and use_lto==0', {
   1270             'target_conditions': [
   1271               ['_toolset=="target"', {
   1272                 'ldflags': [
   1273                   # Experimentation found that using four linking threads
   1274                   # saved ~20% of link time.
   1275                   # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/281527606915bb36
   1276                   # Only apply this to the target linker, since the host
   1277                   # linker might not be gold, but isn't used much anyway.
   1278                   '-Wl,--threads',
   1279                   '-Wl,--thread-count=4',
   1280                 ],
   1281               }],
   1282             ],
   1283           }],
   1284         ],
   1285       },  # DebugBaseCommon
   1286       'Debug': {
   1287         'inherit_from': ['DebugBaseCommon'],
   1288         'conditions': [
   1289           ['v8_optimized_debug==0', {
   1290             'inherit_from': ['DebugBase0'],
   1291           }, {
   1292             'inherit_from': ['DebugBase1'],
   1293           }],
   1294         ],
   1295       },  # Debug
   1296       'ReleaseBase': {
   1297         'abstract': 1,
   1298         'variables': {
   1299           'v8_enable_slow_dchecks%': 0,
   1300         },
   1301         'conditions': [
   1302           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" \
   1303             or OS=="aix"', {
   1304             'cflags!': [
   1305               '-Os',
   1306             ],
   1307             'cflags': [
   1308               '-fdata-sections',
   1309               '-ffunction-sections',
   1310               '<(wno_array_bounds)',
   1311             ],
   1312             'conditions': [
   1313               # TODO(crbug.com/272548): Avoid -O3 in NaCl
   1314               # Don't use -O3 with sanitizers.
   1315               ['nacl_target_arch=="none" and asan==0 and msan==0 and lsan==0 \
   1316                 and tsan==0 and ubsan==0 and ubsan_vptr==0', {
   1317                 'cflags': ['-O3'],
   1318                 'cflags!': ['-O2'],
   1319               }, {
   1320                 'cflags': ['-O2'],
   1321                 'cflags!': ['-O3'],
   1322               }],
   1323             ],
   1324           }],
   1325           ['OS=="android"', {
   1326             'cflags!': [
   1327               '-O3',
   1328               '-Os',
   1329             ],
   1330             'cflags': [
   1331               '-fdata-sections',
   1332               '-ffunction-sections',
   1333               '-O2',
   1334             ],
   1335           }],
   1336           ['OS=="mac"', {
   1337             'xcode_settings': {
   1338               'GCC_OPTIMIZATION_LEVEL': '3',  # -O3
   1339 
   1340               # -fstrict-aliasing.  Mainline gcc
   1341               # enables this at -O2 and above,
   1342               # but Apple gcc does not unless it
   1343               # is specified explicitly.
   1344               'GCC_STRICT_ALIASING': 'YES',
   1345             },
   1346           }],  # OS=="mac"
   1347           ['OS=="win"', {
   1348             'msvs_settings': {
   1349               'VCCLCompilerTool': {
   1350                 'Optimization': '2',
   1351                 'InlineFunctionExpansion': '2',
   1352                 'EnableIntrinsicFunctions': 'true',
   1353                 'FavorSizeOrSpeed': '0',
   1354                 'StringPooling': 'true',
   1355                 'conditions': [
   1356                   ['component=="shared_library"', {
   1357                     'RuntimeLibrary': '2',  #/MD
   1358                   }, {
   1359                     'RuntimeLibrary': '0',  #/MT
   1360                   }],
   1361                 ],
   1362               },
   1363               'VCLinkerTool': {
   1364                 'LinkIncremental': '1',
   1365                 'OptimizeReferences': '2',
   1366                 'EnableCOMDATFolding': '2',
   1367               },
   1368             },
   1369           }],  # OS=="win"
   1370           ['v8_enable_slow_dchecks==1', {
   1371             'defines': [
   1372               'ENABLE_SLOW_DCHECKS',
   1373             ],
   1374           }],
   1375         ],  # conditions
   1376       },  # Release
   1377       'Release': {
   1378         'inherit_from': ['ReleaseBase'],
   1379       },  # Debug
   1380       'conditions': [
   1381         [ 'OS=="win"', {
   1382           # TODO(bradnelson): add a gyp mechanism to make this more graceful.
   1383           'Debug_x64': {
   1384             'inherit_from': ['DebugBaseCommon'],
   1385             'conditions': [
   1386               ['v8_optimized_debug==0', {
   1387                 'inherit_from': ['DebugBase0'],
   1388               }, {
   1389                 'inherit_from': ['DebugBase1'],
   1390               }],
   1391             ],
   1392           },
   1393           'Release_x64': {
   1394             'inherit_from': ['ReleaseBase'],
   1395           },
   1396         }],
   1397       ],
   1398     },  # configurations
   1399   },  # target_defaults
   1400 }
   1401