Send -fno-lto when linker plugin LTO is not requested to avoid having GCC do LTO when using rustc_codegen_gcc - #159924
Send -fno-lto when linker plugin LTO is not requested to avoid having GCC do LTO when using rustc_codegen_gcc#159924antoyo wants to merge 1 commit into
Conversation
|
r? @fee1-dead rustbot has assigned @fee1-dead. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Thinking about this again, this would cause a compilation failure if there is any C code compiled with |
You mean objects files that are not fat compiled with GCC? |
It should currently work without extra configuration when using Clang as C compiler and either Clang as linker driver or LLD as linker though. |
So, we would need to only emit |
|
r? bjorn3 |
This comment has been minimized.
This comment has been minimized.
…r=Kobzol Make `run-make` testsuite work with other codegen backend than LLVM Needed for rust-lang#159924. Currently, we always run `run-make` testsuite with the codegen backend rustc was compiled with. However, in CI it's compiled with LLVM, so when we want to test with GCC (with `--test-codegen-backend`), it compiles `rmake.rs` with the GCC backend, but when running the test, it doesn't use the GCC backend since it just calls `rustc`. So to get around that, I now pass the codegen backend through the environment and set it in the `rustc` function of `run_make_support`. To be noted that for now it's only for the `rustc` function, no other command uses it. Should I extend it right away for all commands (well, likely only `cargo`) or just `rustc` for now is enough? r? @jieyouxu
…r=Kobzol Make `run-make` testsuite work with other codegen backend than LLVM Needed for rust-lang#159924. Currently, we always run `run-make` testsuite with the codegen backend rustc was compiled with. However, in CI it's compiled with LLVM, so when we want to test with GCC (with `--test-codegen-backend`), it compiles `rmake.rs` with the GCC backend, but when running the test, it doesn't use the GCC backend since it just calls `rustc`. So to get around that, I now pass the codegen backend through the environment and set it in the `rustc` function of `run_make_support`. To be noted that for now it's only for the `rustc` function, no other command uses it. Should I extend it right away for all commands (well, likely only `cargo`) or just `rustc` for now is enough? r? @jieyouxu
…r=Kobzol Make `run-make` testsuite work with other codegen backend than LLVM Needed for rust-lang#159924. Currently, we always run `run-make` testsuite with the codegen backend rustc was compiled with. However, in CI it's compiled with LLVM, so when we want to test with GCC (with `--test-codegen-backend`), it compiles `rmake.rs` with the GCC backend, but when running the test, it doesn't use the GCC backend since it just calls `rustc`. So to get around that, I now pass the codegen backend through the environment and set it in the `rustc` function of `run_make_support`. To be noted that for now it's only for the `rustc` function, no other command uses it. Should I extend it right away for all commands (well, likely only `cargo`) or just `rustc` for now is enough? r? @jieyouxu
Rollup merge of #162482 - GuillaumeGomez:run-make-backends, r=Kobzol Make `run-make` testsuite work with other codegen backend than LLVM Needed for #159924. Currently, we always run `run-make` testsuite with the codegen backend rustc was compiled with. However, in CI it's compiled with LLVM, so when we want to test with GCC (with `--test-codegen-backend`), it compiles `rmake.rs` with the GCC backend, but when running the test, it doesn't use the GCC backend since it just calls `rustc`. So to get around that, I now pass the codegen backend through the environment and set it in the `rustc` function of `run_make_support`. To be noted that for now it's only for the `rustc` function, no other command uses it. Should I extend it right away for all commands (well, likely only `cargo`) or just `rustc` for now is enough? r? @jieyouxu
|
#162482 got merged, so after a rebase, this PR should be ready to go. |
|
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.
… GCC do LTO when using rustc_codegen_gcc
| @@ -1,4 +1,5 @@ | |||
| //@ ignore-cross-compile (need to run fake linker) | |||
| //@ ignore-backends: gcc | |||
There was a problem hiding this comment.
Not sure if there would be a way to make this test "generic" on whether the flag -fno-lto is present or not, but I guess it's not super important anyway.
|
The test now passes. |
More info on this Zulip thread.
cc @bjorn3