Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve linking of crates with circular dependencies #69371

Merged
merged 2 commits into from Mar 3, 2020

Conversation

@tmiasko
Copy link

tmiasko commented Feb 22, 2020

Previously, the code responsible for handling the cycles between crates
introduces through weak lang items, would keep a set of missing language
items:

  • extending it with items missing from the current crate,
  • removing items provided by the current crate,
  • grouping the crates when the set changed from non-empty back to empty.

This could produce incorrect results, if a lang item was missing from a
crate that comes after the crate that provides it (in the loop iteration
order). In that case the grouping would not take place.

The changes here address this specific failure scenario by keeping track
of two separate sets of crates. Those that are required to link successfully,
and those that are available for linking.

Verified using test case from #69368.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Feb 22, 2020

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @davidtwco (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@tmiasko tmiasko force-pushed the tmiasko:weak-lang-cycle branch from 2a5cef8 to 59fab0d Feb 22, 2020
@davidtwco

This comment has been minimized.

Copy link
Member

davidtwco commented Feb 22, 2020

r? @eddyb

@rust-highfive rust-highfive assigned eddyb and unassigned davidtwco Feb 22, 2020
@eddyb

This comment has been minimized.

Copy link
Member

eddyb commented Feb 24, 2020

I am not familiar with --{start,end}-group or the problem solved here.

r? @alexcrichton (who authored #49316)

@rust-highfive rust-highfive assigned alexcrichton and unassigned eddyb Feb 24, 2020
@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Feb 25, 2020

Thanks for the PR!

I'm not sure I fully understand why the previous iteration was incorrect, though. Can you describe in more detail why --start-group and such were in the wrong place or omitted?

Additionally, would it be possible to add a test to this PR?

@tmiasko

This comment has been minimized.

Copy link
Author

tmiasko commented Feb 25, 2020

  1. Crates will generally miss EhPersonalityLangItem because of code here:
    pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx>, items: &mut lang_items::LanguageItems) {
    // These are never called by user code, they're generated by the compiler.
    // They will never implicitly be added to the `missing` array unless we do
    // so here.
    if items.eh_personality().is_none() {
    items.missing.push(lang_items::EhPersonalityLangItem);
    }
    if tcx.sess.target.target.options.custom_unwind_resume & items.eh_unwind_resume().is_none() {
    items.missing.push(lang_items::EhUnwindResumeLangItem);
    }
    {
    let mut cx = Context { tcx, items };
    tcx.hir().krate().visit_all_item_likes(&mut cx.as_deep_visitor());
    }
    verify(tcx, items);
    }
  2. Previously, it was unlikely for end_with to ever be empty, since even if EhPersonalityLangItem was momentarily removed by retain, it would be immediately added back in by the next crate and then never removed again.
  3. Thus, group_start would generally remain none, and trigger logic that prevents creation of the group
    // If we didn't end up filling in all lang items from upstream crates then
    // we'll be filling it in with our crate. This probably means we're the
    // standard library itself, so skip this for now.
    if group_end.is_some() && group_start.is_none() {
    group_end = None;
    }

I don't know how to create small self contained test for this specific bug.
Using cargo + build-std to reproduce the issue is quite heavy-weight solution,
and while I could potentially look at linker arguments in an invocation of
rustc, that could very well change for valid reasons, so wouldn't be very
robust.

@tmiasko

This comment has been minimized.

Copy link
Author

tmiasko commented Feb 26, 2020

The situation from #69368 as happening previously (highlighting only the most relevant language items / crates):

  • alloc requires EhPersonalityLangItem and OomLangItem, end_with = {EhPersonalityLangItem, OomLangItem}.
  • panic_unwind provides EhPersonalityLangItem, end_with = {OomLangItem}.
  • std provides OomLangItem, but also requires EhPersonalityLangItem, so end_with = {EhPersonalityLangItem}.

The end_with is never empty, and grouping does not happen.

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Feb 27, 2020

Ah ok I think I see what's happening now, thanks for the explanation! FWIW the iteration is in reverse order so it's a bit different, but I think it's the same principle. With the current code nothing populates end_with until we get to std, when we get:

  • Looking at std, end_with = {EhPersonalityLangItem}
  • Looking at panic_unwind, end_with = {} (and this closes the group)
  • Looking at alloc, end_with = {EhPersonalityLangItem, OomLangItem}, but the group doesn't reopen

Does this match the behavior you're seeing with the linker? Are we surrounding --start-group and --end-group too early or around the wrong set of crates?

@tmiasko

This comment has been minimized.

Copy link
Author

tmiasko commented Feb 27, 2020

Your comment touches on another aspect that I think is incorrect, but the one
that I do not attempt to fix here. That is, the iteration might stop too early,
at the point where no lang items are missing, but used to be missing earlier
on, without considering remaining crates / lang items.

Note that the order I described in the comment above is already the
reversed one, so we are hitting a different issue, one where no group is
created at all.

There is one additional bit of complexity to the whole story. When using
build-std, the EhPersonalityLangItem is missing from std crate, on the other
hand when building without it, the EhPersonalityLangItem is not considered
missing at all (since std depends on panic_unwind which provides it).

Why the difference then? In the context of reproducer from the issue, the std
is build only as rlib, and even though it is build with panic-unwind
feature, and the panic_unwind is provided through --extern, the dependency
itself is not injected, so the lang item remains to be provided later.

@tmiasko tmiasko force-pushed the tmiasko:weak-lang-cycle branch 3 times, most recently from d743775 to 6ae0ae3 Feb 28, 2020
@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Feb 28, 2020

Hm I don't understand what you mean by your previous comment being reversed, since std depends on alloc won't we visit std first, then only alloc later?

It's true yes that if multiple --start-group and --end-group annotations are needed nothing here works, but that's not the case for the problem at hand here which is basically purely libstd/libcore and the interim crates, so we definitely don't have to deal with a "what if multiple groups" problem.

Also sorry I'm not really understanding what you are saying when you're talking about additional complexity or the difference from the reproducer. I don't really understand how build-std factors into this (how it changes lang item requirements) nor do I understand what different is going on with panic runtimes that has such a large difference here.

@tmiasko

This comment has been minimized.

Copy link
Author

tmiasko commented Feb 28, 2020

We visit alloc first, and std later. After all, the end of the group is set
first, and start of the group later. An example linker invocation looks as
follows:

"cc"
...
"-Wl,--start-group" "-Wl,-Bstatic"
"/../libstd-187e8dd7e6289af3.rlib"
"/../libpanic_unwind-168df06d56a5a3d6.rlib"
"/../libhashbrown-b076add1ee432f68.rlib"
"/../librustc_std_workspace_alloc-f915be2bd0932eb4.rlib"
"/../libbacktrace-fb40584602c8c545.rlib"
"/../libbacktrace_sys-51b5e864f7e6ff7e.rlib"
"/../librustc_demangle-03e1b6fb00a62211.rlib"
"/../libunwind-b614fe992130d55d.rlib"
"/../libcfg_if-3c8c4d01b137f5ec.rlib"
"/../liblibc-ff6dd83aac5b5d3e.rlib"
"/../liballoc-46279441278e45f1.rlib"
"/../librustc_std_workspace_core-ad9ca0851ac0bbb2.rlib"
"/../libcore-b778ac4b32b54389.rlib"
"-Wl,--end-group"
"/../libcompiler_builtins-628ce6e3cec04e19.rlib"
...

I reproduced the issue without build-std and added a test case, it should be
easier to follow compared to what is going on in the build-std case.

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Feb 28, 2020

Oh sorry I'm getting mixed up in directions. deps is a topologically sorted list with core last, so deps.rev() visits core first. So yes, alloc is indeed visited first.

Also thanks for the test! I'll try to poke around with that a bit locally. Hopefully one last question, though, why does std require a personality sometimes but not always? I'm not sure what's affecting that and why it's specifically an issue with build-std but not for precompiled binaries.

@tmiasko

This comment has been minimized.

Copy link
Author

tmiasko commented Feb 28, 2020

The language item is considered missing in a crate if it is used but not
provided by the crate or dependencies.

In the build-std case, the std is built only as rlib, the panic_unwind crate
dependency is not injected into it, and std ends up not depending on it. The
end result is that the EhPersonalityLangItem is considered missing from std.

Without build-std, the std does depend on panic_unwind and has no missing lang items.

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 29, 2020

☔️ The latest upstream changes (presumably #69570) made this pull request unmergeable. Please resolve the merge conflicts.

@tmiasko tmiasko force-pushed the tmiasko:weak-lang-cycle branch from 6ae0ae3 to 9039320 Feb 29, 2020
@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Mar 2, 2020

@bors: r+

Ah right yes because we enable features as part of rustbuild which aren't enabled in build-std, thanks for the info!

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 2, 2020

📌 Commit 9039320 has been approved by alexcrichton

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 3, 2020

⌛️ Testing commit 9039320 with merge f7cf915...

bors added a commit that referenced this pull request Mar 3, 2020
Improve linking of crates with circular dependencies

Previously, the code responsible for handling the cycles between crates
introduces through weak lang items, would keep a set of missing language
items:

* extending it with items missing from the current crate,
* removing items provided by the current crate,
* grouping the crates when the set changed from non-empty back to empty.

This could produce incorrect results, if a lang item was missing from a
crate that comes after the crate that provides it (in the loop iteration
order). In that case the grouping would not take place.

The changes here address this specific failure scenario by keeping track
of two separate sets of crates. Those that are required to link successfully,
and those that are available for linking.

Verified using test case from #69368.
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 3, 2020

💔 Test failed - checks-azure

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Mar 3, 2020

The job x86_64-mingw-1 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2020-03-03T10:17:33.8662537Z status: exit code: 2
2020-03-03T10:17:33.8662908Z command: "make"
2020-03-03T10:17:33.8663113Z stdout:
2020-03-03T10:17:33.8663315Z ------------------------------------------
2020-03-03T10:17:33.8663720Z make[1]: Entering directory '/d/a/1/s/src/test/run-make-fulldeps/issue-69368'
2020-03-03T10:17:33.8669522Z PATH="/d/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368:D:\a\1\s\build\x86_64-pc-windows-gnu\stage2\bin:/d/a/1/s/build/x86_64-pc-windows-gnu/stage0-bootstrap-tools/x86_64-pc-windows-gnu/release/deps:/d/a/1/s/build/x86_64-pc-windows-gnu/stage0/bin:/d/a/1/s/ninja:/d/a/1/s/mingw64/bin:/c/Python27amd64:/usr/bin:/c/Program Files (x86)/Inno Setup 5:/d/a/1/s/sccache:/c/agents/2.165.0/externals/git/cmd:/c/hostedtoolcache/windows/Python/3.6.8/x64:/c/hostedtoolcache/windows/Python/3.6.8/x64/Scripts:/c/Program Files/Mercurial:/c/ProgramData/kind:/c/vcpkg:/c/cf-cli:/c/Program Files (x86)/NSIS:/c/Program Files/Mercurial:/c/hostedtoolcache/windows/Boost/1.69.0:/c/Program Files/dotnet:/c/mysql-5.7.21-winx64/bin:/c/Program Files/Java/zulu-8-azure-jdk_8.40.0.25-8.0.222-win_x64/bin:/c/SeleniumWebDrivers/GeckoDriver:/c/Program Files (x86)/sbt/bin:/c/Rust/.cargo/bin:/c/hostedtoolcache/windows/Ruby/2.5.7/x64/bin:/c/Go1.12.7/bin:/c/Program Files/Git/bin:/c/Program Files/Git/usr/bin:/c/hostedtoolcache/windows/Python/3.6.8/x64/Scripts:/c/hostedtoolcache/windows/Python/3.6.8/x64:/c/npm/prefix:/c/Program Files (x86)/Microsoft SDKs/Azure/CLI2/wbin:/c/Program Files/Microsoft MPI/Bin:/c/windows/system32:/c/windows:/c/windows/System32/Wbem:/c/windows/System32/WindowsPowerShell/v1.0:/c/ProgramData/Chocolatey/bin:/c/Program Files/Docker:/c/Program Files/PowerShell/6:/c/Program Files/dotnet:/c/Program Files/Microsoft SQL Server/130/Tools/Binn:/c/Program Files (x86)/Microsoft SQL Server/110/DTS/Binn:/c/Program Files (x86)/Microsoft SQL Server/120/DTS/Binn:/c/Program Files (x86)/Microsoft SQL Server/130/DTS/Binn:/c/Program Files (x86)/Microsoft SQL Server/140/DTS/Binn:/c/Program Files (x86)/Microsoft SQL Server/150/DTS/Binn:/c/Program Files (x86)/Windows Kits/10/Windows Performance Toolkit:/c/Program Files/Microsoft Service Fabric/bin/Fabric/Fabric.Code:/c/Program Files/Microsoft SDKs/Service Fabric/Tools/ServiceFabricLocalClusterManager:/c/Program Files/nodejs:/c/Program Files/Git/cmd:/c/Program Files/Git/mingw64/bin:/c/Program Files/Git/usr/bin:/c/tools/php:/c/Program Files (x86)/sbt/bin:/c/Program Files (x86)/Subversion/bin:/c/SeleniumWebDrivers/ChromeDriver:/c/SeleniumWebDrivers/EdgeDriver:/c/ProgramData/chocolatey/lib/maven/apache-maven-3.6.3/bin:/c/Program Files/CMake/bin:/c/Strawberry/c/bin:/c/Strawberry/perl/site/bin:/c/Strawberry/perl/bin:/c/Program Files/OpenSSL/bin:/c/Users/VssAdministrator/.dotnet/tools:/c/Pro" 'D:\a\1\s\build\x86_64-pc-windows-gnu\stage2\bin\rustc.exe' --out-dir /d/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368 -L /d/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368  a.rs
2020-03-03T10:17:33.8680715Z PATH="/d/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368:D:\a\1\s\build\x86_64-pc-windows-gnu\stage2\bin:/d/a/1/s/build/x86_64-pc-windows-gnu/stage0-bootstrap-tools/x86_64-pc-windows-gnu/release/deps:/d/a/1/s/build/x86_64-pc-windows-gnu/stage0/bin:/d/a/1/s/ninja:/d/a/1/s/mingw64/bin:/c/Python27amd64:/usr/bin:/c/Program Files (x86)/Inno Setup 5:/d/a/1/s/sccache:/c/agents/2.165.0/externals/git/cmd:/c/hostedtoolcache/windows/Python/3.6.8/x64:/c/hostedtoolcache/windows/Python/3.6.8/x64/Scripts:/c/Program Files/Mercurial:/c/ProgramData/kind:/c/vcpkg:/c/cf-cli:/c/Program Files (x86)/NSIS:/c/Program Files/Mercurial:/c/hostedtoolcache/windows/Boost/1.69.0:/c/Program Files/dotnet:/c/mysql-5.7.21-winx64/bin:/c/Program Files/Java/zulu-8-azure-jdk_8.40.0.25-8.0.222-win_x64/bin:/c/SeleniumWebDrivers/GeckoDriver:/c/Program Files (x86)/sbt/bin:/c/Rust/.cargo/bin:/c/hostedtoolcache/windows/Ruby/2.5.7/x64/bin:/c/Go1.12.7/bin:/c/Program Files/Git/bin:/c/Program Files/Git/usr/bin:/c/hostedtoolcache/windows/Python/3.6.8/x64/Scripts:/c/hostedtoolcache/windows/Python/3.6.8/x64:/c/npm/prefix:/c/Program Files (x86)/Microsoft SDKs/Azure/CLI2/wbin:/c/Program Files/Microsoft MPI/Bin:/c/windows/system32:/c/windows:/c/windows/System32/Wbem:/c/windows/System32/WindowsPowerShell/v1.0:/c/ProgramData/Chocolatey/bin:/c/Program Files/Docker:/c/Program Files/PowerShell/6:/c/Program Files/dotnet:/c/Program Files/Microsoft SQL Server/130/Tools/Binn:/c/Program Files (x86)/Microsoft SQL Server/110/DTS/Binn:/c/Program Files (x86)/Microsoft SQL Server/120/DTS/Binn:/c/Program Files (x86)/Microsoft SQL Server/130/DTS/Binn:/c/Program Files (x86)/Microsoft SQL Server/140/DTS/Binn:/c/Program Files (x86)/Microsoft SQL Server/150/DTS/Binn:/c/Program Files (x86)/Windows Kits/10/Windows Performance Toolkit:/c/Program Files/Microsoft Service Fabric/bin/Fabric/Fabric.Code:/c/Program Files/Microsoft SDKs/Service Fabric/Tools/ServiceFabricLocalClusterManager:/c/Program Files/nodejs:/c/Program Files/Git/cmd:/c/Program Files/Git/mingw64/bin:/c/Program Files/Git/usr/bin:/c/tools/php:/c/Program Files (x86)/sbt/bin:/c/Program Files (x86)/Subversion/bin:/c/SeleniumWebDrivers/ChromeDriver:/c/SeleniumWebDrivers/EdgeDriver:/c/ProgramData/chocolatey/lib/maven/apache-maven-3.6.3/bin:/c/Program Files/CMake/bin:/c/Strawberry/c/bin:/c/Strawberry/perl/site/bin:/c/Strawberry/perl/bin:/c/Program Files/OpenSSL/bin:/c/Users/VssAdministrator/.dotnet/tools:/c/Pro" 'D:\a\1\s\build\x86_64-pc-windows-gnu\stage2\bin\rustc.exe' --out-dir /d/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368 -L /d/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368  b.rs
2020-03-03T10:17:33.8692845Z PATH="/d/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368:D:\a\1\s\build\x86_64-pc-windows-gnu\stage2\bin:/d/a/1/s/build/x86_64-pc-windows-gnu/stage0-bootstrap-tools/x86_64-pc-windows-gnu/release/deps:/d/a/1/s/build/x86_64-pc-windows-gnu/stage0/bin:/d/a/1/s/ninja:/d/a/1/s/mingw64/bin:/c/Python27amd64:/usr/bin:/c/Program Files (x86)/Inno Setup 5:/d/a/1/s/sccache:/c/agents/2.165.0/externals/git/cmd:/c/hostedtoolcache/windows/Python/3.6.8/x64:/c/hostedtoolcache/windows/Python/3.6.8/x64/Scripts:/c/Program Files/Mercurial:/c/ProgramData/kind:/c/vcpkg:/c/cf-cli:/c/Program Files (x86)/NSIS:/c/Program Files/Mercurial:/c/hostedtoolcache/windows/Boost/1.69.0:/c/Program Files/dotnet:/c/mysql-5.7.21-winx64/bin:/c/Program Files/Java/zulu-8-azure-jdk_8.40.0.25-8.0.222-win_x64/bin:/c/SeleniumWebDrivers/GeckoDriver:/c/Program Files (x86)/sbt/bin:/c/Rust/.cargo/bin:/c/hostedtoolcache/windows/Ruby/2.5.7/x64/bin:/c/Go1.12.7/bin:/c/Program Files/Git/bin:/c/Program Files/Git/usr/bin:/c/hostedtoolcache/windows/Python/3.6.8/x64/Scripts:/c/hostedtoolcache/windows/Python/3.6.8/x64:/c/npm/prefix:/c/Program Files (x86)/Microsoft SDKs/Azure/CLI2/wbin:/c/Program Files/Microsoft MPI/Bin:/c/windows/system32:/c/windows:/c/windows/System32/Wbem:/c/windows/System32/WindowsPowerShell/v1.0:/c/ProgramData/Chocolatey/bin:/c/Program Files/Docker:/c/Program Files/PowerShell/6:/c/Program Files/dotnet:/c/Program Files/Microsoft SQL Server/130/Tools/Binn:/c/Program Files (x86)/Microsoft SQL Server/110/DTS/Binn:/c/Program Files (x86)/Microsoft SQL Server/120/DTS/Binn:/c/Program Files (x86)/Microsoft SQL Server/130/DTS/Binn:/c/Program Files (x86)/Microsoft SQL Server/140/DTS/Binn:/c/Program Files (x86)/Microsoft SQL Server/150/DTS/Binn:/c/Program Files (x86)/Windows Kits/10/Windows Performance Toolkit:/c/Program Files/Microsoft Service Fabric/bin/Fabric/Fabric.Code:/c/Program Files/Microsoft SDKs/Service Fabric/Tools/ServiceFabricLocalClusterManager:/c/Program Files/nodejs:/c/Program Files/Git/cmd:/c/Program Files/Git/mingw64/bin:/c/Program Files/Git/usr/bin:/c/tools/php:/c/Program Files (x86)/sbt/bin:/c/Program Files (x86)/Subversion/bin:/c/SeleniumWebDrivers/ChromeDriver:/c/SeleniumWebDrivers/EdgeDriver:/c/ProgramData/chocolatey/lib/maven/apache-maven-3.6.3/bin:/c/Program Files/CMake/bin:/c/Strawberry/c/bin:/c/Strawberry/perl/site/bin:/c/Strawberry/perl/bin:/c/Program Files/OpenSSL/bin:/c/Users/VssAdministrator/.dotnet/tools:/c/Pro" 'D:\a\1\s\build\x86_64-pc-windows-gnu\stage2\bin\rustc.exe' --out-dir /d/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368 -L /d/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368  c.rs
2020-03-03T10:17:33.8698261Z make[1]: Leaving directory '/d/a/1/s/src/test/run-make-fulldeps/issue-69368'
2020-03-03T10:17:33.8698723Z ------------------------------------------
2020-03-03T10:17:33.8698971Z stderr:
2020-03-03T10:17:33.8699172Z ------------------------------------------
2020-03-03T10:17:33.8699172Z ------------------------------------------
2020-03-03T10:17:33.8699548Z error: linking with `x86_64-w64-mingw32-gcc` failed: exit code: 1
2020-03-03T10:17:33.8699814Z   |
2020-03-03T10:17:33.8708797Z   = note: "x86_64-w64-mingw32-gcc" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-nostdlib" "-m64" "D:\\a\\1\\s\\mingw64\\x86_64-w64-mingw32\\lib\\crt2.o" "C:\\MORE_SPACE\\x86_64-pc-windows-gnu\\stage2\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsbegin.o" "-L" "D:\\a\\1\\s\\mingw64\\x86_64-w64-mingw32\\lib" "-L" "C:\\MORE_SPACE\\x86_64-pc-windows-gnu\\stage2\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "D:/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368\\c.c.7rcbfp3g-cgu.0.rcgu.o" "D:/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368\\c.c.7rcbfp3g-cgu.1.rcgu.o" "D:/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368\\c.c.7rcbfp3g-cgu.10.rcgu.o" "D:/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368\\c.c.7rcbfp3g-cgu.11.rcgu.o" "D:/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368\\c.c.7rcbfp3g-cgu.12.rcgu.o" "D:/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368\\c.c.7rcbfp3g-cgu.13.rcgu.o" "D:/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368\\c.c.7rcbfp3g-cgu.14.rcgu.o" "D:/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368\\c.c.7rcbfp3g-cgu.15.rcgu.o" "D:/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368\\c.c.7rcbfp3g-cgu.2.rcgu.o" "D:/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368\\c.c.7rcbfp3g-cgu.3.rcgu.o" "D:/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368\\c.c.7rcbfp3g-cgu.4.rcgu.o" "D:/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368\\c.c.7rcbfp3g-cgu.5.rcgu.o" "D:/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368\\c.c.7rcbfp3g-cgu.6.rcgu.o" "D:/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368\\c.c.7rcbfp3g-cgu.7.rcgu.o" "D:/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368\\c.c.7rcbfp3g-cgu.8.rcgu.o" "D:/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368\\c.c.7rcbfp3g-cgu.9.rcgu.o" "-o" "D:/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368\\c.exe" "D:/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368\\c.2rnwddj6nqg1m891.rcgu.o" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "D:/a/1/s/build/x86_64-pc-windows-gnu/test/run-make-fulldeps/issue-69368/issue-69368" "-L" "C:\\MORE_SPACE\\x86_64-pc-windows-gnu\\stage2\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-Wl,--start-group" "-Wl,-Bstatic" "C:\\MORE_SPACE\\x86_64-pc-windows-gnu\\test\\run-make-fulldeps\\issue-69368\\issue-69368\\libb.rlib" "C:\\MORE_SPACE\\x86_64-pc-windows-gnu\\test\\run-make-fulldeps\\issue-69368\\issue-69368\\liba.rlib" "C:\\MORE_SPACE\\x86_64-pc-windows-gnu\\stage2\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libpanic_unwind-0af2c64707962318.rlib" "C:\\MORE_SPACE\\x86_64-pc-windows-gnu\\stage2\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libunwind-3a9c2fab68e4e451.rlib" "C:\\MORE_SPACE\\x86_64-pc-windows-gnu\\stage2\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liblibc-2d99f3c4d36f09eb.rlib" "C:\\MORE_SPACE\\x86_64-pc-windows-gnu\\stage2\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcfg_if-21cbecbf62ecfa40.rlib" "C:\\MORE_SPACE\\x86_64-pc-windows-gnu\\stage2\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc-a8e7c27b48ec440f.rlib" "C:\\MORE_SPACE\\x86_64-pc-windows-gnu\\stage2\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_std_workspace_core-a881be1555713dc0.rlib" "C:\\MORE_SPACE\\x86_64-pc-windows-gnu\\stage2\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcore-e0dc74dee73be782.rlib" "-Wl,--end-group" "C:\\MORE_SPACE\\x86_64-pc-windows-gnu\\stage2\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcompiler_builtins-80ad65c7206cf3e2.rlib" "-lgcc_eh" "-lpthread" "-Wl,-Bdynamic" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-lmsvcrt" "-luser32" "-lkernel32" "C:\\MORE_SPACE\\x86_64-pc-windows-gnu\\stage2\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsend.o"
2020-03-03T10:17:33.8718412Z   = note: C:\MORE_SPACE\x86_64-pc-windows-gnu\stage2\lib\rustlib\x86_64-pc-windows-gnu\lib\libpanic_unwind-0af2c64707962318.rlib(panic_unwind-0af2c64707962318.panic_unwind.27hgvect-cgu.0.rcgu.o):panic_unwind.27hgv:(.text+0x3d4): undefined reference to `__rust_drop_panic'
2020-03-03T10:17:33.8719426Z           collect2.exe: error: ld returned 1 exit status
2020-03-03T10:17:33.8719813Z 
2020-03-03T10:17:33.8720018Z error: aborting due to previous error
2020-03-03T10:17:33.8720181Z 
2020-03-03T10:17:33.8720181Z 
2020-03-03T10:17:33.8720380Z make[1]: *** [Makefile:18: all] Error 1
2020-03-03T10:17:33.8720767Z ------------------------------------------
2020-03-03T10:17:33.8720955Z 
2020-03-03T10:17:33.8721050Z 
2020-03-03T10:17:33.8721143Z 
---
2020-03-03T10:17:33.8722606Z thread 'main' panicked at 'Some tests failed', src\tools\compiletest\src\main.rs:348:22
2020-03-03T10:17:33.8723073Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2020-03-03T10:17:33.8723364Z 
2020-03-03T10:17:33.8723460Z 
2020-03-03T10:17:33.8731617Z command did not execute successfully: "D:\\a\\1\\s\\build\\x86_64-pc-windows-gnu\\stage0-tools-bin\\compiletest.exe" "--compile-lib-path" "D:\\a\\1\\s\\build\\x86_64-pc-windows-gnu\\stage2\\bin" "--run-lib-path" "D:\\a\\1\\s\\build\\x86_64-pc-windows-gnu\\stage2\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "--rustc-path" "D:\\a\\1\\s\\build\\x86_64-pc-windows-gnu\\stage2\\bin\\rustc.exe" "--rustdoc-path" "D:\\a\\1\\s\\build\\x86_64-pc-windows-gnu\\stage2\\bin\\rustdoc.exe" "--src-base" "D:\\a\\1\\s\\src/test\\run-make-fulldeps" "--build-base" "D:\\a\\1\\s\\build\\x86_64-pc-windows-gnu\\test\\run-make-fulldeps" "--stage-id" "stage2-x86_64-pc-windows-gnu" "--mode" "run-make" "--target" "x86_64-pc-windows-gnu" "--host" "x86_64-pc-windows-gnu" "--llvm-filecheck" "D:\\a\\1\\s\\build\\x86_64-pc-windows-gnu\\llvm\\build\\bin\\FileCheck.exe" "--nodejs" "C:\\Program Files\\nodejs\\node" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=D:\\a\\1\\s\\build\\x86_64-pc-windows-gnu\\native\\rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=D:\\a\\1\\s\\build\\x86_64-pc-windows-gnu\\native\\rust-test-helpers" "--docck-python" "C:\\Python27amd64\\python2.7" "--lldb-python" "C:\\Python27amd64\\python2.7" "--gdb" "D:\\a\\1\\s\\mingw64\\bin\\gdb" "--llvm-version" "9.0.1-rust-1.43.0-nightly\n" "--cc" "gcc.exe" "--cxx" "g++.exe" "--cflags" "-ffunction-sections -fdata-sections -m64" "--llvm-components" "aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter binaryformat bitreader bitstreamreader bitwriter codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver engine executionengine fuzzmutate globalisel gtest gtest_main hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader jitlink libdriver lineeditor linker lto mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcjit passes powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo riscvutils runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target testingsupport textapi transformutils vectorize webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86utils xray" "--ar" "ar" "--llvm-bin-dir" "D:\\a\\1\\s\\build\\x86_64-pc-windows-gnu\\llvm\\build\\bin" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
2020-03-03T10:17:33.8739531Z 
2020-03-03T10:17:33.8739629Z 
2020-03-03T10:17:33.9455683Z failed to run: D:\a\1\s\build\bootstrap\debug\bootstrap test --exclude src/test/ui --exclude src/test/compile-fail
2020-03-03T10:17:33.9456117Z Build completed unsuccessfully in 2:24:39
2020-03-03T10:17:33.9456117Z Build completed unsuccessfully in 2:24:39
2020-03-03T10:17:33.9901921Z make: *** [Makefile:89: ci-mingw-subset-1] Error 1
2020-03-03T10:17:34.0613606Z   local time: Tue Mar  3 10:17:34 CUT 2020
2020-03-03T10:17:34.4255021Z   network time: Tue, 03 Mar 2020 10:17:34 GMT
2020-03-03T10:17:34.4269321Z == end clock drift check ==
2020-03-03T10:17:34.5058734Z 
2020-03-03T10:17:34.5058734Z 
2020-03-03T10:17:34.8295671Z ##[error]Bash exited with code '2'.
2020-03-03T10:17:34.9059705Z ##[section]Starting: Checkout rust-lang/rust@auto to s
2020-03-03T10:17:34.9976747Z ==============================================================================
2020-03-03T10:17:34.9977154Z Task         : Get sources
2020-03-03T10:17:34.9977527Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

Tomasz Miąsko added 2 commits Feb 22, 2020
Previously, the code responsible for handling the cycles between crates
introduces through weak lang items, would keep a set of missing language
items:

* extending it with items missing from the current crate,
* removing items provided by the current crate,
* grouping the crates when the set changed from non-empty back to empty.

This could produce incorrect results, if a lang item was missing from a
crate that comes after the crate that provides it (in the loop iteration
order). In that case the grouping would not take place.

The changes here address this specific failure scenario by keeping track
of two separate sets of crates. Those that are required to link successfully,
and those that are available for linking.

Verified using test case from 69368.
@tmiasko tmiasko force-pushed the tmiasko:weak-lang-cycle branch 2 times, most recently from 5858dd6 to 44dba79 Mar 3, 2020
@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Mar 3, 2020

@bors: r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 3, 2020

📌 Commit 44dba79 has been approved by alexcrichton

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 3, 2020

⌛️ Testing commit 44dba79 with merge 3c5b1b7...

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 3, 2020

☀️ Test successful - checks-azure
Approved by: alexcrichton
Pushing 3c5b1b7 to master...

@bors bors added the merged-by-bors label Mar 3, 2020
@bors bors merged commit 3c5b1b7 into rust-lang:master Mar 3, 2020
5 checks passed
5 checks passed
homu Test successful
Details
pr Build #20200303.35 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-7) Linux x86_64-gnu-llvm-7 succeeded
Details
pr (Linux x86_64-gnu-tools) Linux x86_64-gnu-tools succeeded
Details
@tmiasko tmiasko deleted the tmiasko:weak-lang-cycle branch Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.