-
Notifications
You must be signed in to change notification settings - Fork 163
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
Support ILP32 on RV64 in psABI #381
base: master
Are you sure you want to change the base?
Conversation
Regardless of whether we want it, x32 is completely the wrong name for it. x32 comes from the x86, x86_64 and (awful) x64 terminology specific to x86. |
I'll also note that, normally, ILP32-on-64 ABIs use ELFCLASS32, not ELFCLASS64. This is complicated on RISC-V by the fact that there is a single EM_RISCV, not separate EM_RISCV32 and EM_RISCV64. |
In ILP32-on-RV64, we used ELFCLASS32 and EM_RISCV. X32(Let's temporarily call it this name) is added to distinguish between ilp32 on RV64 and ilp32 on RV32 . I think this e_flag is necessary. This is the ELF Header which generated by ILP32-on-RV64 |
I would prefer using something like register a new e_machine value |
I could not agree with you.
|
e_machine is 16 bit value, and use as sequence number, so we still have 2^16 - 248 = 65288 to use, but e_flags is use as bit vector, and reserved 8 bit for non-std use, and we also used 5 bit, so we have only 19 bits left, and adding EF_RISCV_X32 make it become 18 bits left. So compared to e_flags, e_machine has much larger room to use (waste :P). |
OK, you convinced me. |
Seems like it should be happened here, we could send request to [email protected] and https://groups.google.com/g/generic-abi , but I would like to pick an random value before we reach further consensus. However I know a random value might be a bit too vague, maybe we could tentatively use |
I don't have an overly strong view on EM_RISCV_X32 (though Kito makes a good point about eflags bits being scarce), but don't see why we'd need to introduce EM_RISCV32 and EM_RISCV64 as well at this point - it feels like it would cause confusion with no real gain. |
The world would have been better if EM_RISCV had been split in two like that, but it wasn't, so we need to live with that, and trying to retroactively do it is a bad idea. So I agree with Alex. |
Add ABIs and ISAs mapping description about ILP32 on RV64* ISA. Signed-off-by: Liao Shihua <[email protected]> Signed-off-by: Guo Ren <[email protected]>
EF_RISCV_N32 is for ILP32* ABI on RV64* ISA. It use ELF-32 Object File and needs a flag-bit in e_flags field. Signed-off-by: Liao Shihua <[email protected]> Signed-off-by: Guo Ren <[email protected]>
- Add RV64GQ systems also could use ILP32* ABIs. - Correct C/{Cpp} type sizes and alignments descriptions. Signed-off-by: Guo Ren <[email protected]> Signed-off-by: Liao Shihua <[email protected]>
Limiting the address space to lower 2GiB does not pose any issues with sign extending addresses into the upper 32 bits of a 64-bit register. Signed-off-by: Guo Ren <[email protected]> Signed-off-by: Liao Shihua <[email protected]>
This pull request adds a new e_flags X32. It occupies the sixth bit of e_flags layout.
We have initially implemented rv64 ilp32 on the gnu toolchain and kernel.
Details in this link.
@guoren83 @palmer-dabbelt @kito-cheng