Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
linux-gen: fix unaligned access in checksum calculation
Architectures that support unaligned access do not necessarily support it for all instructions that a compiler might choose to use. Therefore we should not mispresent the alignment of an object to the compiler even when unaligned access is typically supported. The current checksum code casts a potentially unaligned address to a pointer to uint32_t when _ODP_UNALIGNED is set. This typically works but may, in some cases, result in generation of invalid code. In particular, when targeting AArch32 (which supports unaligned access for regular loads and stores) gcc-12.2 generated LDM instructions which always reguire 4-byte alignment. Fix the problem by informing the compiler about the non-standard alignment by using a type attribute. Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
- Loading branch information