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
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.
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.
28 # Shared definitions for all V8-related targets.
32 'msvs_use_common_release': 0,
33 'gcc_version%': 'unknown',
35 'v8_target_arch%': '<(target_arch)',
36 # Native Client builds currently use the V8 ARM JIT and
37 # arm/simulator-arm.cc to defer the significant effort required
38 # for NaCl JIT support. The nacl_target_arch variable provides
39 # the 'true' target arch for places in this file that need it.
40 # TODO(bradchen): get rid of nacl_target_arch when someday
41 # NaCl V8 builds stop using the ARM simulator
42 'nacl_target_arch%': 'none', # must be set externally
44 # Setting 'v8_can_use_vfp32dregs' to 'true' will cause V8 to use the VFP
45 # registers d16-d31 in the generated code, both in the snapshot and for the
46 # ARM target. Leaving the default value of 'false' will avoid the use of
47 # these registers in the snapshot and use CPU feature probing when running
49 'v8_can_use_vfp32dregs%': 'false',
50 'arm_test_noprobe%': 'off',
52 # Similar to vfp but on MIPS.
53 'v8_can_use_fpu_instructions%': 'true',
55 # Similar to the ARM hard float ABI but on MIPS.
56 'v8_use_mips_abi_hardfloat%': 'true',
58 # Default arch variant for MIPS.
59 'mips_arch_variant%': 'r2',
61 # Possible values fp32, fp64, fpxx.
62 # fp32 - 32 32-bit FPU registers are available, doubles are placed in
64 # fp64 - 32 64-bit FPU registers are available.
65 # fpxx - compatibility mode, it chooses fp32 or fp64 depending on runtime
67 'mips_fpu_mode%': 'fp32',
69 'v8_enable_backtrace%': 0,
71 # Enable profiling support. Only required on Windows.
74 # Some versions of GCC 4.5 seem to need -fno-strict-aliasing.
75 'v8_no_strict_aliasing%': 0,
77 # Chrome needs this definition unconditionally. For standalone V8 builds,
78 # it's handled in build/standalone.gypi.
79 'want_separate_host_toolset%': 1,
81 # Toolset the d8 binary should be compiled for. Possible values are 'host'
82 # and 'target'. If you want to run v8 tests, it needs to be set to 'target'.
83 # The setting is ignored if want_separate_host_toolset is 0.
84 'v8_toolset_for_d8%': 'target',
88 # For a shared library build, results in "libv8-<(soname_version).so".
89 'soname_version%': '',
91 # Allow to suppress the array bounds warning (default is no suppression).
92 'wno_array_bounds%': '',
94 # Link-Time Optimizations
98 # This is set when building the Android WebView inside the Android build
99 # system, using the 'android' gyp backend.
100 'android_webview_build%': 0,
102 # Copy it out one scope.
103 'android_webview_build%': '<(android_webview_build)',
106 ['host_arch=="ia32" or host_arch=="x64" or clang==1', {
108 'host_cxx_is_biarch%': 1,
112 'host_cxx_is_biarch%': 0,
115 ['target_arch=="ia32" or target_arch=="x64" or target_arch=="x87" or \
118 'target_cxx_is_biarch%': 1,
122 'target_cxx_is_biarch%': 0,
128 ['v8_target_arch=="arm"', {
130 'V8_TARGET_ARCH_ARM',
133 [ 'arm_version==7 or arm_version=="default"', {
135 'CAN_USE_ARMV7_INSTRUCTIONS',
138 [ 'arm_fpu=="vfpv3-d16" or arm_fpu=="default"', {
140 'CAN_USE_VFP3_INSTRUCTIONS',
143 [ 'arm_fpu=="vfpv3"', {
145 'CAN_USE_VFP3_INSTRUCTIONS',
146 'CAN_USE_VFP32DREGS',
149 [ 'arm_fpu=="neon"', {
151 'CAN_USE_VFP3_INSTRUCTIONS',
152 'CAN_USE_VFP32DREGS',
156 [ 'arm_test_noprobe=="on"', {
158 'ARM_TEST_NO_FEATURE_PROBE',
162 'target_conditions': [
163 ['_toolset=="host"', {
165 ['v8_target_arch==host_arch and android_webview_build==0', {
166 # Host built with an Arm CXX compiler.
168 [ 'arm_version==7', {
169 'cflags': ['-march=armv7-a',],
171 [ 'arm_version==7 or arm_version=="default"', {
173 [ 'arm_fpu!="default"', {
174 'cflags': ['-mfpu=<(arm_fpu)',],
178 [ 'arm_float_abi!="default"', {
179 'cflags': ['-mfloat-abi=<(arm_float_abi)',],
182 'cflags': ['-mthumb',],
185 'cflags': ['-marm',],
189 # 'v8_target_arch!=host_arch'
190 # Host not built with an Arm CXX compiler (simulator build).
192 [ 'arm_float_abi=="hard"', {
194 'USE_EABI_HARDFLOAT=1',
197 [ 'arm_float_abi=="softfp" or arm_float_abi=="default"', {
199 'USE_EABI_HARDFLOAT=0',
205 }], # _toolset=="host"
206 ['_toolset=="target"', {
208 ['v8_target_arch==target_arch and android_webview_build==0', {
209 # Target built with an Arm CXX compiler.
211 [ 'arm_version==7', {
212 'cflags': ['-march=armv7-a',],
214 [ 'arm_version==7 or arm_version=="default"', {
216 [ 'arm_fpu!="default"', {
217 'cflags': ['-mfpu=<(arm_fpu)',],
221 [ 'arm_float_abi!="default"', {
222 'cflags': ['-mfloat-abi=<(arm_float_abi)',],
225 'cflags': ['-mthumb',],
228 'cflags': ['-marm',],
232 # 'v8_target_arch!=target_arch'
233 # Target not built with an Arm CXX compiler (simulator build).
235 [ 'arm_float_abi=="hard"', {
237 'USE_EABI_HARDFLOAT=1',
240 [ 'arm_float_abi=="softfp" or arm_float_abi=="default"', {
242 'USE_EABI_HARDFLOAT=0',
248 # v8 is optimized for speed, which takes precedence over
249 # size optimization in LTO.
257 }], # _toolset=="target"
259 }], # v8_target_arch=="arm"
260 ['v8_target_arch=="arm64"', {
262 'V8_TARGET_ARCH_ARM64',
265 ['v8_target_arch=="ia32"', {
267 'V8_TARGET_ARCH_IA32',
269 }], # v8_target_arch=="ia32"
270 ['v8_target_arch=="x87"', {
272 'V8_TARGET_ARCH_X87',
274 'cflags': ['-march=i586'],
275 }], # v8_target_arch=="x87"
276 ['v8_target_arch=="mips"', {
278 'V8_TARGET_ARCH_MIPS',
281 ['v8_target_arch==target_arch and android_webview_build==0', {
282 # Target built with a Mips CXX compiler.
283 'target_conditions': [
284 ['_toolset=="target"', {
288 [ 'v8_use_mips_abi_hardfloat=="true"', {
289 'cflags': ['-mhard-float'],
290 'ldflags': ['-mhard-float'],
292 'cflags': ['-msoft-float'],
293 'ldflags': ['-msoft-float'],
295 ['mips_fpu_mode=="fp64"', {
296 'cflags': ['-mfp64'],
298 ['mips_fpu_mode=="fpxx"', {
299 'cflags': ['-mfpxx'],
301 ['mips_fpu_mode=="fp32"', {
302 'cflags': ['-mfp32'],
304 ['mips_arch_variant=="r6"', {
305 'cflags!': ['-mfp32'],
306 'cflags': ['-mips32r6', '-Wa,-mips32r6'],
309 '-Wl,--dynamic-linker=$(LDSO_PATH)',
310 '-Wl,--rpath=$(LD_R_PATH)',
313 ['mips_arch_variant=="r2"', {
314 'cflags': ['-mips32r2', '-Wa,-mips32r2'],
316 ['mips_arch_variant=="r1"', {
317 'cflags!': ['-mfp64'],
318 'cflags': ['-mips32', '-Wa,-mips32'],
320 ['mips_arch_variant=="rx"', {
321 'cflags!': ['-mfp64'],
322 'cflags': ['-mips32', '-Wa,-mips32'],
328 [ 'v8_can_use_fpu_instructions=="true"', {
330 'CAN_USE_FPU_INSTRUCTIONS',
333 [ 'v8_use_mips_abi_hardfloat=="true"', {
335 '__mips_hard_float=1',
336 'CAN_USE_FPU_INSTRUCTIONS',
340 '__mips_soft_float=1'
343 ['mips_arch_variant=="rx"', {
345 '_MIPS_ARCH_MIPS32RX',
349 ['mips_arch_variant=="r6"', {
351 '_MIPS_ARCH_MIPS32R6',
355 ['mips_arch_variant=="r2"', {
356 'defines': ['_MIPS_ARCH_MIPS32R2',],
358 ['mips_fpu_mode=="fp64"', {
359 'defines': ['FPU_MODE_FP64',],
361 ['mips_fpu_mode=="fpxx"', {
362 'defines': ['FPU_MODE_FPXX',],
364 ['mips_fpu_mode=="fp32"', {
365 'defines': ['FPU_MODE_FP32',],
369 ['mips_arch_variant=="r1"', {
370 'defines': ['FPU_MODE_FP32',],
373 }], # v8_target_arch=="mips"
374 ['v8_target_arch=="mipsel"', {
376 'V8_TARGET_ARCH_MIPS',
379 ['v8_target_arch==target_arch and android_webview_build==0', {
380 # Target built with a Mips CXX compiler.
381 'target_conditions': [
382 ['_toolset=="target"', {
386 [ 'v8_use_mips_abi_hardfloat=="true"', {
387 'cflags': ['-mhard-float'],
388 'ldflags': ['-mhard-float'],
390 'cflags': ['-msoft-float'],
391 'ldflags': ['-msoft-float'],
393 ['mips_fpu_mode=="fp64"', {
394 'cflags': ['-mfp64'],
396 ['mips_fpu_mode=="fpxx"', {
397 'cflags': ['-mfpxx'],
399 ['mips_fpu_mode=="fp32"', {
400 'cflags': ['-mfp32'],
402 ['mips_arch_variant=="r6"', {
403 'cflags!': ['-mfp32'],
404 'cflags': ['-mips32r6', '-Wa,-mips32r6'],
407 '-Wl,--dynamic-linker=$(LDSO_PATH)',
408 '-Wl,--rpath=$(LD_R_PATH)',
411 ['mips_arch_variant=="r2"', {
412 'cflags': ['-mips32r2', '-Wa,-mips32r2'],
414 ['mips_arch_variant=="r1"', {
415 'cflags!': ['-mfp64'],
416 'cflags': ['-mips32', '-Wa,-mips32'],
418 ['mips_arch_variant=="rx"', {
419 'cflags!': ['-mfp64'],
420 'cflags': ['-mips32', '-Wa,-mips32'],
422 ['mips_arch_variant=="loongson"', {
423 'cflags!': ['-mfp64'],
424 'cflags': ['-mips3', '-Wa,-mips3'],
430 [ 'v8_can_use_fpu_instructions=="true"', {
432 'CAN_USE_FPU_INSTRUCTIONS',
435 [ 'v8_use_mips_abi_hardfloat=="true"', {
437 '__mips_hard_float=1',
438 'CAN_USE_FPU_INSTRUCTIONS',
442 '__mips_soft_float=1'
445 ['mips_arch_variant=="rx"', {
447 '_MIPS_ARCH_MIPS32RX',
451 ['mips_arch_variant=="r6"', {
453 '_MIPS_ARCH_MIPS32R6',
457 ['mips_arch_variant=="r2"', {
458 'defines': ['_MIPS_ARCH_MIPS32R2',],
460 ['mips_fpu_mode=="fp64"', {
461 'defines': ['FPU_MODE_FP64',],
463 ['mips_fpu_mode=="fpxx"', {
464 'defines': ['FPU_MODE_FPXX',],
466 ['mips_fpu_mode=="fp32"', {
467 'defines': ['FPU_MODE_FP32',],
471 ['mips_arch_variant=="r1"', {
472 'defines': ['FPU_MODE_FP32',],
474 ['mips_arch_variant=="loongson"', {
476 '_MIPS_ARCH_LOONGSON',
481 }], # v8_target_arch=="mipsel"
482 ['v8_target_arch=="mips64el"', {
484 'V8_TARGET_ARCH_MIPS64',
487 ['v8_target_arch==target_arch and android_webview_build==0', {
488 # Target built with a Mips CXX compiler.
489 'target_conditions': [
490 ['_toolset=="target"', {
494 [ 'v8_use_mips_abi_hardfloat=="true"', {
495 'cflags': ['-mhard-float'],
496 'ldflags': ['-mhard-float'],
498 'cflags': ['-msoft-float'],
499 'ldflags': ['-msoft-float'],
501 ['mips_arch_variant=="r6"', {
502 'cflags': ['-mips64r6', '-mabi=64', '-Wa,-mips64r6'],
504 '-mips64r6', '-mabi=64',
505 '-Wl,--dynamic-linker=$(LDSO_PATH)',
506 '-Wl,--rpath=$(LD_R_PATH)',
509 ['mips_arch_variant=="r2"', {
510 'cflags': ['-mips64r2', '-mabi=64', '-Wa,-mips64r2'],
512 '-mips64r2', '-mabi=64',
513 '-Wl,--dynamic-linker=$(LDSO_PATH)',
514 '-Wl,--rpath=$(LD_R_PATH)',
521 [ 'v8_can_use_fpu_instructions=="true"', {
523 'CAN_USE_FPU_INSTRUCTIONS',
526 [ 'v8_use_mips_abi_hardfloat=="true"', {
528 '__mips_hard_float=1',
529 'CAN_USE_FPU_INSTRUCTIONS',
533 '__mips_soft_float=1'
536 ['mips_arch_variant=="r6"', {
537 'defines': ['_MIPS_ARCH_MIPS64R6',],
539 ['mips_arch_variant=="r2"', {
540 'defines': ['_MIPS_ARCH_MIPS64R2',],
543 }], # v8_target_arch=="mips64el"
544 ['v8_target_arch=="x64"', {
546 'V8_TARGET_ARCH_X64',
549 'ARCHS': [ 'x86_64' ],
553 'StackReserveSize': '2097152',
556 'msvs_configuration_platform': 'x64',
557 }], # v8_target_arch=="x64"
558 ['v8_target_arch=="x32"', {
560 # x32 port shares the source code with x64 port.
561 'V8_TARGET_ARCH_X64',
562 'V8_TARGET_ARCH_32_BIT',
566 # Inhibit warning if long long type is used.
572 }], # v8_target_arch=="x32"
577 # 4351: VS 2005 and later are warning us that they've fixed a bug
578 # present in VS 2003 and earlier.
579 'msvs_disabled_warnings': [4351],
580 'msvs_configuration_attributes': {
581 'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)',
582 'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
586 ['OS=="win" and v8_target_arch=="ia32"', {
588 'VCCLCompilerTool': {
589 # Ensure no surprising artifacts from 80bit double math with x86.
590 'AdditionalOptions': ['/arch:SSE2'],
594 ['OS=="win" and v8_enable_prof==1', {
597 'GenerateMapFile': 'true',
601 ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
602 or OS=="netbsd" or OS=="mac" or OS=="android" or OS=="qnx") and \
603 (v8_target_arch=="arm" or v8_target_arch=="ia32" or \
604 v8_target_arch=="x87" or v8_target_arch=="mips" or \
605 v8_target_arch=="mipsel")', {
606 'target_conditions': [
607 ['_toolset=="host"', {
609 ['host_cxx_is_biarch==1', {
610 'cflags': [ '-m32' ],
611 'ldflags': [ '-m32' ]
618 ['_toolset=="target"', {
620 ['target_cxx_is_biarch==1 and nacl_target_arch!="nacl_x64"', {
621 'cflags': [ '-m32' ],
622 'ldflags': [ '-m32' ],
631 ['(OS=="linux" or OS=="android") and \
632 (v8_target_arch=="x64" or v8_target_arch=="arm64")', {
633 'target_conditions': [
634 ['_toolset=="host"', {
636 ['host_cxx_is_biarch==1', {
637 'cflags': [ '-m64' ],
638 'ldflags': [ '-m64' ]
642 ['_toolset=="target"', {
644 ['target_cxx_is_biarch==1', {
645 'cflags': [ '-m64' ],
646 'ldflags': [ '-m64' ],
652 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
653 or OS=="netbsd" or OS=="qnx"', {
655 [ 'v8_no_strict_aliasing==1', {
656 'cflags': [ '-fno-strict-aliasing' ],
661 'defines': [ '__C99FEATURES__=1' ], # isinf() etc.
663 ['OS=="freebsd" or OS=="openbsd"', {
664 'cflags': [ '-I/usr/local/include' ],
667 'cflags': [ '-I/usr/pkg/include' ],
671 # Abstract configuration for v8_optimized_debug == 0.
675 'VCCLCompilerTool': {
678 ['component=="shared_library"', {
679 'RuntimeLibrary': '3', # /MDd
681 'RuntimeLibrary': '1', # /MTd
686 'LinkIncremental': '2',
690 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
701 '-ffunction-sections',
706 'GCC_OPTIMIZATION_LEVEL': '0', # -O0
711 # Abstract configuration for v8_optimized_debug == 1.
715 'VCCLCompilerTool': {
717 'InlineFunctionExpansion': '2',
718 'EnableIntrinsicFunctions': 'true',
719 'FavorSizeOrSpeed': '0',
720 'StringPooling': 'true',
721 'BasicRuntimeChecks': '0',
723 ['component=="shared_library"', {
724 'RuntimeLibrary': '3', # /MDd
726 'RuntimeLibrary': '1', # /MTd
731 'LinkIncremental': '2',
735 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
739 '-O3', # TODO(2807) should be -O1.
745 '-ffunction-sections',
746 '-O1', # TODO(2807) should be -O3.
749 ['gcc_version==44 and clang==0', {
751 # Avoid crashes with gcc 4.4 in the v8 test suite.
759 'GCC_OPTIMIZATION_LEVEL': '3', # -O3
760 'GCC_STRICT_ALIASING': 'YES',
765 # Abstract configuration for v8_optimized_debug == 2.
769 'VCCLCompilerTool': {
771 'InlineFunctionExpansion': '2',
772 'EnableIntrinsicFunctions': 'true',
773 'FavorSizeOrSpeed': '0',
774 'StringPooling': 'true',
775 'BasicRuntimeChecks': '0',
777 ['component=="shared_library"', {
778 'RuntimeLibrary': '3', #/MDd
780 'RuntimeLibrary': '1', #/MTd
782 ['v8_target_arch=="x64"', {
783 # TODO(2207): remove this option once the bug is fixed.
784 'WholeProgramOptimization': 'true',
789 'LinkIncremental': '1',
790 'OptimizeReferences': '2',
791 'EnableCOMDATFolding': '2',
795 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
804 '-ffunction-sections',
810 # TODO(crbug.com/272548): Avoid -O3 in NaCl
811 ['nacl_target_arch=="none"', {
818 ['gcc_version==44 and clang==0', {
820 # Avoid crashes with gcc 4.4 in the v8 test suite.
828 'GCC_OPTIMIZATION_LEVEL': '3', # -O3
829 'GCC_STRICT_ALIASING': 'YES',
834 # Common settings for the Debug configuration.
838 'ENABLE_DISASSEMBLER',
845 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
847 'cflags': [ '-Woverloaded-virtual', '<(wno_array_bounds)', ],
849 ['OS=="linux" and v8_enable_backtrace==1', {
850 # Support for backtrace_symbols.
851 'ldflags': [ '-rdynamic' ],
855 'android_full_debug%': 1,
858 ['android_full_debug==0', {
859 # Disable full debug if we want a faster v8 in a debug build.
860 # TODO(2304): pass DISABLE_DEBUG_ASSERT instead of hiding DEBUG.
870 'inherit_from': ['DebugBaseCommon'],
872 ['v8_optimized_debug==0', {
873 'inherit_from': ['DebugBase0'],
875 ['v8_optimized_debug==1', {
876 'inherit_from': ['DebugBase1'],
878 ['v8_optimized_debug==2', {
879 'inherit_from': ['DebugBase2'],
885 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', {
891 '-ffunction-sections',
892 '<(wno_array_bounds)',
895 [ 'gcc_version==44 and clang==0', {
897 # Avoid crashes with gcc 4.4 in the v8 test suite.
901 # TODO(crbug.com/272548): Avoid -O3 in NaCl
902 ['nacl_target_arch=="none"', {
918 '-ffunction-sections',
922 [ 'gcc_version==44 and clang==0', {
924 # Avoid crashes with gcc 4.4 in the v8 test suite.
932 'GCC_OPTIMIZATION_LEVEL': '3', # -O3
934 # -fstrict-aliasing. Mainline gcc
935 # enables this at -O2 and above,
936 # but Apple gcc does not unless it
937 # is specified explicitly.
938 'GCC_STRICT_ALIASING': 'YES',
943 'VCCLCompilerTool': {
945 'InlineFunctionExpansion': '2',
946 'EnableIntrinsicFunctions': 'true',
947 'FavorSizeOrSpeed': '0',
948 'StringPooling': 'true',
950 ['component=="shared_library"', {
951 'RuntimeLibrary': '2', #/MD
953 'RuntimeLibrary': '0', #/MT
955 ['v8_target_arch=="x64"', {
956 # TODO(2207): remove this option once the bug is fixed.
957 'WholeProgramOptimization': 'true',
962 'LinkIncremental': '1',
963 'OptimizeReferences': '2',
964 'EnableCOMDATFolding': '2',