Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 834919

Summary: dev-lang/rust-1.59.0: unknown directive error on RISC-V
Product: Gentoo Linux Reporter: Yixun Lan <dlan>
Component: Current packagesAssignee: Gentoo Rust Project <rust>
Status: RESOLVED UPSTREAM    
Severity: normal CC: gyakovlev, herrtimson, riscv
Priority: Normal    
Version: unspecified   
Hardware: riscv   
OS: Linux   
URL: https://github.com/rust-lang/stdarch/issues/1291
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: full build log

Description Yixun Lan archtester gentoo-dev 2022-03-10 14:23:57 UTC
   |
62 - pub(crate) struct IterMut<'a, T: 'a, C: cfg::Config + 'a>(slice::IterMut<'a, Ptr<T, C>>);
62 + pub(crate) struct IterMut<'a, T, C: cfg::Config>(slice::IterMut<'a, Ptr<T, C>>);
   |

error: unknown directive
   |
note: instantiated into assembly here
  --> <inline asm>:1:2
   |
1  |     .insn i 0x0F, 0, x0, x0, 0x010
   |     ^
Comment 1 Yixun Lan archtester gentoo-dev 2022-03-10 14:25:36 UTC
Created attachment 766743 [details]
full build log
Comment 2 Alex Fan archtester 2022-03-14 10:29:51 UTC
It is an issue with llvm MC support of .insn directive that is only included in llvm-14 (https://reviews.llvm.org/D108602?id=369214). Although the llvm version shipped with rust-1.59 has backported the .insn patch, the bootstrap rust compiler also needs to be compiled with llvm supporting .insn because std library in stage0 (specifically stdarch) uses .insn.

Upstream accepts fixes that use .word instead of .insn as a temporal workaround, but I asked people who opened the issue linked, it seems to be going to take some time. And once upgraded to llvm 14, upstream will eventually use .insn

So I guess a better solution is patch llvm with .insn support () until llvm-14 becomes stable in gentoo.

I applied the patch to portage llvm locally and compiles rust-1.58 with USE=system-llvm as a bootstrap compiler. Then with the bootstrap compiler, I compile rust-1.59 with USE=system-llvm,system-bootstrap successfully.
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-03-14 10:36:14 UTC
Am I missing why we can't just mask USE=system-llvm on riscv for now?
Comment 4 Alex Fan archtester 2022-03-14 10:43:16 UTC
(In reply to Sam James from comment #3)
> Am I missing why we can't just mask USE=system-llvm on riscv for now?

Yeah, it should work once the bootstrap compiler is compiled with llvm supporting .insn, but atm, it seems the one they provide doesn't(otherwise, this bug won't exist).
Comment 5 Alex Fan archtester 2022-03-14 10:46:49 UTC
>>otherwise, this bug won't exist

sorry, won't be discovered so quickly because by default USE=system-llvm and system-boostrap are disabled.
Comment 6 Yixun Lan archtester gentoo-dev 2022-04-12 06:00:19 UTC
tested, the problem is fixed in version 1.60.0

I'm closing this as wontfix