From bc4f996f56f98980dc8b58d7063f9ed8f2c48c9f Mon Sep 17 00:00:00 2001 From: Julian Brown Date: Fri, 9 Dec 2016 13:54:17 +0000 Subject: [PATCH] Big-endian fix for memcpy-armv7m.S In the case of memcpy-armv7m.S being built for a big-endian multilib (including armv7 without a specific profile), realignment code made assumptions about the byte ordering being little-endian. Signed-off-by: Corinna Vinschen --- newlib/libc/machine/arm/memcpy-armv7m.S | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/newlib/libc/machine/arm/memcpy-armv7m.S b/newlib/libc/machine/arm/memcpy-armv7m.S index 8a70c7d73..c8bff36f6 100644 --- a/newlib/libc/machine/arm/memcpy-armv7m.S +++ b/newlib/libc/machine/arm/memcpy-armv7m.S @@ -265,9 +265,17 @@ memcpy: .macro mis_src_copy shift 1: +#ifdef __ARM_BIG_ENDIAN + lsls r4, r4, \shift +#else lsrs r4, r4, \shift +#endif ldr r3, [r1], #4 +#ifdef __ARM_BIG_ENDIAN + lsrs r5, r3, 32-\shift +#else lsls r5, r3, 32-\shift +#endif orr r4, r4, r5 str r4, [r0], #4 mov r4, r3 -- 2.43.5