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