Skip to content

Commit f42eb01

Browse files
devnexentargos
authored andcommitted
build: enable linux large pages LLVM lld linkage support
The custom linker script is compatible with GNU ld only. As such, providin a new expliciting option to redirect to a different one. lld seems unable to migrate this large section w/o segfaulting so providing only the base address anchor for now. PR-URL: #28938 Reviewed-By: Ben Noordhuis <[email protected]>
1 parent 1e3e6da commit f42eb01

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

configure.py

+6
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,11 @@
401401
help='build with Large Pages support. This feature is supported only on Linux kernel' +
402402
'>= 2.6.38 with Transparent Huge pages enabled and FreeBSD')
403403

404+
parser.add_option('--use-largepages-script-lld',
405+
action='store_true',
406+
dest='node_use_large_pages_script_lld',
407+
help='link against the LLVM ld linker script. Implies -fuse-ld=lld in the linker flags')
408+
404409
intl_optgroup.add_option('--with-intl',
405410
action='store',
406411
dest='with_intl',
@@ -1048,6 +1053,7 @@ def configure_node(o):
10481053
raise Exception(
10491054
'Large pages need Linux kernel version >= 2.6.38')
10501055
o['variables']['node_use_large_pages'] = b(options.node_use_large_pages)
1056+
o['variables']['node_use_large_pages_script_lld'] = b(options.node_use_large_pages_script_lld)
10511057

10521058
if options.no_ifaddrs:
10531059
o['defines'] += ['SUNOS_NO_IFADDRS']

node.gypi

+13-1
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,24 @@
295295
'ldflags': [ '-Wl,-z,relro',
296296
'-Wl,-z,now' ]
297297
}],
298-
[ 'OS=="linux" and target_arch=="x64" and node_use_large_pages=="true"', {
298+
[ 'OS=="linux" and '
299+
'target_arch=="x64" and '
300+
'node_use_large_pages=="true" and '
301+
'node_use_large_pages_script_lld=="false"', {
299302
'ldflags': [
300303
'-Wl,-T',
301304
'<!(realpath src/large_pages/ld.implicit.script)',
302305
]
303306
}],
307+
[ 'OS=="linux" and '
308+
'target_arch=="x64" and '
309+
'node_use_large_pages=="true" and '
310+
'node_use_large_pages_script_lld=="true"', {
311+
'ldflags': [
312+
'-Wl,-T',
313+
'<!(realpath src/large_pages/ld.implicit.script.lld)',
314+
]
315+
}],
304316
[ 'node_use_openssl=="true"', {
305317
'defines': [ 'HAVE_OPENSSL=1' ],
306318
'conditions': [
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
PROVIDE (__nodetext = .);
2+
PROVIDE (_nodetext = .);
3+
PROVIDE (nodetext = .);

0 commit comments

Comments
 (0)