riscv-non-isa / riscv-elf-psabi-doc

A RISC-V ELF psABI Document
https://jira.riscv.org/browse/RVG-4
Creative Commons Attribution 4.0 International
703 stars 163 forks source link

Bitfields should be described in a more generic way #266

Open kito-cheng opened 2 years ago

kito-cheng commented 2 years ago

Review comment come from @anderslindgren-iar and Anders Berg(IAR) https://lists.riscv.org/g/tech-toolchain-runtime/message/344

Bitfields are packed in little-endian fashion. A bitfield that would span the alignment boundary of its integer type is padded to begin at the next alignment boundary. For example, struct { int x : 10; int y : 12; } is a 32-bit type with x in bits 9-0, y in bits 21-10, and bits 31-22 undefined. By contrast, struct { short x : 10; short y : 12; } is a 32-bit type with x in bits 9-0, y in bits 27-16, and bits 31-28 and 15-10 undefined.

Anders: Bitfields should be described in a more generic way as it is not only a matter of a calling convention.

kito-cheng commented 2 years ago

I think we should improve that, and I am working on that.

kito-cheng commented 2 years ago

Moving target to post 1.0