DescriptionDo not remote duplicate entries from ldflags when generating ninja files as it changes behavior
In some cases linker command line is required to contain duplicate entries. One example is to pass
-Wl,--whole-archive <libs> -Wl,--no-whole-archive. Removing repeating --no-whole-archive will result in incorrect behavior.
This happens e.g. when generating ninja files for io.js (./tools/gyp_node.py -f ninja). Without this fix linkage would fail due to multiple definition of symbols from libopenssl and libv8_base. That's because node.gyp contains several places where ldflags are extended with manual flags, e.g. https://github.com/nodejs/io.js/commit/9f36c0d235f4eb7e6528face49c15045a5e41e14 . Without this CL iojs.ninja contains
ldflags = -pthread -rdynamic -m64 -Wl,--whole-archive libopenssl.a $
-Wl,--no-whole-archive -Wl,-z,noexecstack -Wl,--whole-archive libv8_base.a
Notice unbalanced --whole-archive. With the patch it becomes
ldflags = -pthread -rdynamic -m64 -Wl,--whole-archive libopenssl.a $
-Wl,--no-whole-archive -Wl,-z,noexecstack -Wl,--whole-archive $
libv8_base.a -Wl,--no-whole-archive -pthread
BUG=None
R=thakis@chromium.org
Committed: https://chromium.googlesource.com/external/gyp/+/25ed9ac4ac2a4d2a08909225fbb6d56e89ad38a6
Patch Set 1 #Patch Set 2 : Added test #
Total comments: 1
Patch Set 3 : Added test using LINK_wrapper #Patch Set 4 : #Patch Set 5 : Make now puts lib1.a and lib2.a into PRODUCT_DIR #Patch Set 6 : Rebase #Patch Set 7 : Updated license headers #
Messages
Total messages: 24 (10 generated)
|