[lld] [llvm] [RISCV] Change RISCVABI::computeTargetABI() to return Expected<ABI> (PR #213410)

Sharjeel Khan via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 14 21:15:06 PDT 2026


Sharjeel-Khan wrote:

> > This change over the weekend broke riscv64 Android builds. When compiling for riscv64-linux-android with -flto, any module-level inline assembly causes LTO linking (ld.lld) to fail with: `ld.lld: error: ld-temp.o <inline asm>:1:2: hard-float 'd' ABI can't be used for a target that doesn't support the D instruction set extension`. During LTO code generation in lld, module-level inline assembly is parsed with a MCSubtargetInfo that lacks the target features (e.g. +d), while the module flag target-abi is "lp64d", turning what was previously a note/warning into a hard build failure.
> > Minimal Reproducer repro.c:
> > ```
> > __asm__("nop");
> > ```
> > 
> > 
> >     
> >       
> >     
> > 
> >       
> >     
> > 
> >     
> >   
> > Command:
> > ```
> > clang --target=riscv64-linux-android -march=rv64gcv -flto -shared -nostdlib -fuse-ld=lld repro.c -o librepro.so
> > ```
> > 
> > 
> >     
> >       
> >     
> > 
> >       
> >     
> > 
> >     
> >   
> > Can you fix this issue for LTO or revert the change?
> 
> Thanks for the repro. If you give me a few hours I can come up with a fix hopefully by tomorrow morning if that is too long please revert and I'll reland

I am good to wait till tomorrow for a fix.

https://github.com/llvm/llvm-project/pull/213410


More information about the llvm-commits mailing list