disable_outdated_build_detector tests fail with LLD on Windows |
||
Issue descriptionThese tests have failed on the Win LLD TOT bot since they were added: https://build.chromium.org/p/chromium.fyi/builders/CrWinClangLLD%20tester/builds/1087 Some of the failures look like this: [ RUN ] UserLevel/DisableOutdatedBuildDetectorTest.MultiOrganicChrome/0 ../../chrome/tools/disable_outdated_build_detector/disable_outdated_build_detector_unittest.cc(151): error: Value of: DisableOutdatedBuildDetector(command_line_) Actual: 4-byte object <E9-03 00-00> Expected: ExitCode::BOTH_BRANDS_UPDATED Which is: 4-byte object <E8-03 00-00> ../../chrome/tools/disable_outdated_build_detector/disable_outdated_build_detector_unittest.cc(88): error: Value of: key.ReadValueDW(installer::kInstallerResult, &value) Actual: 2 Expected: 0L Which is: 0 ../../chrome/tools/disable_outdated_build_detector/disable_outdated_build_detector_unittest.cc(156): error: Value of: ReadBrand(chrome_distribution_).c_str() Actual: L"GGLS" Expected: L"AOHY" This sounds like some kind of failure to run dynamic initializers in LLD.
,
Aug 10 2016
I'm not sure if this is a compiler/linker bug, or a code bug. The problem is that there are two extern string constants with the same (empty) value in Chromium builds. clang/lld is collapsing them together so that they have the same pointer value.
// App GUIDs for Google Chrome and the Google Chrome binaries.
#if defined(GOOGLE_CHROME_BUILD)
const wchar_t kChromeAppGuid[] = L"{8A69D345-D564-463c-AFF1-A69D9E530F96}";
const wchar_t kBinariesAppGuid[] = L"{4DC8B4CA-1BDA-483e-B5FA-D3C12E15B62D}";
#else
const wchar_t kChromeAppGuid[] = L"";
const wchar_t kBinariesAppGuid[] = L"";
#endif
I can easily put gibberish in there to prevent this, but I would not expect these to be folded together like this. Am I relying on undefined behavior (two constants having distinct pointer values), or is clang/lld doing something wrong?
,
Aug 10 2016
I think your code is correct from a C++ language perspective, objects are supposed to have identity and this is supposed to work:
static char a, b;
void f() { assert(&a != &b); }
I don't think there's anything special about wide character arrays that means their addresses are not important. String literals can definitely get folded, so the result of '"a" == "a"' is unpredictable, but that's not what's going on here.
,
Aug 10 2016
So this is an lld icf bug then?
,
Aug 10 2016
ICF of only code is also non-conforming, so it's hard to say whether this is a bug or a feature. You can call it a bug on the basis that it introduces compatibility issues with MSVC, but some users might appreciate the more aggressive deduplication of constants.
,
Aug 10 2016
Is this something you want to fix in lld?
,
Aug 10 2016
I inclined to say no, because the unsafe ICF optimization is on by default on Windows anyways. We are a little bit more aggressive than what MSVC does, but in spirit we are doing what they intend to do.
,
Aug 11 2016
I have a fix in https://codereview.chromium.org/2236843002/. I'd appreciate it if one of y'all could take a look and LGTM+CQ if you like it. It avoids the pointer comparison altogether rather than hacking around the linker's behavior. Thanks.
,
Aug 12 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/e5c331861fe09a14c01bd70f70087c7b99c1df24 commit e5c331861fe09a14c01bd70f70087c7b99c1df24 Author: grt <grt@chromium.org> Date: Fri Aug 12 21:26:02 2016 Do not rely on identical string constants having distinct pointers. BUG= 635943 R=rnk@chromium.org Review-Url: https://codereview.chromium.org/2236843002 Cr-Commit-Position: refs/heads/master@{#411775} [modify] https://crrev.com/e5c331861fe09a14c01bd70f70087c7b99c1df24/chrome/tools/disable_outdated_build_detector/constants.cc [modify] https://crrev.com/e5c331861fe09a14c01bd70f70087c7b99c1df24/chrome/tools/disable_outdated_build_detector/constants.h [modify] https://crrev.com/e5c331861fe09a14c01bd70f70087c7b99c1df24/chrome/tools/disable_outdated_build_detector/disable_outdated_build_detector.cc [modify] https://crrev.com/e5c331861fe09a14c01bd70f70087c7b99c1df24/chrome/tools/disable_outdated_build_detector/google_update_integration.cc [modify] https://crrev.com/e5c331861fe09a14c01bd70f70087c7b99c1df24/chrome/tools/disable_outdated_build_detector/google_update_integration.h
,
Aug 15 2016
,
Aug 22 2016
(This kind of feels like an lld bug to me tbh. I don't remember seeing this type of problem with gold's heuristic. I suppose it doesn't trigger very often though.) |
||
►
Sign in to add a comment |
||
Comment 1 by grt@chromium.org
, Aug 10 2016Labels: OS-Windows
Owner: grt@chromium.org
Status: Started (was: Untriaged)