Skip to content

Commit

Permalink
build: add loong64 configure
Browse files Browse the repository at this point in the history
PR-URL: nodejs#41323
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Mary Marchini <oss@mmarchini.me>
  • Loading branch information
shipujin authored and Linkgoron committed Jan 31, 2022
1 parent fc23ba5 commit 25c20ae
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
4 changes: 3 additions & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
valid_os = ('win', 'mac', 'solaris', 'freebsd', 'openbsd', 'linux',
'android', 'aix', 'cloudabi')
valid_arch = ('arm', 'arm64', 'ia32', 'mips', 'mipsel', 'mips64el', 'ppc',
'ppc64', 'x32','x64', 'x86', 'x86_64', 's390x', 'riscv64')
'ppc64', 'x32','x64', 'x86', 'x86_64', 's390x', 'riscv64',
'loong64')
valid_arm_float_abi = ('soft', 'softfp', 'hard')
valid_arm_fpu = ('vfp', 'vfpv3', 'vfpv3-d16', 'neon')
valid_mips_arch = ('loongson', 'r1', 'r2', 'r6', 'rx')
Expand Down Expand Up @@ -1075,6 +1076,7 @@ def host_arch_cc():
'__x86_64__' : 'x64',
'__s390x__' : 's390x',
'__riscv' : 'riscv',
'__loongarch64': 'loong64',
}

rtn = 'ia32' # default
Expand Down
5 changes: 5 additions & 0 deletions tools/v8_gypfiles/toolchain.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@
'CAN_USE_FPU_INSTRUCTIONS'
],
}],
['v8_target_arch=="loong64"', {
'defines': [
'V8_TARGET_ARCH_LOONG64',
],
}],
['v8_target_arch=="s390x"', {
'defines': [
'V8_TARGET_ARCH_S390',
Expand Down
22 changes: 21 additions & 1 deletion tools/v8_gypfiles/v8.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,11 @@
'<(V8_ROOT)/src/builtins/riscv64/builtins-riscv64.cc',
],
}],
['v8_target_arch=="loong64" or v8_target_arch=="loong64"', {
'sources': [
'<(V8_ROOT)/src/builtins/loong64/builtins-loong64.cc',
],
}],
['v8_target_arch=="mips64" or v8_target_arch=="mips64el"', {
'sources': [
'<(V8_ROOT)/src/builtins/mips64/builtins-mips64.cc',
Expand Down Expand Up @@ -647,6 +652,11 @@
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"riscv64\\".*?sources \\+= ")',
],
}],
['v8_target_arch=="loong64"', {
'sources': [
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"loong64\\".*?sources \\+= ")',
],
}],
],
},
}, # v8_internal_headers
Expand Down Expand Up @@ -875,6 +885,11 @@
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_base_without_compiler.*?v8_current_cpu == \\"riscv64\\".*?sources \\+= ")',
],
}],
['v8_target_arch=="loong64"', {
'sources': [
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_base_without_compiler.*?v8_current_cpu == \\"loong64\\".*?sources \\+= ")',
],
}],
['OS=="win"', {
'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
Expand Down Expand Up @@ -940,7 +955,7 @@
}],
# Platforms that don't have Compare-And-Swap (CAS) support need to link atomic library
# to implement atomic memory access
['v8_current_cpu in ["mips", "mipsel", "mips64", "mips64el", "ppc", "arm", "riscv64"]', {
['v8_current_cpu in ["mips", "mipsel", "mips64", "mips64el", "ppc", "arm", "riscv64", "loong64"]', {
'link_settings': {
'libraries': ['-latomic', ],
},
Expand Down Expand Up @@ -1611,6 +1626,11 @@
'<(V8_ROOT)/src/heap/base/asm/riscv64/push_registers_asm.cc',
],
}],
['_toolset == "host" and host_arch == "loong64" or _toolset == "target" and target_arch=="loong64"', {
'sources': [
'<(V8_ROOT)/src/heap/base/asm/loong64/push_registers_asm.cc',
],
}],
]
}],
['OS=="win"', {
Expand Down

0 comments on commit 25c20ae

Please sign in to comment.