Previously, this markedThe __aligned attribute in the raw pointers as being misaligned, not theprevious version applied to the location
data beingof the pointed to. GNU attributes are a bit tricky, so use ars, not the data the pointers pointed to. While this
typedef to attachcould be fixed by applying the alignmentttribute to the data. This fixes the build ona local typedef of uint16_t,
CHERI architectures which do not support misaligned pointersjust using memcpy() for the unaligned access is simpler and wereISO C.
This fixes the build on CHERI architectures which do not support
misaligned pointers and were thus failing with:
lib/libc/string/swab.c:12:18: error: alignment (1) of 'const uint16_t *' (aka 'const unsigned short *') is less than the required capability alignment (16) [-Werror,-Wcheri-capability-misuse]
12 | const uint16_t *f __aligned(1) = from;
|
Co-authored by: Jessica Clarke <jrtc27@FreeBSD.org>
Fixes: 02ebbc781f08 ("swab: Fix implementation to support overlapping copies")
Sponsored by: AFRL, DARPA