The common tests that expected unaligned to really have no guaranteed alignment would fail with UBSAN. The root cause was the definition of unaligned still implied alignment on x86.
Signed-off-by: Stephen Hemminger <[email protected]> --- doc/guides/rel_notes/release_26_11.rst | 6 ++++++ lib/eal/include/rte_common.h | 9 +++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/doc/guides/rel_notes/release_26_11.rst b/doc/guides/rel_notes/release_26_11.rst index 87c7e81bde..47de839458 100644 --- a/doc/guides/rel_notes/release_26_11.rst +++ b/doc/guides/rel_notes/release_26_11.rst @@ -95,6 +95,12 @@ API Changes Also, make sure to start the actual text at the margin. ======================================================= +* **eal: Unaligned integer types are now really unaligned.** + + ``unaligned_uint16_t``, ``unaligned_uint32_t`` and ``unaligned_uint64_t`` + are now declared with an alignment of 1 on all architectures. + The compiler may generate narrower loads and stores than before. + ABI Changes ----------- diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h index f872d3eabb..d0faa9a268 100644 --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -121,15 +121,12 @@ extern "C" { #define __rte_aligned(a) __attribute__((__aligned__(a))) #endif -#ifdef RTE_ARCH_STRICT_ALIGN +/** + * Integer types with no alignment requirement. + */ typedef uint64_t unaligned_uint64_t __rte_aligned(1); typedef uint32_t unaligned_uint32_t __rte_aligned(1); typedef uint16_t unaligned_uint16_t __rte_aligned(1); -#else -typedef uint64_t unaligned_uint64_t; -typedef uint32_t unaligned_uint32_t; -typedef uint16_t unaligned_uint16_t; -#endif /** * Force a structure to be packed -- 2.53.0

