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: enabling lto at configure · nodejs/node@c02fb88

File tree

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

‎common.gypi‎

Copy file name to clipboardExpand all lines: common.gypi
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,17 @@
176176
['OS!="mac" and OS!="win"', {
177177
'cflags': [ '-fno-omit-frame-pointer' ],
178178
}],
179+
['OS=="linux"', {
180+
'variables': {
181+
'lto': ' -flto=4 -fuse-linker-plugin -ffat-lto-objects ',
182+
},
183+
'conditions': [
184+
['enable_lto=="true"', {
185+
'cflags': ['<(lto)'],
186+
'ldflags': ['<(lto)'],
187+
},],
188+
],
189+
},],
179190
['OS == "android"', {
180191
'cflags': [ '-fPIE' ],
181192
'ldflags': [ '-fPIE', '-pie' ]
Collapse file

‎configure‎

Copy file name to clipboardExpand all lines: configure
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,11 @@ parser.add_option("--enable-vtune-profiling",
157157
"JavaScript code executed in nodejs. This feature is only available "
158158
"for x32, x86, and x64 architectures.")
159159

160+
parser.add_option("--enable-lto",
161+
action="store_true",
162+
dest="enable_lto",
163+
help="Enable compiling with lto of a binary. This feature is only available "
164+
"on linux with gcc and g++.")
160165

161166
parser.add_option("--link-module",
162167
action="append",
@@ -932,6 +937,25 @@ def configure_node(o):
932937
else:
933938
o['variables']['node_enable_v8_vtunejit'] = 'false'
934939

940+
if flavor != 'linux' and (options.enable_lto):
941+
raise Exception(
942+
'The lto option is supported only on linux.')
943+
944+
if flavor == 'linux':
945+
if options.enable_lto:
946+
version_checked = (5, 4, 1)
947+
for compiler in [(CC, 'c'), (CXX, 'c++')]:
948+
ok, is_clang, clang_version, compiler_version = \
949+
try_check_compiler(compiler[0], compiler[1])
950+
compiler_version_num = tuple(map(int, compiler_version))
951+
if is_clang or compiler_version_num < version_checked:
952+
version_checked_str = ".".join(map(str, version_checked))
953+
raise Exception(
954+
'The option --enable-lto is supported for gcc and gxx %s'
955+
' or newer only.' % (version_checked_str))
956+
957+
o['variables']['enable_lto'] = b(options.enable_lto)
958+
935959
if flavor in ('solaris', 'mac', 'linux', 'freebsd'):
936960
use_dtrace = not options.without_dtrace
937961
# Don't enable by default on linux and freebsd

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.