Skip to content

riscv32imc-unknown-none-elf with --target-feature=+d: cannot link files with different floating-point ABI #117847

Closed
@jneem

Description

@jneem

I tried this minimal no-std code:

#![no_std]
#![no_main]

use core::panic::PanicInfo;

#[panic_handler]
fn panic(_panic: &PanicInfo<'_>) -> ! {
    loop {}
}

Compiling it with rustc src/main.rs --target riscv32imc-unknown-none-elf -C target-feature=+d gives the linker error rust-lld: error: main.main.2f941e1c5654685d-cgu.0.rcgu.o: cannot link object files with different floating-point ABI from /tmp/rustcnFzdMx/symbols.o.

I was expecting it to successfully compile a binary that uses the double-precision standard extension to the riscv ABI.

I see that this PR changed the behavior so that the float part of the ABI comes from llvm_abiname, and only the RVC part comes from target-feature. Is this the intended behavior? I read on reddit (I know, it isn't canon) that target-feature is the say we're supposed to use the standard riscv extensions.

Meta

rustc --version --verbose:

rustc 1.76.0-nightly (2c1b65ee1 2023-11-11)
binary: rustc
commit-hash: 2c1b65ee1431f8d3fe2142e821eb13c623bbf8a0
commit-date: 2023-11-11
host: x86_64-unknown-linux-gnu
release: 1.76.0-nightly
LLVM version: 17.0.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.O-riscvTarget: RISC-V architecture

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions