Skip to content
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

elf: Update LoongArch eflags #483

Merged
merged 1 commit into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
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
21 changes: 13 additions & 8 deletions crates/examples/src/readobj/elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,14 @@ fn print_file_header<Elf: FileHeader>(p: &mut Printer<'_>, endian: Elf::Endian,
p.flags(flags, 0, &FLAGS_EF_RISCV);
p.flags(flags, EF_RISCV_FLOAT_ABI, &FLAGS_EF_RISCV_FLOAT_ABI);
}
EM_LOONGARCH => p.flags(flags, 0, &FLAGS_EF_LOONGARCH),
EM_LOONGARCH => {
p.flags(flags, 0, &FLAGS_EF_LARCH_OBJABI);
p.flags(
flags,
EF_LARCH_ABI_MODIFIER_MASK,
&FLAGS_EF_LARCH_ABI_MODIFIER,
);
}
_ => {}
};
p.field_hex("HeaderSize", elf.e_ehsize(endian));
Expand Down Expand Up @@ -1107,14 +1114,12 @@ static FLAGS_EF_RISCV_FLOAT_ABI: &[Flag<u32>] = &flags!(
EF_RISCV_FLOAT_ABI_DOUBLE,
EF_RISCV_FLOAT_ABI_QUAD,
);
static FLAGS_EF_LOONGARCH: &[Flag<u32>] = &flags!(
EF_LARCH_ABI_LP64S,
EF_LARCH_ABI_LP64F,
EF_LARCH_ABI_LP64D,
EF_LARCH_ABI_ILP32S,
EF_LARCH_ABI_ILP32F,
EF_LARCH_ABI_ILP32D,
static FLAGS_EF_LARCH_ABI_MODIFIER: &[Flag<u32>] = &flags!(
EF_LARCH_ABI_SOFT_FLOAT,
EF_LARCH_ABI_SINGLE_FLOAT,
EF_LARCH_ABI_DOUBLE_FLOAT,
);
static FLAGS_EF_LARCH_OBJABI: &[Flag<u32>] = &flags!(EF_LARCH_OBJABI_V1,);
static FLAGS_PT: &[Flag<u32>] = &flags!(
PT_NULL,
PT_LOAD,
Expand Down
23 changes: 11 additions & 12 deletions src/elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6251,18 +6251,17 @@ pub const R_NDS32_TLS_TPOFF: u32 = 102;
pub const R_NDS32_TLS_DESC: u32 = 119;

// LoongArch values `FileHeader*::e_flags`.
/// Uses 64-bit GPRs and the stack for parameter passing
pub const EF_LARCH_ABI_LP64S: u32 = 0x1;
/// Uses 64-bit GPRs, 32-bit FPRs and the stack for parameter passing
pub const EF_LARCH_ABI_LP64F: u32 = 0x2;
/// Uses 64-bit GPRs, 64-bit FPRs and the stack for parameter passing
pub const EF_LARCH_ABI_LP64D: u32 = 0x3;
/// Uses 32-bit GPRs and the stack for parameter passing
pub const EF_LARCH_ABI_ILP32S: u32 = 0x5;
/// Uses 32-bit GPRs, 32-bit FPRs and the stack for parameter passing
pub const EF_LARCH_ABI_ILP32F: u32 = 0x6;
/// Uses 32-bit GPRs, 64-bit FPRs and the stack for parameter passing
pub const EF_LARCH_ABI_ILP32D: u32 = 0x7;
/// Additional properties of the base ABI type, including the FP calling
/// convention.
pub const EF_LARCH_ABI_MODIFIER_MASK: u32 = 0x7;
/// Uses GPRs and the stack for parameter passing
pub const EF_LARCH_ABI_SOFT_FLOAT: u32 = 0x1;
/// Uses GPRs, 32-bit FPRs and the stack for parameter passing
pub const EF_LARCH_ABI_SINGLE_FLOAT: u32 = 0x2;
/// Uses GPRs, 64-bit FPRs and the stack for parameter passing
pub const EF_LARCH_ABI_DOUBLE_FLOAT: u32 = 0x3;
/// Uses relocation types directly writing to immediate slots
pub const EF_LARCH_OBJABI_V1: u32 = 0x40;

// LoongArch values `Rel*::r_type`.
/// No reloc
Expand Down