GN: How to pass link options in astep on Windows? |
||||||
Issue description
When /GL option is passed to cl.exe, /LTCG option should be passed to lib.exe and link.exe.
Since ldflags has /LTCG option, I added {{ldflags}} in rspfile_content (see [2]), but nothing happened.
Looking build.ninja generated by gyp, libflags options is passed to lib.exe, but the one which gn generated does not have
that flag. gn does not know such a flag, right?
What is the recommended way to pass library flags to lib.exe?
gn should know that?
[1] (current tool("alink") in toolchain/win/BUILD.gn)
tool("alink") {
rspfile = "{{output}}.rsp"
command = "$python_path gyp-win-tool link-wrapper $env False lib.exe /nologo /ignore:4221 /OUT:{{output}} @$rspfile"
description = "LIB {{output}}"
outputs = [
# Ignore {{output_extension}} and always use .lib, there's no reason to
# allow targets to override this extension on Windows.
"{{target_out_dir}}/{{target_output_name}}.lib",
]
default_output_extension = ".lib"
# The use of inputs_newline is to work around a fixed per-line buffer
# size in the linker.
rspfile_content = "{{inputs_newline}}"
}
[2]
rspfile_content = "{{inputs_newline}} {{ldflags}}"
,
Mar 29 2016
Hi Shinyak@, You're right, it looks like we might not have a way to set flags specifically for the lib/alink step, and need to add one. Brett/Bruce/Sébastien, thoughts?
,
Mar 29 2016
Having a way to specify which flags should be passed to lib.exe sounds like a good idea, for full flexibility.
,
Apr 15 2016
Brett, can you take a look at this?
,
Apr 18 2016
Looks like we will need to add arflags like GYP has. We can't use ldflags easily because those are set all over the place assuming it's only going to ld.
,
Apr 19 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/440b117bb10d5c7e195a26cf974ccbd5886948b0 commit 440b117bb10d5c7e195a26cf974ccbd5886948b0 Author: brettw <brettw@chromium.org> Date: Tue Apr 19 21:25:55 2016 Add arflags to GN Allows the build to specify flags to the static library archiver tool. BUG= 598599 Review URL: https://codereview.chromium.org/1904473002 Cr-Commit-Position: refs/heads/master@{#388315} [modify] https://crrev.com/440b117bb10d5c7e195a26cf974ccbd5886948b0/tools/gn/config_values.h [modify] https://crrev.com/440b117bb10d5c7e195a26cf974ccbd5886948b0/tools/gn/config_values_generator.cc [modify] https://crrev.com/440b117bb10d5c7e195a26cf974ccbd5886948b0/tools/gn/docs/reference.md [modify] https://crrev.com/440b117bb10d5c7e195a26cf974ccbd5886948b0/tools/gn/function_toolchain.cc [modify] https://crrev.com/440b117bb10d5c7e195a26cf974ccbd5886948b0/tools/gn/ninja_binary_target_writer.cc [modify] https://crrev.com/440b117bb10d5c7e195a26cf974ccbd5886948b0/tools/gn/ninja_binary_target_writer_unittest.cc [modify] https://crrev.com/440b117bb10d5c7e195a26cf974ccbd5886948b0/tools/gn/substitution_type.cc [modify] https://crrev.com/440b117bb10d5c7e195a26cf974ccbd5886948b0/tools/gn/substitution_type.h [modify] https://crrev.com/440b117bb10d5c7e195a26cf974ccbd5886948b0/tools/gn/variables.cc [modify] https://crrev.com/440b117bb10d5c7e195a26cf974ccbd5886948b0/tools/gn/variables.h
,
Apr 20 2016
,
Apr 20 2016
,
Apr 20 2016
,
Apr 20 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/c33bfab4e4dc2702bc6ccc36038defd850837bd2 commit c33bfab4e4dc2702bc6ccc36038defd850837bd2 Author: brettw <brettw@chromium.org> Date: Wed Apr 20 19:38:45 2016 Implement arflags in the GN build. This flag was recently added in GN. This patch hooks it up to the toolchains and moves some flags to use it that previously had to be hardcoded on the tool command itself. Remove concurrent_links variable from gcc_toolchain which was unused. BUG= 598599 Review URL: https://codereview.chromium.org/1896163003 Cr-Commit-Position: refs/heads/master@{#388554} [modify] https://crrev.com/c33bfab4e4dc2702bc6ccc36038defd850837bd2/build/config/compiler/BUILD.gn [modify] https://crrev.com/c33bfab4e4dc2702bc6ccc36038defd850837bd2/build/config/win/BUILD.gn [modify] https://crrev.com/c33bfab4e4dc2702bc6ccc36038defd850837bd2/build/toolchain/gcc_toolchain.gni [modify] https://crrev.com/c33bfab4e4dc2702bc6ccc36038defd850837bd2/build/toolchain/mac/BUILD.gn [modify] https://crrev.com/c33bfab4e4dc2702bc6ccc36038defd850837bd2/build/toolchain/win/BUILD.gn
,
Apr 21 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/0d539e12630324a0ab446b19cacf765761cf9684 commit 0d539e12630324a0ab446b19cacf765761cf9684 Author: jbudorick <jbudorick@chromium.org> Date: Thu Apr 21 01:04:45 2016 Revert of Implement arflags in the GN build. (patchset #2 id:20001 of https://codereview.chromium.org/1896163003/ ) Reason for revert: variety of compile failures on Android bots that have been switched to GN, see https://codereview.chromium.org/1896163003/#msg18 Original issue's description: > Implement arflags in the GN build. > > This flag was recently added in GN. This patch hooks it up to the toolchains > and moves some flags to use it that previously had to be hardcoded on the > tool command itself. > > Remove concurrent_links variable from gcc_toolchain which was unused. > > BUG= 598599 TBR=brucedawson@chromium.org,brettw@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG= 598599 Review URL: https://codereview.chromium.org/1903363003 Cr-Commit-Position: refs/heads/master@{#388646} [modify] https://crrev.com/0d539e12630324a0ab446b19cacf765761cf9684/build/config/compiler/BUILD.gn [modify] https://crrev.com/0d539e12630324a0ab446b19cacf765761cf9684/build/config/win/BUILD.gn [modify] https://crrev.com/0d539e12630324a0ab446b19cacf765761cf9684/build/toolchain/gcc_toolchain.gni [modify] https://crrev.com/0d539e12630324a0ab446b19cacf765761cf9684/build/toolchain/mac/BUILD.gn [modify] https://crrev.com/0d539e12630324a0ab446b19cacf765761cf9684/build/toolchain/win/BUILD.gn
,
Apr 22 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/920a09e4e58f92bf1ece1fcf1f31ec44185a4959 commit 920a09e4e58f92bf1ece1fcf1f31ec44185a4959 Author: brettw <brettw@chromium.org> Date: Fri Apr 22 00:22:47 2016 Implement arflags in the GN build. This flag was recently added in GN. This patch hooks it up to the toolchains and moves some flags to use it that previously had to be hardcoded on the tool command itself. Remove concurrent_links variable from gcc_toolchain which was unused. BUG= 598599 Reland of http://crrev.com/1896163003 with fix. Review URL: https://codereview.chromium.org/1909163002 Cr-Commit-Position: refs/heads/master@{#388971} [modify] https://crrev.com/920a09e4e58f92bf1ece1fcf1f31ec44185a4959/build/config/compiler/BUILD.gn [modify] https://crrev.com/920a09e4e58f92bf1ece1fcf1f31ec44185a4959/build/config/posix/BUILD.gn [modify] https://crrev.com/920a09e4e58f92bf1ece1fcf1f31ec44185a4959/build/config/win/BUILD.gn [modify] https://crrev.com/920a09e4e58f92bf1ece1fcf1f31ec44185a4959/build/toolchain/gcc_toolchain.gni [modify] https://crrev.com/920a09e4e58f92bf1ece1fcf1f31ec44185a4959/build/toolchain/mac/BUILD.gn [modify] https://crrev.com/920a09e4e58f92bf1ece1fcf1f31ec44185a4959/build/toolchain/win/BUILD.gn
,
Apr 22 2016
The arflags aren't getting passed to lib.exe on Windows builds. I just grabbed ToT and hit these warnings (many repetitions elided): C:\src\chromium3\src>ninja -v -d keeprsp -C out\Debug_gn_component mesa ninja: Entering directory `out\Debug_gn_component' [1 processes, 0/1 @ ?/s : 0.000s ] C:/python_27_amd64/files/python.exe gyp-win-tool link-wrapper environment.x86 False lib.exe /nologo /OUT:obj/third_party/mesa/mesa.lib @obj/third_party/mesa/mesa.lib.rsp m_debug_xform.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library m_debug_norm.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library ... Examining the .rsp file confirms that there is no /ignore:4221 option being passed. Thoughts on how to diagnose?
,
Apr 22 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/2ce39e29422675764e94de94458ce3bb22fe53d3 commit 2ce39e29422675764e94de94458ce3bb22fe53d3 Author: jbudorick <jbudorick@chromium.org> Date: Fri Apr 22 02:17:35 2016 Revert of Implement arflags in the GN build. (patchset #2 id:20001 of https://codereview.chromium.org/1909163002/ ) Reason for revert: speculatively reverting: issues with linking on the gpu bots again: https://build.chromium.org/p/chromium.gpu/builders/Android%20Debug%20%28Nexus%206%29/builds/8079 Original issue's description: > Implement arflags in the GN build. > > This flag was recently added in GN. This patch hooks it up to the toolchains > and moves some flags to use it that previously had to be hardcoded on the > tool command itself. > > Remove concurrent_links variable from gcc_toolchain which was unused. > > BUG= 598599 > Reland of http://crrev.com/1896163003 with fix. TBR=brucedawson@chromium.org,brettw@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG= 598599 Review URL: https://codereview.chromium.org/1910393002 Cr-Commit-Position: refs/heads/master@{#389000} [modify] https://crrev.com/2ce39e29422675764e94de94458ce3bb22fe53d3/build/config/compiler/BUILD.gn [modify] https://crrev.com/2ce39e29422675764e94de94458ce3bb22fe53d3/build/config/posix/BUILD.gn [modify] https://crrev.com/2ce39e29422675764e94de94458ce3bb22fe53d3/build/config/win/BUILD.gn [modify] https://crrev.com/2ce39e29422675764e94de94458ce3bb22fe53d3/build/toolchain/gcc_toolchain.gni [modify] https://crrev.com/2ce39e29422675764e94de94458ce3bb22fe53d3/build/toolchain/mac/BUILD.gn [modify] https://crrev.com/2ce39e29422675764e94de94458ce3bb22fe53d3/build/toolchain/win/BUILD.gn
,
Apr 22 2016
also failed on the gpu n5: https://build.chromium.org/p/chromium.gpu/builders/Android%20Debug%20%28Nexus%205%29/builds/7327 (looking for others)
,
Apr 22 2016
and mips and x86 on chromium.android: https://build.chromium.org/p/chromium.android/builders/Android%20MIPS%20Builder%20%28dbg%29/builds/4526 https://build.chromium.org/p/chromium.android/builders/Android%20x86%20Builder%20%28dbg%29/builds/3861 (though those aren't tree closers, unlike the gpu failures)
,
Apr 28 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/897cde76d084732227ea88af76163e33eda18778 commit 897cde76d084732227ea88af76163e33eda18778 Author: brettw <brettw@chromium.org> Date: Thu Apr 28 18:21:09 2016 Implement arflags in the GN build. This flag was recently added in GN. This patch hooks it up to the toolchains and moves some flags to use it that previously had to be hardcoded on the tool command itself. Remove concurrent_links variable from gcc_toolchain which was unused. BUG= 598599 Reland of http://crrev.com/1909163002 with no changes (now that a GN binary push to fix the bug has gone in) which was a reland of http://crrev.com/1896163003 with fix. Review-Url: https://codereview.chromium.org/1907403002 Cr-Commit-Position: refs/heads/master@{#390424} [modify] https://crrev.com/897cde76d084732227ea88af76163e33eda18778/build/config/compiler/BUILD.gn [modify] https://crrev.com/897cde76d084732227ea88af76163e33eda18778/build/config/posix/BUILD.gn [modify] https://crrev.com/897cde76d084732227ea88af76163e33eda18778/build/config/win/BUILD.gn [modify] https://crrev.com/897cde76d084732227ea88af76163e33eda18778/build/toolchain/gcc_toolchain.gni [modify] https://crrev.com/897cde76d084732227ea88af76163e33eda18778/build/toolchain/mac/BUILD.gn [modify] https://crrev.com/897cde76d084732227ea88af76163e33eda18778/build/toolchain/win/BUILD.gn
,
Apr 29 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/500a5624ab6d616b503bf75449cfc772b9c3d2c2 commit 500a5624ab6d616b503bf75449cfc772b9c3d2c2 Author: bpastene <bpastene@chromium.org> Date: Fri Apr 29 00:39:26 2016 Revert of Implement arflags in the GN build. (patchset #4 id:60001 of https://codereview.chromium.org/1907403002/ ) Reason for revert: As with the previous attempts to land this cl, android and GPU builders are failing compile with OOM errors: https://bugs.chromium.org/p/chromium/issues/detail?id=607673 Original issue's description: > Implement arflags in the GN build. > > This flag was recently added in GN. This patch hooks it up to the toolchains > and moves some flags to use it that previously had to be hardcoded on the > tool command itself. > > Remove concurrent_links variable from gcc_toolchain which was unused. > > BUG= 598599 > Reland of http://crrev.com/1909163002 with no changes (now that a GN binary push to fix the bug has gone in) which was a reland of http://crrev.com/1896163003 with fix. TBR=brucedawson@chromium.org,brettw@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG= 598599 Review-Url: https://codereview.chromium.org/1930293002 Cr-Commit-Position: refs/heads/master@{#390545} [modify] https://crrev.com/500a5624ab6d616b503bf75449cfc772b9c3d2c2/build/config/compiler/BUILD.gn [modify] https://crrev.com/500a5624ab6d616b503bf75449cfc772b9c3d2c2/build/config/posix/BUILD.gn [modify] https://crrev.com/500a5624ab6d616b503bf75449cfc772b9c3d2c2/build/config/win/BUILD.gn [modify] https://crrev.com/500a5624ab6d616b503bf75449cfc772b9c3d2c2/build/toolchain/gcc_toolchain.gni [modify] https://crrev.com/500a5624ab6d616b503bf75449cfc772b9c3d2c2/build/toolchain/mac/BUILD.gn [modify] https://crrev.com/500a5624ab6d616b503bf75449cfc772b9c3d2c2/build/toolchain/win/BUILD.gn
,
Apr 29 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/5404cdff57233dbad6e0b20afd547e445c57cd23 commit 5404cdff57233dbad6e0b20afd547e445c57cd23 Author: brettw <brettw@chromium.org> Date: Fri Apr 29 23:10:39 2016 Implement arflags in the GN build. This flag was recently added in GN. This patch hooks it up to the toolchains and moves some flags to use it that previously had to be hardcoded on the tool command itself. Clarifies usage of concurrent_links variable in gcc_toolchain which was confusing. TBR=brucedawson@chromium.org BUG= 598599 Reland of http://crrev.com/1909163002 with fixes which was a reland of http://crrev.com/1896163003 with fix. Review-Url: https://codereview.chromium.org/1924203004 Cr-Commit-Position: refs/heads/master@{#390797} [modify] https://crrev.com/5404cdff57233dbad6e0b20afd547e445c57cd23/build/config/compiler/BUILD.gn [modify] https://crrev.com/5404cdff57233dbad6e0b20afd547e445c57cd23/build/config/posix/BUILD.gn [modify] https://crrev.com/5404cdff57233dbad6e0b20afd547e445c57cd23/build/config/win/BUILD.gn [modify] https://crrev.com/5404cdff57233dbad6e0b20afd547e445c57cd23/build/toolchain/gcc_toolchain.gni [modify] https://crrev.com/5404cdff57233dbad6e0b20afd547e445c57cd23/build/toolchain/mac/BUILD.gn [modify] https://crrev.com/5404cdff57233dbad6e0b20afd547e445c57cd23/build/toolchain/win/BUILD.gn |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by shinyak@chromium.org
, Mar 29 2016