While testing LTO on Gentoo without the LTO overlay I've found the filter-flag '-flto*' isn't working with Rust for some reason so package.env is still required to get it to build.
Created attachment 800679 [details] Part of build.log
Created attachment 800681 [details] emerge --info
You don't have USE=system-llvm, right? So that's expected. Please include the full build.log (compressed if needed).
As always you are correct :) I've added a section to Rust Gentoo wiki page so it's easier to find this information as I can't be the only person that missed it. https://wiki.gentoo.org/wiki/Rust#LTO_Users
(In reply to immolo from comment #4) > As always you are correct :) > > I've added a section to Rust Gentoo wiki page so it's easier to find this > information as I can't be the only person that missed it. > > https://wiki.gentoo.org/wiki/Rust#LTO_Users Thanks!
Oh, wait. Are you saying it fails to build with USE=-system-llvm? In that case, we should filter-lto then too?
It does fail with USE="-system-llvm" but filtering out does solve the issue. From the discussion on IRC I thought this was intended however now I know it's not I'll run a test and fire over diff with the confirmed fix.
Created attachment 800905 [details, diff] ebuild.diff This simple fix now allows LTO flags to be filtered on both +/-system-llvm and have I confirmed both build on my system.
(In reply to immolo from comment #1) > Created attachment 800679 [details] > Part of build.log Is the error actually in this? Can you attach the full build.log when it fails without the filter?
Created attachment 800974 [details] Build.log Build.log with USE="-system-llvm" now included, as shown previously filtering -flto=* from the flags allows this to build.
(In reply to immolo from comment #10) > Created attachment 800974 [details] > Build.log > > Build.log with USE="-system-llvm" now included, as shown previously > filtering -flto=* from the flags allows this to build. [01m[K/var/tmp/portage/dev-lang/rust-1.62.1/work/rustc-1.62.1-src/src/llvm-project/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp:595:[m[K [01;31m[Kinternal compiler error: [m[KSegmentation fault 595 | bool RegisterBankInfo::InstructionMapping::verify( | 0xff9d7d internal_error(char const*, ...) ???:0 0x13d76f4 operator_bitwise_not::fold_range(irange&, tree_node*, irange const&, irange const&, tree_code) const ???:0 0x12fb352 fold_using_range::range_of_range_op(irange&, gimple*, fur_source&) ???:0 0x12fa2f4 fold_using_range::fold_stmt(irange&, gimple*, fur_source&, tree_node*) ???:0 0x1330088 path_range_query::range_of_stmt(irange&, gimple*, tree_node*) ???:0 0x132ef0c path_range_query::range_defined_in_block(irange&, tree_node*, basic_block_def*) ???:0 0x132fd86 path_range_query::internal_range_of_expr(irange&, tree_node*, gimple*) ???:0 0x12faeb2 fold_using_range::range_of_range_op(irange&, gimple*, fur_source&) ???:0 0x12fa2f4 fold_using_range::fold_stmt(irange&, gimple*, fur_source&, tree_node*) ???:0 0x1330088 path_range_query::range_of_stmt(irange&, gimple*, tree_node*) ???:0 0x132ef0c path_range_query::range_defined_in_block(irange&, tree_node*, basic_block_def*) ???:0 0x132fd86 path_range_query::internal_range_of_expr(irange&, tree_node*, gimple*) ???:0 0x12faeb2 fold_using_range::range_of_range_op(irange&, gimple*, fur_source&) ???:0 0x12fa2f4 fold_using_range::fold_stmt(irange&, gimple*, fur_source&, tree_node*) ???:0 0x1330088 path_range_query::range_of_stmt(irange&, gimple*, tree_node*) ???:0 0x132ef0c path_range_query::range_defined_in_block(irange&, tree_node*, basic_block_def*) ???:0 0x132fd86 path_range_query::internal_range_of_expr(irange&, tree_node*, gimple*) ???:0 0x12faeb2 fold_using_range::range_of_range_op(irange&, gimple*, fur_source&) ???:0 0x12fa2f4 fold_using_range::fold_stmt(irange&, gimple*, fur_source&, tree_node*) ???:0 0x1330088 path_range_query::range_of_stmt(irange&, gimple*, tree_node*) ???:0 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See <https://bugs.gentoo.org/> for instructions. make: *** [/var/tmp/portage/dev-lang/rust-1.62.1/temp/cc6o5o1I.mk:110: /var/tmp/portage/dev-lang/rust-1.62.1/temp/ccpbak5V.ltrans36.ltrans.o] Error 1 make: *** Waiting for unfinished jobs.... [01m[Klto-wrapper:[m[K [01;31m[Kfatal error: [m[Kmake returned 2 exit status compilation terminated. /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: error: lto-wrapper failed collect2: error: ld returned 1 exit status Is this reproducible? That's a gcc bug if so.
(If it is reproducible, might be https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105663).
Created attachment 801538 [details] GCC 11.3.0 and 10.4.0 build.logs I setup an environment to test from stable and this changes the error from what was seen in GCC-12.2.0. I built from 10.4.0 as from what I can see this is version before the bug you mentioned was introduced, all versions build fine though when LTO is filtered out.
Created attachment 803068 [details] GCC 11.3.0 and 10.4.0 build.logs ansiflitered Reuploaded as requested.
(In reply to immolo from comment #14) > Created attachment 803068 [details] > GCC 11.3.0 and 10.4.0 build.logs ansiflitered > > Reuploaded as requested. 11.3.0: ``` Did not run successfully: signal: 6 rustc exited with signal: 6 error: could not compile `core` Caused by: [...] ------------- rustc: /var/tmp/portage/dev-lang/rust-1.62.1/work/rustc-1.62.1-src/src/llvm-project/llvm/include/llvm/IR/User.h:216: void llvm::User::setNumHungOffUseOperands(unsigned int): Assertion `HasHungOffUses && "Must have hung off uses to use this method"' failed. Did not run successfully: signal: 6 ``` ... and same for 10.4.0. So bundled LLVM is hosed with LTO apparently?
That's what I think from testing is needed, however I don't yet understand why it fails to see if this is an issue I've created or if I need to upstream somewhere. Probably just best to leave it as is and wait for someone else to confirm the bug for now unless you have a better idea I can test.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3d08936b268a0b83d91b2085c8588b6e3cbe88bc commit 3d08936b268a0b83d91b2085c8588b6e3cbe88bc Author: Georgy Yakovlev <gyakovlev@gentoo.org> AuthorDate: 2022-09-25 17:24:43 +0000 Commit: Georgy Yakovlev <gyakovlev@gentoo.org> CommitDate: 2022-09-25 17:25:24 +0000 dev-lang/rust: fix alt-abi support, filter out flto in 1.64.0 Bug: https://bugs.gentoo.org/866231 Closes: https://bugs.gentoo.org/872815 Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org> dev-lang/rust/{rust-1.64.0.ebuild => rust-1.64.0-r1.ebuild} | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
Now successfully build so thanks for adding. Show this be added to all versions to stop papercuts on those running LTO on stable?
Yeah can add to other versions without revbump. But those will go away anyway and pretty soon.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=97bd3a9a25b3ea3c9fdc7beb09a13a7c7b032b36 commit 97bd3a9a25b3ea3c9fdc7beb09a13a7c7b032b36 Author: Georgy Yakovlev <gyakovlev@gentoo.org> AuthorDate: 2022-09-27 20:31:37 +0000 Commit: Georgy Yakovlev <gyakovlev@gentoo.org> CommitDate: 2022-09-27 20:31:57 +0000 dev-lang/rust: filter out flto in all cases Closes: https://bugs.gentoo.org/866231 Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org> dev-lang/rust/rust-1.62.1.ebuild | 2 +- dev-lang/rust/rust-1.63.0-r1.ebuild | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)