rustc_llvm: Emit module summaries when using -Clto=fat#159029
Conversation
|
r? @cuviper rustbot has assigned @cuviper. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
cc @ilovepi |
141d64a to
10ed1e0
Compare
This comment has been minimized.
This comment has been minimized.
10ed1e0 to
25ec857
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
25ec857 to
162ba1c
Compare
|
@rustbot ready |
162ba1c to
dbe5531
Compare
|
@rustbot ready |
This comment has been minimized.
This comment has been minimized.
Currently, module summaries are only emitted with thin lto. If we would link full/fat lto'd rust code against lto'd c++ code built with CFI (or WPD), those passes would fail during the link step because the participating rust modules are missing module summaries. Rust code does not know at compile-time if it would be participating in some special link which may require module summaries, so this PR ensures module summaries are unconditionally emitted for full/fat lto, just like with thin lto. The WriteBitcodeToFile function just invokes the normal BitcodeWriterPass under the hood, but doesn't provide a way to set the argument for emitting module summaries. So this patch just adds the pass directly and sets that argument. Finally, now that we're generating module summaries for `-Clto=fat` without using ThinLTO, we need to update `rustc-metadata` to keep around a temporary directory that contains the `.rmeta` for a little longer before we deserialize it.
dbe5531 to
fe44964
Compare
|
@bjorn3 - I think I did a force push and lost a comment from you. Does the latest version still have the concern you mentioned? |
|
I assume they deleted their own comment, but do speak up if that's still relevant. Otherwise, it looks good to me! @bors r+ |
|
I don't fully remember what my comment was, but I did indeed delete it when I realized I was thinking wrong. I don't have any objections to this PR. |
…iper rustc_llvm: Emit module summaries when using -Clto=fat Currently, module summaries are only emitted with thin lto. If we would link full/fat lto'd rust code against lto'd c++ code built with CFI (or WPD), those passes would fail during the link step because the participating rust modules are missing module summaries. Rust code does not know at compile-time if it would be participating in some special link which may require module summaries, so this PR ensures module summaries are unconditionally emitted for full/fat lto, just like with thin lto. The WriteBitcodeToFile function just invokes the normal BitcodeWriterPass under the hood, but doesn't provide a way to set the argument for emitting module summaries. So this patch just adds the pass directly and sets that argument. This is a rebase of @PiJoules's rust-lang#158099, which also should fix up the tests with the gcc tools.
…iper rustc_llvm: Emit module summaries when using -Clto=fat Currently, module summaries are only emitted with thin lto. If we would link full/fat lto'd rust code against lto'd c++ code built with CFI (or WPD), those passes would fail during the link step because the participating rust modules are missing module summaries. Rust code does not know at compile-time if it would be participating in some special link which may require module summaries, so this PR ensures module summaries are unconditionally emitted for full/fat lto, just like with thin lto. The WriteBitcodeToFile function just invokes the normal BitcodeWriterPass under the hood, but doesn't provide a way to set the argument for emitting module summaries. So this patch just adds the pass directly and sets that argument. This is a rebase of @PiJoules's rust-lang#158099, which also should fix up the tests with the gcc tools.
|
|
This pull request was unapproved. This PR was contained in a rollup (#159803), which was unapproved. |
Currently, module summaries are only emitted with thin lto. If we would link full/fat lto'd rust code against lto'd c++ code built with CFI (or WPD), those passes would fail during the link step because the participating rust modules are missing module summaries. Rust code does not know at compile-time if it would be participating in some special link which may require module summaries, so this PR ensures module summaries are unconditionally emitted for full/fat lto, just like with thin lto.
The WriteBitcodeToFile function just invokes the normal BitcodeWriterPass under the hood, but doesn't provide a way to set the argument for emitting module summaries. So this patch just adds the pass directly and sets that argument.
This is a rebase of @PiJoules's #158099, which also should fix up the tests with the gcc tools.