Skip to content

riscv: Make ELF flags RVE-aware #112567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions compiler/rustc_codegen_ssa/src/back/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static
e_flags |= elf::EF_RISCV_RVC;
}

// Check if embedded is enabled
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Check if embedded is enabled
// Specify if the embedded abi is used

It seems that the embedded abi can be used even in programs that use the full RV32I instruction set1. This flag only determines if the embedded abi is used as I understand it2, not if the object file is limited to RV32E instructions.

Footnotes

  1. https://github.com/riscv-non-isa/riscv-eabi-spec/blob/master/EABI.adoc#1-goals

  2. https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc#file-header

if features.contains("+e") {
e_flags |= elf::EF_RISCV_RVE;
}

// Select the appropriate floating-point ABI
if features.contains("+d") {
e_flags |= elf::EF_RISCV_FLOAT_ABI_DOUBLE;
Expand Down