GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — build: enable pie on linux · nodejs/node@4f282b8

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • common.gypi
  • configure.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎common.gypi‎

Copy file name to clipboardExpand all lines: common.gypi
+17Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,23 @@
686686
'cflags': [ '-fPIC' ],
687687
'ldflags': [ '-fPIC' ],
688688
}],
689+
# Link executables as PIE so that ASLR randomizes the executable
690+
# image too. Every object in a PIE must be built with `-fPIC` or
691+
# `-fPIE`. PIE flags should not apply to shared library objects,
692+
# like addons. `--fully-static` uses `-static-pie`, see configure.py.
693+
[ 'OS=="linux" and configuring_node', {
694+
'target_conditions': [
695+
['_type=="executable"', {
696+
'ldflags': [ '-pie' ],
697+
}],
698+
],
699+
'conditions': [
700+
# Use `-fPIE` unless the condition above uses `-fPIC`.
701+
[ 'node_shared!="true" and node_enable_v8debughelper!="true"', {
702+
'cflags': [ '-fPIE' ],
703+
}],
704+
],
705+
}],
689706
],
690707
}],
691708
[ 'OS in "aix os400"', {
Collapse file

‎configure.py‎

Copy file name to clipboardExpand all lines: configure.py
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2546,7 +2546,12 @@ def configure_static(o):
25462546
return
25472547

25482548
if options.fully_static:
2549-
o['libraries'] += ['-static']
2549+
if flavor == 'linux':
2550+
# `-static` drops the `-pie` from common.gypi, e.g. clang:
2551+
# https://github.com/llvm/llvm-project/blob/68b03cf380e61c86aa59f94a10e8ce2d4c10cbb0/clang/lib/Driver/ToolChains/Gnu.cpp#L351-L366
2552+
o['libraries'] += ['-static-pie']
2553+
else:
2554+
o['libraries'] += ['-static']
25502555
elif options.partly_static:
25512556
o['libraries'] += ['-static-libgcc', '-static-libstdc++']
25522557
if options.enable_asan:

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.