Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Issue 1209553002: Do not remote duplicate entries from ldflags when generating ninja files as it changes behavior (Closed)

Created:
5 years, 6 months ago by yurys
Modified:
5 years, 5 months ago
Reviewers:
Nico, Evan Martin
CC:
gyp-developer_googlegroups.com
Base URL:
https://chromium.googlesource.com/external/gyp.git@master
Target Ref:
refs/heads/master
Project:
gyp
Visibility:
Public.

Description

Do 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+90 lines, -8 lines) Patch
M pylib/gyp/generator/ninja.py View 1 chunk +1 line, -1 line 0 comments Download
A test/ldflags-duplicates/check-ldflags.py View 1 2 3 4 1 chunk +25 lines, -0 lines 0 comments Download
A + test/ldflags-duplicates/gyptest-ldflags-duplicates.py View 1 2 1 chunk +12 lines, -2 lines 0 comments Download
A + test/ldflags-duplicates/lib1.c View 1 2 3 4 5 6 1 chunk +3 lines, -2 lines 0 comments Download
A + test/ldflags-duplicates/lib2.c View 1 2 3 4 5 6 1 chunk +3 lines, -2 lines 0 comments Download
A + test/ldflags-duplicates/main.c View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
A test/ldflags-duplicates/test.gyp View 1 2 3 4 1 chunk +45 lines, -0 lines 0 comments Download

Messages

Total messages: 24 (10 generated)
yurys
5 years, 6 months ago (2015-06-24 12:22:47 UTC) #2
commit-bot: I haz the power
Commit queue rejected this change because it did not recognize the base URL. Please commit ...
5 years, 6 months ago (2015-06-24 12:26:04 UTC) #5
Nico
Hm, the make generator seems to only unique libraries, not ldflags. Looks like this call ...
5 years, 6 months ago (2015-06-24 17:47:51 UTC) #7
yurys
On 2015/06/24 17:47:51, Nico (away Wed Jun 24) wrote: > Hm, the make generator seems ...
5 years, 6 months ago (2015-06-24 18:57:45 UTC) #8
yurys
Added a test. PTAL.
5 years, 6 months ago (2015-06-25 14:43:59 UTC) #9
Nico
https://codereview.chromium.org/1209553002/diff/20001/test/ninja/duplicate-ldflags/gyptest-duplicate-ldflags.py File test/ninja/duplicate-ldflags/gyptest-duplicate-ldflags.py (right): https://codereview.chromium.org/1209553002/diff/20001/test/ninja/duplicate-ldflags/gyptest-duplicate-ldflags.py#newcode17 test/ninja/duplicate-ldflags/gyptest-duplicate-ldflags.py:17: '-Wl,--whole-archive lib1.a -Wl,--no-whole-archive') Can you rewrite this to not ...
5 years, 6 months ago (2015-06-25 16:02:21 UTC) #10
yurys
On 2015/06/25 16:02:21, Nico wrote: > https://codereview.chromium.org/1209553002/diff/20001/test/ninja/duplicate-ldflags/gyptest-duplicate-ldflags.py > File test/ninja/duplicate-ldflags/gyptest-duplicate-ldflags.py (right): > > https://codereview.chromium.org/1209553002/diff/20001/test/ninja/duplicate-ldflags/gyptest-duplicate-ldflags.py#newcode17 > ...
5 years, 6 months ago (2015-06-26 09:35:50 UTC) #11
Nico
lgtm, thanks!
5 years, 6 months ago (2015-06-26 17:15:36 UTC) #12
commit-bot: I haz the power
Commit queue rejected this change because it did not recognize the base URL. Please commit ...
5 years, 5 months ago (2015-06-27 07:22:01 UTC) #16
commit-bot: I haz the power
Commit queue rejected this change because it did not recognize the base URL. Please commit ...
5 years, 5 months ago (2015-06-27 07:27:02 UTC) #20
yurys
Nico, do I need to request write access for this particular repository or Chromium commit ...
5 years, 5 months ago (2015-06-27 08:23:45 UTC) #21
Nico
Committed patchset #7 (id:120001) manually as 25ed9ac4ac2a4d2a08909225fbb6d56e89ad38a6 (presubmit successful).
5 years, 5 months ago (2015-06-28 01:04:14 UTC) #22
Nico
I landed this for you. Your test failed for me on OS X (it doesnt' ...
5 years, 5 months ago (2015-06-28 01:05:04 UTC) #23
yurys
5 years, 5 months ago (2015-06-29 06:56:33 UTC) #24
Message was sent while issue was closed.
Thanks for landing this. I confirm that the test still does what expected.

On 2015/06/28 01:05:04, Nico wrote:
> I landed this for you. Your test failed for me on OS X (it doesnt' use
> cflags/ldflags), so I tried to make it linux-only and moved it below
test/linux.
> Please check that the test still does the right thing.

Powered by Google App Engine
This is Rietveld 408576698