-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
bootstrap: Link LLVM as a dylib with ThinLTO (take 2) #57286
Conversation
When building a distributed compiler on Linux where we use ThinLTO to create the LLVM shared object this commit switches the compiler to dynamically linking that LLVM artifact instead of statically linking to LLVM. The primary goal here is to reduce CI compile times, avoiding two+ ThinLTO builds of all of LLVM. By linking dynamically to LLVM we'll reuse the one ThinLTO step done by LLVM's build itself. Lots of discussion about this change can be found [here] and down. A perf run will show whether this is worth it or not! [here]: rust-lang#53245 (comment)
It's only meant for rustc, so we should only install it once!
(rust_highfive has picked a reviewer for you, use r? to override) |
@bors r+ |
📌 Commit 71fed3a has been approved by |
…atsakis bootstrap: Link LLVM as a dylib with ThinLTO (take 2) When building a distributed compiler on Linux where we use ThinLTO to create the LLVM shared object this commit switches the compiler to dynamically linking that LLVM artifact instead of statically linking to LLVM. The primary goal here is to reduce CI compile times, avoiding two+ ThinLTO builds of all of LLVM. By linking dynamically to LLVM we'll reuse the one ThinLTO step done by LLVM's build itself. Lots of discussion about this change can be found [here] and down. A perf run will show whether this is worth it or not! [here]: rust-lang#53245 (comment) --- This PR previously landed in rust-lang#56944, caused rust-lang#57111, and was reverted in rust-lang#57116. I've added one more commit here which should fix the breakage that we saw.
bootstrap: Link LLVM as a dylib with ThinLTO (take 2) When building a distributed compiler on Linux where we use ThinLTO to create the LLVM shared object this commit switches the compiler to dynamically linking that LLVM artifact instead of statically linking to LLVM. The primary goal here is to reduce CI compile times, avoiding two+ ThinLTO builds of all of LLVM. By linking dynamically to LLVM we'll reuse the one ThinLTO step done by LLVM's build itself. Lots of discussion about this change can be found [here] and down. A perf run will show whether this is worth it or not! [here]: #53245 (comment) --- This PR previously landed in #56944, caused #57111, and was reverted in #57116. I've added one more commit here which should fix the breakage that we saw.
☀️ Test successful - status-appveyor, status-travis |
This commit is intended on fixing a regression from rust-lang#57286 where the distributed LLVM shared library unfortunately depends on a dynamic copy of libstdc++, meaning we're no longer as binary compatible as we thought! This tweaks the build of LLVM as out distribution is slightly different now, and is hoped to fix the issue. Closes rust-lang#57426
Build LLVM with -static-libstdc++ on dist builds This commit is intended on fixing a regression from #57286 where the distributed LLVM shared library unfortunately depends on a dynamic copy of libstdc++, meaning we're no longer as binary compatible as we thought! This tweaks the build of LLVM as out distribution is slightly different now, and is hoped to fix the issue. Closes #57426
This commit is intended on fixing a regression from rust-lang#57286 where the distributed LLVM shared library unfortunately depends on a dynamic copy of libstdc++, meaning we're no longer as binary compatible as we thought! This tweaks the build of LLVM as out distribution is slightly different now, and is hoped to fix the issue. Closes rust-lang#57426
This commit is intended on fixing a regression from rust-lang#57286 where the distributed LLVM shared library unfortunately depends on a dynamic copy of libstdc++, meaning we're no longer as binary compatible as we thought! This tweaks the build of LLVM as out distribution is slightly different now, and is hoped to fix the issue. Closes rust-lang#57426
Build LLVM with -static-libstdc++ on dist builds This commit is intended on fixing a regression from #57286 where the distributed LLVM shared library unfortunately depends on a dynamic copy of libstdc++, meaning we're no longer as binary compatible as we thought! This tweaks the build of LLVM as out distribution is slightly different now, and is hoped to fix the issue. Closes #57426
@alexcrichton was there ever a perf run to see the impact on compiler performance? I ask because we've seen as much as a 10-20% improvement from linking LLVM statically to clang. (cc @petrhosek) I expect that something that large would have been noticed in the release perf run, but maybe there is a potential win here (at least, for someone who wants to build their own toolchain). |
Would it be possible to provide an option to statically link LLVM even when using ThinLTO? I understand that you may not want to do this because of your CI resource constraints, but in our case it's something we would always want to use since CI resources aren't a problem. |
@tmandry hm this is long enough ago I don't quite remember, but might be good to check and see! The main motivation for this was CI time though, since statically linking LLVM to rustc means running all of LLVM through ThinLTO twice, once for it's own dylib and once for rustc, which can be extremely expensive on CI. @petrhosek yeah definitely, we should definitely support this! We may already given various matrices of configuration options, but if not a PR to add one sounds great. |
When building a distributed compiler on Linux where we use ThinLTO to
create the LLVM shared object this commit switches the compiler to
dynamically linking that LLVM artifact instead of statically linking to
LLVM. The primary goal here is to reduce CI compile times, avoiding two+
ThinLTO builds of all of LLVM. By linking dynamically to LLVM we'll
reuse the one ThinLTO step done by LLVM's build itself.
Lots of discussion about this change can be found here and down. A
perf run will show whether this is worth it or not!
This PR previously landed in #56944, caused #57111, and was reverted in #57116. I've added one more commit here which should fix the breakage that we saw.