diff options
author | Gabriel Schulhof <gabriel.schulhof@intel.com> | 2020-02-26 16:21:41 -0800 |
---|---|---|
committer | Gabriel Schulhof <gabriel.schulhof@intel.com> | 2020-03-02 20:32:19 -0800 |
commit | 987a67339518d0380177a2e589f2bbd274230d0e (patch) | |
tree | e803c849ffa9db05795e894e9bff4e85e95d06c1 /node.gyp | |
parent | dd8183632d4bc8929371ee4676ef9bb5c95f7aaa (diff) | |
download | node-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.gyp | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -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 { |