From e03a7b2a2b3f092338004a28d07971f4104e9da9 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Wed, 3 Aug 2016 11:23:24 +0200 Subject: [PATCH] build: turn on thin static archives MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: https://github.com/nodejs/node/pull/7957 Reviewed-By: Johan Bergström Reviewed-By: James M Snell --- common.gypi | 5 +++-- node.gyp | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/common.gypi b/common.gypi index ee31349eb02b09..01ab2def6e0f29 100644 --- a/common.gypi +++ b/common.gypi @@ -271,8 +271,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': [ diff --git a/node.gyp b/node.gyp index 9f0645fe4245a1..87047080883c24 100644 --- a/node.gyp +++ b/node.gyp @@ -366,7 +366,9 @@ 'conditions': [ ['OS in "linux freebsd" and node_shared=="false"', { 'ldflags': [ - '-Wl,--whole-archive <(PRODUCT_DIR)/<(OPENSSL_PRODUCT)', + '-Wl,--whole-archive,' + '<(PRODUCT_DIR)/obj.target/deps/openssl/' + '<(OPENSSL_PRODUCT)', '-Wl,--no-whole-archive', ], }],