Skip to content

Commit

Permalink
build: turn on thin static archives
Browse files Browse the repository at this point in the history
Thin archives were disabled in 2012 as a workaround (IIRC) for obsolete
tooling on one of Joyent's platforms.  The last binutils versions that
didn't support them was released in 2007 so I think it's safe to assume
we can drop support for that now - except on SmartOS, where the tooling
still has a distinctive vintage feel to it.

Thin archives save space - it shrinks the size of PRODUCT_DIR by 30% -
and speed up the final linking step because it doesn't have to assemble
50 MB of static archives (twice! - first to create the archive, then to
copy it to PRODUCT_DIR).  The archives are just 3.5 MB now and no longer
copied around.

PR-URL: #7957
Reviewed-By: Johan Bergström <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
bnoordhuis authored and MylesBorins committed Oct 26, 2016
1 parent 36b3ff0 commit 1b5f35f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,9 @@
'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++0x' ],
'ldflags': [ '-rdynamic' ],
'target_conditions': [
['_type=="static_library"', {
'standalone_static_library': 1, # disable thin archive which needs binutils >= 2.19
# The 1990s toolchain on SmartOS can't handle thin archives.
['_type=="static_library" and OS=="solaris"', {
'standalone_static_library': 1,
}],
],
'conditions': [
Expand Down
4 changes: 3 additions & 1 deletion node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,9 @@
'conditions': [
['OS in "linux freebsd"', {
'ldflags': [
'-Wl,--whole-archive <(PRODUCT_DIR)/<(OPENSSL_PRODUCT)',
'-Wl,--whole-archive,'
'<(PRODUCT_DIR)/obj.target/deps/openssl/'
'<(OPENSSL_PRODUCT)',
'-Wl,--no-whole-archive',
],
}],
Expand Down

0 comments on commit 1b5f35f

Please sign in to comment.