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 'v8_enable_backtrace%': 0,
63 # Enable profiling support. Only required on Windows.
66 # Some versions of GCC 4.5 seem to need -fno-strict-aliasing.
67 'v8_no_strict_aliasing%': 0,
69 # Chrome needs this definition unconditionally. For standalone V8 builds,
70 # it's handled in build/standalone.gypi.
71 'want_separate_host_toolset%': 1,
73 # Toolset the d8 binary should be compiled for. Possible values are 'host'
74 # and 'target'. If you want to run v8 tests, it needs to be set to 'target'.
75 # The setting is ignored if want_separate_host_toolset is 0.
76 'v8_toolset_for_d8%': 'target',
80 # For a shared library build, results in "libv8-<(soname_version).so".
81 'soname_version%': '',
83 # Allow to suppress the array bounds warning (default is no suppression).
84 'wno_array_bounds%': '',
87 # This is set when building the Android WebView inside the Android build
88 # system, using the 'android' gyp backend.
89 'android_webview_build%': 0,
91 # Copy it out one scope.
92 'android_webview_build%': '<(android_webview_build)',
95 ['host_arch=="ia32" or host_arch=="x64" or clang==1', {
97 'host_cxx_is_biarch%': 1,
101 'host_cxx_is_biarch%': 0,
104 ['target_arch=="ia32" or target_arch=="x64" or target_arch=="x87" or \
107 'target_cxx_is_biarch%': 1,
111 'target_cxx_is_biarch%': 0,
117 ['v8_target_arch=="arm"', {
119 'V8_TARGET_ARCH_ARM',
122 [ 'arm_version==7 or arm_version=="default"', {
124 'CAN_USE_ARMV7_INSTRUCTIONS',
127 [ 'arm_fpu=="vfpv3-d16" or arm_fpu=="default"', {
129 'CAN_USE_VFP3_INSTRUCTIONS',
132 [ 'arm_fpu=="vfpv3"', {
134 'CAN_USE_VFP3_INSTRUCTIONS',
135 'CAN_USE_VFP32DREGS',
138 [ 'arm_fpu=="neon"', {
140 'CAN_USE_VFP3_INSTRUCTIONS',
141 'CAN_USE_VFP32DREGS',
145 [ 'arm_test_noprobe=="on"', {
147 'ARM_TEST_NO_FEATURE_PROBE',
151 'target_conditions': [
152 ['_toolset=="host"', {
154 ['v8_target_arch==host_arch and android_webview_build==0', {
155 # Host built with an Arm CXX compiler.
157 [ 'arm_version==7', {
158 'cflags': ['-march=armv7-a',],
160 [ 'arm_version==7 or arm_version=="default"', {
162 [ 'arm_fpu!="default"', {
163 'cflags': ['-mfpu=<(arm_fpu)',],
167 [ 'arm_float_abi!="default"', {
168 'cflags': ['-mfloat-abi=<(arm_float_abi)',],
171 'cflags': ['-mthumb',],
174 'cflags': ['-marm',],
178 # 'v8_target_arch!=host_arch'
179 # Host not built with an Arm CXX compiler (simulator build).
181 [ 'arm_float_abi=="hard"', {
183 'USE_EABI_HARDFLOAT=1',
186 [ 'arm_float_abi=="softfp" or arm_float_abi=="default"', {
188 'USE_EABI_HARDFLOAT=0',
194 }], # _toolset=="host"
195 ['_toolset=="target"', {
197 ['v8_target_arch==target_arch and android_webview_build==0', {
198 # Target built with an Arm CXX compiler.
200 [ 'arm_version==7', {
201 'cflags': ['-march=armv7-a',],
203 [ 'arm_version==7 or arm_version=="default"', {
205 [ 'arm_fpu!="default"', {
206 'cflags': ['-mfpu=<(arm_fpu)',],
210 [ 'arm_float_abi!="default"', {
211 'cflags': ['-mfloat-abi=<(arm_float_abi)',],
214 'cflags': ['-mthumb',],
217 'cflags': ['-marm',],
221 # 'v8_target_arch!=target_arch'
222 # Target not built with an Arm CXX compiler (simulator build).
224 [ 'arm_float_abi=="hard"', {
226 'USE_EABI_HARDFLOAT=1',
229 [ 'arm_float_abi=="softfp" or arm_float_abi=="default"', {
231 'USE_EABI_HARDFLOAT=0',
237 }], # _toolset=="target"
239 }], # v8_target_arch=="arm"
240 ['v8_target_arch=="arm64"', {
242 'V8_TARGET_ARCH_ARM64',
245 ['v8_target_arch=="ia32"', {
247 'V8_TARGET_ARCH_IA32',
249 }], # v8_target_arch=="ia32"
250 ['v8_target_arch=="x87"', {
252 'V8_TARGET_ARCH_X87',
254 'cflags': ['-march=i586'],
255 }], # v8_target_arch=="x87"
256 ['v8_target_arch=="mips"', {
258 'V8_TARGET_ARCH_MIPS',
261 ['v8_target_arch==target_arch and android_webview_build==0', {
262 # Target built with a Mips CXX compiler.
263 'target_conditions': [
264 ['_toolset=="target"', {
268 [ 'v8_use_mips_abi_hardfloat=="true"', {
269 'cflags': ['-mhard-float'],
270 'ldflags': ['-mhard-float'],
272 'cflags': ['-msoft-float'],
273 'ldflags': ['-msoft-float'],
275 ['mips_arch_variant=="r2"', {
276 'cflags': ['-mips32r2', '-Wa,-mips32r2'],
278 ['mips_arch_variant=="r1"', {
279 'cflags': ['-mips32', '-Wa,-mips32'],
285 [ 'v8_can_use_fpu_instructions=="true"', {
287 'CAN_USE_FPU_INSTRUCTIONS',
290 [ 'v8_use_mips_abi_hardfloat=="true"', {
292 '__mips_hard_float=1',
293 'CAN_USE_FPU_INSTRUCTIONS',
297 '__mips_soft_float=1'
300 ['mips_arch_variant=="r2"', {
301 'defines': ['_MIPS_ARCH_MIPS32R2',],
304 }], # v8_target_arch=="mips"
305 ['v8_target_arch=="mipsel"', {
307 'V8_TARGET_ARCH_MIPS',
310 ['v8_target_arch==target_arch and android_webview_build==0', {
311 # Target built with a Mips CXX compiler.
312 'target_conditions': [
313 ['_toolset=="target"', {
317 [ 'v8_use_mips_abi_hardfloat=="true"', {
318 'cflags': ['-mhard-float'],
319 'ldflags': ['-mhard-float'],
321 'cflags': ['-msoft-float'],
322 'ldflags': ['-msoft-float'],
324 ['mips_arch_variant=="r2"', {
325 'cflags': ['-mips32r2', '-Wa,-mips32r2'],
327 ['mips_arch_variant=="r1"', {
328 'cflags': ['-mips32', '-Wa,-mips32'],
330 ['mips_arch_variant=="loongson"', {
331 'cflags': ['-mips3', '-Wa,-mips3'],
337 [ 'v8_can_use_fpu_instructions=="true"', {
339 'CAN_USE_FPU_INSTRUCTIONS',
342 [ 'v8_use_mips_abi_hardfloat=="true"', {
344 '__mips_hard_float=1',
345 'CAN_USE_FPU_INSTRUCTIONS',
349 '__mips_soft_float=1'
352 ['mips_arch_variant=="r2"', {
353 'defines': ['_MIPS_ARCH_MIPS32R2',],
355 ['mips_arch_variant=="loongson"', {
356 'defines': ['_MIPS_ARCH_LOONGSON',],
359 }], # v8_target_arch=="mipsel"
360 ['v8_target_arch=="mips64el"', {
362 'V8_TARGET_ARCH_MIPS64',
365 ['v8_target_arch==target_arch and android_webview_build==0', {
366 # Target built with a Mips CXX compiler.
367 'target_conditions': [
368 ['_toolset=="target"', {
372 [ 'v8_use_mips_abi_hardfloat=="true"', {
373 'cflags': ['-mhard-float'],
374 'ldflags': ['-mhard-float'],
376 'cflags': ['-msoft-float'],
377 'ldflags': ['-msoft-float'],
379 ['mips_arch_variant=="r6"', {
380 'cflags': ['-mips64r6', '-mabi=64', '-Wa,-mips64r6'],
382 '-mips64r6', '-mabi=64',
383 '-Wl,--dynamic-linker=$(LDSO_PATH)',
384 '-Wl,--rpath=$(LD_R_PATH)',
387 ['mips_arch_variant=="r2"', {
388 'cflags': ['-mips64r2', '-mabi=64', '-Wa,-mips64r2'],
390 '-mips64r2', '-mabi=64',
391 '-Wl,--dynamic-linker=$(LDSO_PATH)',
392 '-Wl,--rpath=$(LD_R_PATH)',
399 [ 'v8_can_use_fpu_instructions=="true"', {
401 'CAN_USE_FPU_INSTRUCTIONS',
404 [ 'v8_use_mips_abi_hardfloat=="true"', {
406 '__mips_hard_float=1',
407 'CAN_USE_FPU_INSTRUCTIONS',
411 '__mips_soft_float=1'
414 ['mips_arch_variant=="r6"', {
415 'defines': ['_MIPS_ARCH_MIPS64R6',],
417 ['mips_arch_variant=="r2"', {
418 'defines': ['_MIPS_ARCH_MIPS64R2',],
421 }], # v8_target_arch=="mips64el"
422 ['v8_target_arch=="x64"', {
424 'V8_TARGET_ARCH_X64',
427 'ARCHS': [ 'x86_64' ],
431 'StackReserveSize': '2097152',
434 'msvs_configuration_platform': 'x64',
435 }], # v8_target_arch=="x64"
436 ['v8_target_arch=="x32"', {
438 # x32 port shares the source code with x64 port.
439 'V8_TARGET_ARCH_X64',
440 'V8_TARGET_ARCH_32_BIT',
444 # Inhibit warning if long long type is used.
450 }], # v8_target_arch=="x32"
455 # 4351: VS 2005 and later are warning us that they've fixed a bug
456 # present in VS 2003 and earlier.
457 'msvs_disabled_warnings': [4351],
458 'msvs_configuration_attributes': {
459 'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)',
460 'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
464 ['OS=="win" and v8_target_arch=="ia32"', {
466 'VCCLCompilerTool': {
467 # Ensure no surprising artifacts from 80bit double math with x86.
468 'AdditionalOptions': ['/arch:SSE2'],
472 ['OS=="win" and v8_enable_prof==1', {
475 'GenerateMapFile': 'true',
479 ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
480 or OS=="netbsd" or OS=="mac" or OS=="android" or OS=="qnx") and \
481 (v8_target_arch=="arm" or v8_target_arch=="ia32" or \
482 v8_target_arch=="x87" or v8_target_arch=="mips" or \
483 v8_target_arch=="mipsel")', {
484 'target_conditions': [
485 ['_toolset=="host"', {
487 ['host_cxx_is_biarch==1', {
488 'cflags': [ '-m32' ],
489 'ldflags': [ '-m32' ]
496 ['_toolset=="target"', {
498 ['target_cxx_is_biarch==1 and nacl_target_arch!="nacl_x64"', {
499 'cflags': [ '-m32' ],
500 'ldflags': [ '-m32' ],
509 ['(OS=="linux" or OS=="android") and \
510 (v8_target_arch=="x64" or v8_target_arch=="arm64")', {
511 'target_conditions': [
512 ['_toolset=="host"', {
514 ['host_cxx_is_biarch==1', {
515 'cflags': [ '-m64' ],
516 'ldflags': [ '-m64' ]
520 ['_toolset=="target"', {
522 ['target_cxx_is_biarch==1', {
523 'cflags': [ '-m64' ],
524 'ldflags': [ '-m64' ],
530 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
531 or OS=="netbsd" or OS=="qnx"', {
533 [ 'v8_no_strict_aliasing==1', {
534 'cflags': [ '-fno-strict-aliasing' ],
539 'defines': [ '__C99FEATURES__=1' ], # isinf() etc.
541 ['OS=="freebsd" or OS=="openbsd"', {
542 'cflags': [ '-I/usr/local/include' ],
545 'cflags': [ '-I/usr/pkg/include' ],
549 # Abstract configuration for v8_optimized_debug == 0.
553 'VCCLCompilerTool': {
556 ['component=="shared_library"', {
557 'RuntimeLibrary': '3', # /MDd
559 'RuntimeLibrary': '1', # /MTd
564 'LinkIncremental': '2',
568 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
579 '-ffunction-sections',
584 'GCC_OPTIMIZATION_LEVEL': '0', # -O0
589 # Abstract configuration for v8_optimized_debug == 1.
593 'VCCLCompilerTool': {
595 'InlineFunctionExpansion': '2',
596 'EnableIntrinsicFunctions': 'true',
597 'FavorSizeOrSpeed': '0',
598 'StringPooling': 'true',
599 'BasicRuntimeChecks': '0',
601 ['component=="shared_library"', {
602 'RuntimeLibrary': '3', # /MDd
604 'RuntimeLibrary': '1', # /MTd
609 'LinkIncremental': '2',
613 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
617 '-O3', # TODO(2807) should be -O1.
623 '-ffunction-sections',
624 '-O1', # TODO(2807) should be -O3.
627 ['gcc_version==44 and clang==0', {
629 # Avoid crashes with gcc 4.4 in the v8 test suite.
637 'GCC_OPTIMIZATION_LEVEL': '3', # -O3
638 'GCC_STRICT_ALIASING': 'YES',
643 # Abstract configuration for v8_optimized_debug == 2.
647 'VCCLCompilerTool': {
649 'InlineFunctionExpansion': '2',
650 'EnableIntrinsicFunctions': 'true',
651 'FavorSizeOrSpeed': '0',
652 'StringPooling': 'true',
653 'BasicRuntimeChecks': '0',
655 ['component=="shared_library"', {
656 'RuntimeLibrary': '3', #/MDd
658 'RuntimeLibrary': '1', #/MTd
660 ['v8_target_arch=="x64"', {
661 # TODO(2207): remove this option once the bug is fixed.
662 'WholeProgramOptimization': 'true',
667 'LinkIncremental': '1',
668 'OptimizeReferences': '2',
669 'EnableCOMDATFolding': '2',
673 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
682 '-ffunction-sections',
688 # TODO(crbug.com/272548): Avoid -O3 in NaCl
689 ['nacl_target_arch=="none"', {
696 ['gcc_version==44 and clang==0', {
698 # Avoid crashes with gcc 4.4 in the v8 test suite.
706 'GCC_OPTIMIZATION_LEVEL': '3', # -O3
707 'GCC_STRICT_ALIASING': 'YES',
712 # Common settings for the Debug configuration.
716 'ENABLE_DISASSEMBLER',
723 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" or \
725 'cflags': [ '-Woverloaded-virtual', '<(wno_array_bounds)', ],
727 ['OS=="linux" and v8_enable_backtrace==1', {
728 # Support for backtrace_symbols.
729 'ldflags': [ '-rdynamic' ],
733 'android_full_debug%': 1,
736 ['android_full_debug==0', {
737 # Disable full debug if we want a faster v8 in a debug build.
738 # TODO(2304): pass DISABLE_DEBUG_ASSERT instead of hiding DEBUG.
748 'inherit_from': ['DebugBaseCommon'],
750 ['v8_optimized_debug==0', {
751 'inherit_from': ['DebugBase0'],
753 ['v8_optimized_debug==1', {
754 'inherit_from': ['DebugBase1'],
756 ['v8_optimized_debug==2', {
757 'inherit_from': ['DebugBase2'],
763 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', {
769 '-ffunction-sections',
770 '<(wno_array_bounds)',
773 [ 'gcc_version==44 and clang==0', {
775 # Avoid crashes with gcc 4.4 in the v8 test suite.
779 # TODO(crbug.com/272548): Avoid -O3 in NaCl
780 ['nacl_target_arch=="none"', {
796 '-ffunction-sections',
800 [ 'gcc_version==44 and clang==0', {
802 # Avoid crashes with gcc 4.4 in the v8 test suite.
810 'GCC_OPTIMIZATION_LEVEL': '3', # -O3
812 # -fstrict-aliasing. Mainline gcc
813 # enables this at -O2 and above,
814 # but Apple gcc does not unless it
815 # is specified explicitly.
816 'GCC_STRICT_ALIASING': 'YES',
821 'VCCLCompilerTool': {
823 'InlineFunctionExpansion': '2',
824 'EnableIntrinsicFunctions': 'true',
825 'FavorSizeOrSpeed': '0',
826 'StringPooling': 'true',
828 ['component=="shared_library"', {
829 'RuntimeLibrary': '2', #/MD
831 'RuntimeLibrary': '0', #/MT
833 ['v8_target_arch=="x64"', {
834 # TODO(2207): remove this option once the bug is fixed.
835 'WholeProgramOptimization': 'true',
840 'LinkIncremental': '1',
841 'OptimizeReferences': '2',
842 'EnableCOMDATFolding': '2',