tools: compile maglev files into v8_compiler if maglev is disabled

v8_compiler needs maglev graph builder even if maglev is disabled. But
the required files shouldn't be compiled into v8_internal_headers, which
both v8_base_without_compiler and v8_compiler depends on, causing
duplicate symbols during linking if maglev is disabled or not available
for the target. Let's move the files into v8_compiler target where they
are used.

Fixes: https://github.com/nodejs/node/issues/58954
PR-URL: https://github.com/nodejs/node/pull/58861
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
This commit is contained in:
Yao Zi 2025-06-27 06:44:05 +00:00 committed by Richard Lau
parent 9523c84c17
commit 7be2528e05
No known key found for this signature in database
GPG key ID: C43CEC45C17AB93C

View file

@ -636,11 +636,6 @@
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_header_set.\\"v8_internal_headers\\".*?sources = ")',
],
'conditions': [
['v8_enable_maglev==0', {
'sources': [
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_header_set.\\"v8_internal_headers\\".*?!v8_enable_maglev.*?sources \\+= ")',
],
}],
['v8_enable_snapshot_compression==1', {
'sources': [
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_header_set.\\"v8_internal_headers\\".*?v8_enable_snapshot_compression.*?sources \\+= ")',
@ -956,6 +951,11 @@
'abseil.gyp:abseil',
],
'conditions': [
['v8_enable_maglev==0', {
'sources': [
'<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "v8_header_set.\\"v8_internal_headers\\".*?!v8_enable_maglev.*?sources \\+= ")',
],
}],
['v8_enable_turbofan==1', {
'dependencies': ['v8_compiler_sources'],
}, {