summaryrefslogtreecommitdiff
path: root/node.gyp
diff options
context:
space:
mode:
authorGabriel Schulhof <gabriel.schulhof@intel.com>2020-02-26 16:21:41 -0800
committerGabriel Schulhof <gabriel.schulhof@intel.com>2020-03-02 20:32:19 -0800
commit987a67339518d0380177a2e589f2bbd274230d0e (patch)
treee803c849ffa9db05795e894e9bff4e85e95d06c1 /node.gyp
parentdd8183632d4bc8929371ee4676ef9bb5c95f7aaa (diff)
downloadnode-new-987a67339518d0380177a2e589f2bbd274230d0e.tar.gz
src: start the .text section with an asm symbol
We create an object file in assembly which introduces the symbol `__node_text_start` into the .text section and place the resulting object file as the first file the linker encounters. We do this to ensure that we can recognize the boundaries of the .text section when attempting to establish the address range to map to large pages. Additionally, we rename the section containing the remapping code from `.lpstub` to `lpstub` so as to take advantage of the linker's feature whereby it inserts the symbol `__start_lpstub` when the section's name can be rendered as a valid C variable. We need this symbol in order to avoid self-mapping the remapping code to large pages, because doing so would cause the process to crash. PR-URL: https://github.com/nodejs/node/pull/31981 Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com>
Diffstat (limited to 'node.gyp')
-rw-r--r--node.gyp20
1 files changed, 20 insertions, 0 deletions
diff --git a/node.gyp b/node.gyp
index 60aff02284..c6858584cd 100644
--- a/node.gyp
+++ b/node.gyp
@@ -315,6 +315,19 @@
'targets': [
{
+ 'target_name': 'node_text_start',
+ 'type': 'none',
+ 'conditions': [
+ [ 'OS=="linux" and '
+ 'target_arch=="x64"', {
+ 'type': 'static_library',
+ 'sources': [
+ 'src/large_pages/node_text_start.S'
+ ]
+ }],
+ ]
+ },
+ {
'target_name': '<(node_core_target_name)',
'type': 'executable',
@@ -499,6 +512,13 @@
'src/node_snapshot_stub.cc'
],
}],
+ [ 'OS=="linux" and '
+ 'target_arch=="x64"', {
+ 'dependencies': [ 'node_text_start' ],
+ 'ldflags+': [
+ '<(PRODUCT_DIR)/obj.target/node_text_start/src/large_pages/node_text_start.o'
+ ]
+ }],
],
}, # node_core_target_name
{