gn: Add runtime_link_output to tool("solib")

gn's tool("solink") has two settings for the output of the rule:
link_output and depend_output. link_output is what targets depending
on a shared_library are linked against, and depend_output is what
is used for the ninja dependency.

On POSIX, this is used to implement a component build optimization:
If a shared library is linked but its public interface doesn't change, then
it's not necessary to relink its downstream dependencies. To implement
this, depend_output is set to a text file that contains a description of all
public symbols of the shared library. The link step first links and then
checks if the new public symbols are different from the old contents of
the file, and only then does it overwrite the TOC file. This allows ninja's
restat optimization to work.

However, downstream dependencies need to link against the actual .so
file on the link line `ld -o foo libinput.so`, so link_output needs to be set
to the .so file.

On Windows, link.exe writes a .lib and a .dll file when it creates a .dll file.
The .lib is only written when needed with incremental links, so if
depend_output is set to the .lib then the restat optimization works there
too. And downstream dependencies also need to link to the .lib at
link time, so in Windows both depend_output and link_output must
be set the the .lib file.

So far, so good. However, `gn desc runtime_deps` is used to print what files
need to be copied to swarming bots to run an executable, and that currently
looks at link_output. On POSIX that's ok, but on Windows that ends up
copying the .lib instead of the .dll.

This patch adds a third setting "runtime_link_output" which can be set
to the output of the solink tool that must be present at runtime. It defaults
to link_output (which does the right thing on POSIX), but it can be set to the
.dll file to make `gn desc runtime_deps` do the right thing on Windows.

This is needed to make swarming work in component builds on Windows.

BUG=354261, 498033
R=dpranke@chromium.org, scottmg@chromium.org

Review URL: https://codereview.chromium.org/1690843002 .

Cr-Original-Commit-Position: refs/heads/master@{#374840}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: e3398c19aa9769ad99e97a9fabf29614d645a095
7 files changed
tree: b5d84f475457031f3303c4721add7a57aaea7f70
  1. tools/