New issue
Advanced search Search tips

Issue 659007 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Dec 2016
Cc:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Bug

Blocked on:
issue 621236



Sign in to add a comment

Treat linker warnings as error on Windows

Project Member Reported by pkasting@chromium.org, Oct 25 2016

Issue description

We keep having instances of LNK4217 creep into the build.   Bug 654776  is one of several issues I've seen in the past few months about this; I just reported another one in  bug 606766  comment 37.

We should prevent these from creeping in by making LNK4217 an error, so the bots will break if people try to check this in.
 
Agreed. Those warnings are frustrating, and making them errors is the only way to make them stay away.

Apparently there is an option to make all linker warnings be errors - /WX:

https://msdn.microsoft.com/en-us/library/ms235592.aspx

However we would have to use it with care. In particular our official builds have some benign warnings. We might be able to enable /WX on component builds only, since that seems to be when LNK4217 shows up. We could also use /WX in conjunction with the undocumented /IGNORE:NNNN flag to ignore known-benign warnings.

I'd assign the bug to myself immediately but I don't know when I'd actually have time to work on it, but I heartily endorse this idea.

Summary: Treat linker warnings as error on Windows (was: Make LNK4217 an error on Windows)
Is it feasible to fix or work around the benign warnings on the official builders?  Otherwise /IGNORE sounds like the right way to go (I'd rather not only turn on /WX for component builds, that seems more confusing).
The benign official warnings happen when the linker is started without /LTCG and encounters some LTCG object files, or when it is started with /LTCG and doesn't encounter any LTCG object files.

This is designed for a world where LTCG is an all-or-nothing decision, and for Chrome it is an infinitely messy web of tradeoffs (build-times versus performance) and bug workarounds. So, maybe I'm too pessimistic, but my inclination would be to /IGNORE those warnings and then /WX.

Comment 4 by w...@chromium.org, Dec 16 2016

Owner: w...@chromium.org
Status: Started (was: Untriaged)

Comment 5 by w...@chromium.org, Dec 19 2016

Re #3: I have a simple patch which adds "/WX". As things stand:
- Component builds will fail due to LNK4217 (locally defined symbol imported in function).
- Release builds will fail due to LNK4075 (ignoring '/INCREMENTAL' due to '/OPT:ICF'.
- Official builds log the LTCG message but nonetheless succeed - the LTCG messages are not in fact warnings.

Comment 6 by w...@chromium.org, Dec 19 2016

Blockedon: 654776
Blockedon: 621236
I think you should try to land your patch with exclusions - subtract the config for the two scenarios you mention where it causes failures. Those two bugs are linked to this one so when they are fixed the exclusions can be removed. The exclusions should be as specific as possible so that new warnings avoid being introduced.

Comment 9 by w...@chromium.org, Dec 20 2016

Blockedon: 676055

Comment 10 by w...@chromium.org, Dec 20 2016

Blockedon: -676055
Project Member

Comment 11 by bugdroid1@chromium.org, Dec 22 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/f6aa9ef3cd873f0cb097e3621f262c72a3876c7d

commit f6aa9ef3cd873f0cb097e3621f262c72a3876c7d
Author: wez <wez@chromium.org>
Date: Thu Dec 22 21:46:17 2016

Fix conditional for /OPT:ICF so Debug non-component build does not warn.

The condition under which /OPT:ICF was enabled was out-of-sync with the
conditions for enabling incremental linking. Since the two are not
compatible the difference resulted in linker warnings in Debug
non-component builds.

BUG= 621236 ,  659007 

Review-Url: https://codereview.chromium.org/2594153002
Cr-Commit-Position: refs/heads/master@{#440514}

[modify] https://crrev.com/f6aa9ef3cd873f0cb097e3621f262c72a3876c7d/build/config/compiler/BUILD.gn

Project Member

Comment 12 by bugdroid1@chromium.org, Dec 23 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c868aae8f9b8d51461afff79064c75339e6ce30c

commit c868aae8f9b8d51461afff79064c75339e6ce30c
Author: wez <wez@chromium.org>
Date: Fri Dec 23 08:09:04 2016

Use the /WX flag to have link warnings treated as errors.

Link steps with warnings typically lead to working binaries, but warnings can indicate dependency issues in the codebase, slow down builds, and otherwise just make it harder to find more relevant output in build logs.

This CL also adds exceptions to ignore certain linker warnings under specific configurations and targets.

BUG= 659007 ,  676418 , 676417,  654776 

Review-Url: https://codereview.chromium.org/2581893002
Cr-Commit-Position: refs/heads/master@{#440600}

[modify] https://crrev.com/c868aae8f9b8d51461afff79064c75339e6ce30c/build/config/compiler/BUILD.gn
[modify] https://crrev.com/c868aae8f9b8d51461afff79064c75339e6ce30c/build/config/win/BUILD.gn
[modify] https://crrev.com/c868aae8f9b8d51461afff79064c75339e6ce30c/media/BUILD.gn
[modify] https://crrev.com/c868aae8f9b8d51461afff79064c75339e6ce30c/media/mojo/BUILD.gn
[modify] https://crrev.com/c868aae8f9b8d51461afff79064c75339e6ce30c/media/mojo/services/BUILD.gn
[modify] https://crrev.com/c868aae8f9b8d51461afff79064c75339e6ce30c/third_party/WebKit/Source/platform/BUILD.gn

\o/  

Comment 14 by w...@chromium.org, Dec 23 2016

Blockedon: -654776

Comment 15 by w...@chromium.org, Dec 23 2016

Status: Fixed (was: Started)

Sign in to add a comment