Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
'python%': 'python',

'node_tag%': '',
'node_use_lto%': '',
'uv_library%': 'static_library',

'openssl_fips%': '',
Expand Down Expand Up @@ -290,6 +291,13 @@
],
'ldflags!': [ '-rdynamic' ],
}],
['node_use_lto=="true"', {
'conditions': [ [ 'clang==1', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put the condition on a separate line?

'cflags': [ '-flto' ],
}, {
'cflags': [ '-flto=16' ],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this a bit overkill? My most powerful machine only has 8 cores...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we pass our JOBS env stuff here somehow?

} ] ],
}],
],
}],
[ 'OS=="android"', {
Expand Down Expand Up @@ -343,6 +351,13 @@
'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++0x', # -std=gnu++0x
},
}],
['node_use_lto=="true"', {
'xcode_settings': {
'OTHER_CFLAGS': [
'-flto',
],
},
}],
],
}],
['OS=="freebsd" and node_use_dtrace=="true"', {
Expand Down
7 changes: 7 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,11 @@ parser.add_option('--with-lttng',
dest='with_lttng',
help='build with Lttng (Only available to Linux)')

parser.add_option('--with-lto',
action='store_true',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny nit: It would be better we passed default=False as one of the arguments to add_option.

dest='use_lto',
help='build with -flto flag (Link Time Optimization)')

parser.add_option('--with-etw',
action='store_true',
dest='with_etw',
Expand Down Expand Up @@ -777,6 +782,8 @@ def configure_node(o):
else:
o['variables']['node_use_lttng'] = 'false'

o['variables']['node_use_lto'] = b(options.use_lto)

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

Expand Down