This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [PATCH, ping1] Make macro checks ARMv8-M baseline proof
- From: Thomas Preud'homme <thomas dot preudhomme at foss dot arm dot com>
- To: newlib at sourceware dot org
- Cc: "Richard Earnshaw (lists)" <Richard dot Earnshaw at arm dot com>
- Date: Thu, 21 Jan 2016 11:32:05 +0800
- Subject: Re: [PATCH, ping1] Make macro checks ARMv8-M baseline proof
- Authentication-results: sourceware.org; auth=none
- References: <56719806 dot 40006 at arm dot com> <132084280 dot IrCat9nLWC at hardin dot shanghai dot arm dot com> <2356952 dot C7xaY5Aaho at hardin dot shanghai dot arm dot com>
Ping?
On Friday, January 15, 2016 05:52:40 PM Thomas Preud'homme wrote:
> On Wednesday, January 13, 2016 10:41:22 AM Thomas Preud'homme wrote:
> > Hi Richard,
> >
> > NEWLIB_CFLAGS, CFLAGS and CFLAGS_FOR_TARGET in libgloss/arm/Makefile are
> > all overriden when libgloss/Makefile does the recursive call (see
> > FLAGS_TO_PASS). So instead I extended INCLUDES to contains the newlib
> > directory containing acle-compat.h. Note that nothing is done when
> > libgloss
> > is built alone but this means old GCC cannot build libgloss alone.
> >
> > Note that, as I explained in [1], there is two code change with this patch
> > but I believe they are actually bug fixes. Please let me know if you agree
> > with my analysis.
> >
> > [1] https://sourceware.org/ml/newlib/2015/msg00955.html
>
> Except that I was (doubly) wrong for one of them. In that message, I wrote
>
> > This change include armv7 in PREFER_THUMB where it was not included in
> > THUMB_V7_V6M. It leads to use of svc to bkpt and the mov.w fp, #0 in
> > redboot-crt0.S is no longer included.
>
> First of all, the issue is not in PREFER_THUMB but in replacing
> THUMB_V6M_V7M by !__ARM_ARCH_ISA_ARM. Secondly, this is indeed a bug
> because the bkpt/svc in question is for semihosting and only M profile
> architectures should use bkpt according to the semihosting interface [1].
> The mov.w fp, #0 on the other hand is a correct change since there is no
> ARM state in ARMv7 (being the common subset of ARMv7-M, ARMv7-R and
> ARMv7-A).
>
> [1] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0471l/
> pge1358787048379.html
>
> I've thus respinned the patch, keeping THUMB_V6M_V7M (but under the new name
> THUMB_VxM) everywhere except for fp enabling.
>
> ChangeLog entries are now as follow:
>
>
> *** libgloss/ChangeLog ***
>
> 2015-01-15 Thomas Preud'homme <thomas.preudhomme@arm.com>
>
> * arm/Makefile.in: Add newlib/libc/machine/arm to the include path
> if newlib is present.
> * arm/arm.h: Include acle-compat.h.
> (THUMB_V7_V6M): Rename to ...
> (PREFER_THUMB): This. Use ACLE macros __ARM_ARCH_ISA_ARM instead of
> __ARM_ARCH_6M__ to decide whether to define it.
> (THUMB1_ONLY): Define for Thumb-1 only targets.
> (THUMB_V7M_V6M): Rename to ...
> (THUMB_VXM): This. Defined based on __ARM_ARCH_ISA_ARM, excluding
> ARMv7.
> * arm/crt0.S: Use THUMB1_ONLY rather than __ARM_ARCH_6M__,
> !__ARM_ARCH_ISA_ARM rather than THUMB_V7M_V6M for fp enabling, and
> PREFER_THUMB rather than THUMB_V7_V6M. Rename other occurences of
> THUMB_V7M_V6M to THUMB_VXM.
> * arm/linux-crt0.c: Likewise.
> * arm/redboot-crt0.S: Likewise.
> * arm/swi.h: Likewise.
> * arm/trap.S: Likewise.
>
>
> *** newlib/ChangeLog ***
>
> 2015-01-15 Thomas Preud'homme <thomas.preudhomme@arm.com>
>
> * libc/machine/arm/memcpy-stub.c: Use ACLE macros
> __ARM_ARCH_ISA_THUMB and __ARM_ARCH_ISA_ARM to check for Thumb-2 only
> targets rather than __ARM_ARCH and __ARM_ARCH_PROFILE.
> * libc/machine/arm/memcpy.S: Likewise.
> * libc/machine/arm/setjmp.S: Likewise for Thumb-1 only target and
> include acle-compat.h.
> * libc/machine/arm/strcmp.S: Likewise for Thumb-1 and Thumb-2 only
> target and include acle-compat.h.
> * libc/sys/arm/arm.h: Include acle-compat.h.
> (THUMB_V7_V6M): Rename to ...
> (PREFER_THUMB): This. Use ACLE macro __ARM_ARCH_ISA_ARM instead of
> __ARM_ARCH_6M__ to decide whether to define it.
> (THUMB1_ONLY): Define for Thumb-1 only targets.
> (THUMB_V7M_V6M): Rename to ...
> (THUMB_VXM): This. Defined based on __ARM_ARCH_ISA_ARM, excluding
> ARMv7.
> * libc/sys/arm/crt0.S: Use PREFER_THUMB rather than THUMB_V7_V6M and
> rename THUMB_V7M_V6M into THUMB_VXM.
> * libc/sys/arm/swi.h: Likewise.
>
>
> diff --git a/libgloss/arm/Makefile.in b/libgloss/arm/Makefile.in
> index 6e89cfb037a66433669b9655113999e7c0e264be..
> 3f87deae2998a0f5cb39fee7da51e7a410275ecb 100644
> --- a/libgloss/arm/Makefile.in
> +++ b/libgloss/arm/Makefile.in
> @@ -94,6 +94,8 @@ IQ80310_INSTALL = install-iq80310
> # Host specific makefile fragment comes in here.
> @host_makefile_frag@
>
> +INCLUDES += `if [ -d ${objroot}/newlib ]; then echo
> -I$(srcroot)/newlib/libc/ machine/arm; fi`
> +
> #
> # build a test program for each target board. Just trying to get
> # it to link is a good test, so we ignore all the errors for now.
> diff --git a/libgloss/arm/arm.h b/libgloss/arm/arm.h
> index 26a1ff11011d12e944ed3d01fee75a54d30dc17e..
> 0489f2d9242f1bbcc4238acc402718b83d06dfaf 100644
> --- a/libgloss/arm/arm.h
> +++ b/libgloss/arm/arm.h
> @@ -29,25 +29,27 @@
> #ifndef _LIBGLOSS_ARM_H
> #define _LIBGLOSS_ARM_H
>
> -/* __thumb2__ stands for thumb on armva7(A/R/M/EM) architectures,
> - __ARM_ARCH_6M__ stands for armv6-M(thumb only) architecture,
> - __ARM_ARCH_7M__ stands for armv7-M(thumb only) architecture.
> - __ARM_ARCH_7EM__ stands for armv7e-M(thumb only) architecture.
> - There are some macro combinations used many times in libgloss/arm,
> - like (__thumb2__ || (__thumb__ && __ARM_ARCH_6M__)), so factor
> - it out and use THUMB_V7_V6M instead, which stands for thumb on
> - v6-m/v7 arch as the combination does. */
> -#if defined(__thumb2__) || (defined(__thumb__) && defined(__ARM_ARCH_6M__))
> -# define THUMB_V7_V6M
> +#include "acle-compat.h"
> +
> +/* Checking for targets supporting only Thumb instructions (eg. ARMv6-M) or
> + supporting Thumb-2 instructions, whether ARM instructions are available
> or + not, is done many times in libgloss/arm. So factor it out and use +
> PREFER_THUMB instead. */
> +#if __thumb2__ || (__thumb__ && !__ARM_ARCH_ISA_ARM)
> +# define PREFER_THUMB
> +#endif
> +
> +/* Processor only capable of executing Thumb-1 instructions. */
> +#if __ARM_ARCH_ISA_THUMB == 1 && !__ARM_ARCH_ISA_ARM
> +# define THUMB1_ONLY
> #endif
>
> -/* The (__ARM_ARCH_7EM__ || __ARM_ARCH_7M__ || __ARM_ARCH_6M__) combination
> - stands for cortex-M profile architectures, which don't support ARM
> state. - Factor it out and use THUMB_V7M_V6M instead. */
> -#if defined(__ARM_ARCH_7M__) \
> - || defined(__ARM_ARCH_7EM__) \
> - || defined(__ARM_ARCH_6M__)
> -# define THUMB_V7M_V6M
> +/* M profile architectures. This is a different set of architectures than
> + those not having ARM ISA because it does not contain ARMv7. This macro
> is + necessary to test which architectures use bkpt as semihosting
> interface from
> + architectures using svc. */
> +#if !__ARM_ARCH_ISA_ARM && !__ARM_ARCH_7__
> +# define THUMB_VXM
> #endif
>
> /* Defined if this target supports the BLX Rm instruction. */
> diff --git a/libgloss/arm/crt0.S b/libgloss/arm/crt0.S
> index
> cb9021df3f93d1ccc568b2e16d852f5072de3da8..7c662f9150d973833e290447db5a1f6611
> c79309 100644
> --- a/libgloss/arm/crt0.S
> +++ b/libgloss/arm/crt0.S
> @@ -44,7 +44,7 @@
> /* .text is used instead of .section .text so it works with arm-aout too.
> */ .text
> .syntax unified
> -#ifdef THUMB_V7_V6M
> +#ifdef PREFER_THUMB
> .thumb
> .macro FUNC_START name
> .global \name
> @@ -98,7 +98,7 @@
>
> /* stack limit is at end of data */
> /* allow slop for stack overflow handling and small frames */
> -#ifdef __ARM_ARCH_6M__
> +#ifdef THUMB1_ONLY
> ldr r0, .LC2
> adds r0, #128
> adds r0, #128
> @@ -112,7 +112,7 @@
> /* Issue Angel SWI to read stack info */
> movs r0, #AngelSWI_Reason_HeapInfo
> adr r1, .LC0 /* point at ptr to 4 words to receive data */
> -#ifdef THUMB_V7M_V6M
> +#ifdef THUMB_VXM
> bkpt AngelSWI
> #elif defined(__thumb2__)
> /* We are in thumb mode for startup on armv7 architectures. */
> @@ -154,7 +154,7 @@
> cmp r2, #0
> beq .LC27
> /* allow slop for stack overflow handling and small frames */
> -#ifdef __ARM_ARCH_6M__
> +#ifdef THUMB1_ONLY
> adds r2, #128
> adds r2, #128
> mov sl, r2
> @@ -180,7 +180,7 @@
> #ifdef __thumb2__
> it eq
> #endif
> -#ifdef __ARM_ARCH_6M__
> +#ifdef THUMB1_ONLY
> bne .LC28
> ldr r3, .LC0
> .LC28:
> @@ -192,7 +192,7 @@
> have somehow missed it below (in which case it gets the same
> value as FIQ - not ideal, but better than nothing.) */
> mov sp, r3
> -#ifdef THUMB_V7_V6M
> +#ifdef PREFER_THUMB
> /* XXX Fill in stack assignments for interrupt modes. */
> #else
> mrs r2, CPSR
> @@ -235,7 +235,7 @@
> this default 64k is enough for the program being executed.
> However, it ensures that this simple crt0 world will not
> immediately cause an overflow event: */
> -#ifdef __ARM_ARCH_6M__
> +#ifdef THUMB1_ONLY
> movs r2, #64
> lsls r2, r2, #10
> subs r2, r3, r2
> @@ -255,7 +255,7 @@
> subs a3, a3, a1 /* Third arg: length of block */
>
>
> -#if defined(__thumb__) && !defined(THUMB_V7_V6M)
> +#if __thumb__ && !defined(PREFER_THUMB)
> /* Enter Thumb mode.... */
> add a4, pc, #1 /* Get the address of the Thumb block */
> bx a4 /* Go there and start Thumb decoding */
> @@ -426,7 +426,7 @@ __change_mode:
>
> bl FUNCTION (exit) /* Should not return. */
>
> -#if defined(__thumb__) && !defined(THUMB_V7_V6M)
> +#if __thumb__ && !defined(PREFER_THUMB)
> /* Come out of Thumb mode. This code should be redundant. */
>
> mov a4, pc
> diff --git a/libgloss/arm/linux-crt0.c b/libgloss/arm/linux-crt0.c
> index
> c313d269fa55f55c7f41b81e047379e5351d1785..878ece7653bf40b0fd991e14a61ce0920e
> 3d414e 100644
> --- a/libgloss/arm/linux-crt0.c
> +++ b/libgloss/arm/linux-crt0.c
> @@ -12,7 +12,7 @@
>
> static int _main(int argc, char *argv[]) __attribute__((noreturn));
>
> -#if defined(__thumb__) && !defined(THUMB_V7_V6M)
> +#if __thumb__ && !defined(PREFER_THUMB)
> asm("\n"
> ".code 32\n"
> ".global _start\n"
> diff --git a/libgloss/arm/redboot-crt0.S b/libgloss/arm/redboot-crt0.S
> index
> 1d902286e4c2eee6bf19622acb5ad96d13526917..0e3a9b4e23fa60f547ca6659f780adbbe6
> 5e81ab 100644
> --- a/libgloss/arm/redboot-crt0.S
> +++ b/libgloss/arm/redboot-crt0.S
> @@ -14,7 +14,7 @@
> .text
> .syntax unified
> /* Setup the assembly entry point. */
> -#ifdef THUMB_V7_V6M
> +#ifdef PREFER_THUMB
> .macro FUNC_START name
> .global \name
> .thumb_func
> @@ -31,13 +31,13 @@
> FUNC_START SYM_NAME(_start)
> /* Unnecessary to set fp for v6-m/v7-m, which don't support
> ARM state. */
> -#ifndef THUMB_V7M_V6M
> +#if __ARM_ARCH_ISA_ARM
> mov fp, #0 /* Null frame pointer. */
> #endif
> movs r7, #0 /* Null frame pointer for Thumb. */
>
> /* Enable interrupts for gdb debugging. */
> -#ifdef THUMB_V7_V6M
> +#ifdef PREFER_THUMB
> cpsie if
> #else
> mrs r0, cpsr
> @@ -66,7 +66,7 @@
> /* Nothing to left to clear. */
> #endif
>
> -#if defined(__thumb__) && !defined(THUMB_V7_V6M)
> +#if __thumb__ && !defined(PREFER_THUMB)
> /* Enter Thumb mode. */
> add a4, pc, #1 /* Get the address of the Thumb block. */
> bx a4 /* Go there and start Thumb decoding. */
> diff --git a/libgloss/arm/swi.h b/libgloss/arm/swi.h
> index
> 0f9313447fdbe5df4d217fda33d2a73544865752..b7fa243f86d32666a596da30aa671e1446
> cbebf1 100644
> --- a/libgloss/arm/swi.h
> +++ b/libgloss/arm/swi.h
> @@ -36,7 +36,7 @@
> #define AngelSWI AngelSWI_ARM
> #endif
> /* For thumb only architectures use the BKPT instruction instead of SWI.
> */ -#ifdef THUMB_V7M_V6M
> +#ifdef THUMB_VXM
> #define AngelSWIInsn "bkpt"
> #define AngelSWIAsm bkpt
> #else
> diff --git a/libgloss/arm/trap.S b/libgloss/arm/trap.S
> index
> 9eb39069a0e75e2e7daa88882930e5c7999607f7..d854b57bb5df585d0bb8bb7baf91c1d932
> 5ece7a 100644
> --- a/libgloss/arm/trap.S
> +++ b/libgloss/arm/trap.S
> @@ -1,6 +1,6 @@
> #include "arm.h"
> /* Run-time exception support */
> -#ifndef THUMB_V7_V6M
> +#ifndef PREFER_THUMB
> #include "swi.h"
>
> /* .text is used instead of .section .text so it works with arm-aout too.
> */ diff --git a/newlib/libc/machine/arm/memcpy-stub.c
> b/newlib/libc/machine/arm/ memcpy-stub.c
> index
> 52a0f91bdab1da4cb5aea32833cd9ecf4c5bb099..6cd0e3b1d4d5ae2901166b181742a2ade4
> 7c6092 100644
> --- a/newlib/libc/machine/arm/memcpy-stub.c
> +++ b/newlib/libc/machine/arm/memcpy-stub.c
> @@ -34,7 +34,7 @@
> #elif (__ARM_ARCH >= 7 && __ARM_ARCH_PROFILE == 'A' \
> && defined (__ARM_FEATURE_UNALIGNED))
> /* Defined in memcpy.S. */
> -#elif __ARM_ARCH >= 7 && __ARM_ARCH_PROFILE == 'M'
> +#elif __ARM_ARCH_ISA_THUMB == 2 && !__ARM_ARCH_ISA_ARM
> /* Defined in memcpy.S. */
> #else
> # include "../../string/memcpy.c"
> diff --git a/newlib/libc/machine/arm/memcpy.S b/newlib/libc/machine/arm/
> memcpy.S
> index
> d9d5810a76ac52b7d68c4a98d531c1810aee75a1..77bd2a606e4bea817f90f0e5db186f3a80
> 12950c 100644
> --- a/newlib/libc/machine/arm/memcpy.S
> +++ b/newlib/libc/machine/arm/memcpy.S
> @@ -38,7 +38,7 @@
> && defined (__ARM_FEATURE_UNALIGNED))
> #include "memcpy-armv7a.S"
>
> -#elif __ARM_ARCH >= 7 && __ARM_ARCH_PROFILE == 'M'
> +#elif __ARM_ARCH_ISA_THUMB == 2 && !__ARM_ARCH_ISA_ARM
> #include "memcpy-armv7m.S"
>
> #else
> diff --git a/newlib/libc/machine/arm/setjmp.S b/newlib/libc/machine/arm/
> setjmp.S
> index
> a65fbabb9926f64557bea3d3d336bb1843ae6ae2..1ba711d5e4cd49944b1bc4ae6ba859bb59
> 69440f 100644
> --- a/newlib/libc/machine/arm/setjmp.S
> +++ b/newlib/libc/machine/arm/setjmp.S
> @@ -2,6 +2,8 @@
>
> Nick Clifton, Cygnus Solutions, 13 June 1997. */
>
> +#include "acle-compat.h"
> +
> /* ANSI concatenation macros. */
> #define CONCAT(a, b) CONCAT2(a, b)
> #define CONCAT2(a, b) a##b
> @@ -55,8 +57,8 @@
>
> For Thumb-2 do everything in Thumb mode. */
>
> -#if defined(__ARM_ARCH_6M__)
> -/* ARMv6-M has to be implemented in Thumb mode. */
> +#if __ARM_ARCH_ISA_THUMB == 1 && !__ARM_ARCH_ISA_ARM
> +/* ARMv6-M-like has to be implemented in Thumb mode. */
>
> .thumb
> .thumb_func
> diff --git a/newlib/libc/machine/arm/strcmp.S b/newlib/libc/machine/arm/
> strcmp.S
> index 7b4d7fc9063bc7493b38f589e171f50c37b1d55c..
> 3af9b6dbd60a5daa62bdf2e81a6d00136f52af6a 100644
> --- a/newlib/libc/machine/arm/strcmp.S
> +++ b/newlib/libc/machine/arm/strcmp.S
> @@ -29,6 +29,7 @@
> /* Wrapper for the various implementations of strcmp. */
>
> #include "arm_asm.h"
> +#include "acle-compat.h"
>
> #ifdef __ARM_BIG_ENDIAN
> #define S2LO lsl
> @@ -61,7 +62,7 @@
> .endm
>
> #if defined (__OPTIMIZE_SIZE__) || defined (PREFER_SIZE_OVER_SPEED) \
> - || (__ARM_ARCH == 6 && __ARM_ARCH_PROFILE == 'M')
> + || (__ARM_ARCH_ISA_THUMB == 1 && !__ARM_ARCH_ISA_ARM)
>
> # if defined (__thumb__) && !defined (__thumb2__)
> /* Thumb1 only variant. If size is preferred, use strcmp-armv4t.S.
> @@ -78,7 +79,7 @@
> # include "strcmp-arm-tiny.S"
> # endif
>
> -#elif __ARM_ARCH >= 7
> +#elif __ARM_ARCH_ISA_THUMB == 2
>
> # ifdef __ARM_FEATURE_SIMD32
> # include "strcmp-armv7.S"
> diff --git a/newlib/libc/sys/arm/arm.h b/newlib/libc/sys/arm/arm.h
> index 26a1ff11011d12e944ed3d01fee75a54d30dc17e..
> 0489f2d9242f1bbcc4238acc402718b83d06dfaf 100644
> --- a/newlib/libc/sys/arm/arm.h
> +++ b/newlib/libc/sys/arm/arm.h
> @@ -29,25 +29,27 @@
> #ifndef _LIBGLOSS_ARM_H
> #define _LIBGLOSS_ARM_H
>
> -/* __thumb2__ stands for thumb on armva7(A/R/M/EM) architectures,
> - __ARM_ARCH_6M__ stands for armv6-M(thumb only) architecture,
> - __ARM_ARCH_7M__ stands for armv7-M(thumb only) architecture.
> - __ARM_ARCH_7EM__ stands for armv7e-M(thumb only) architecture.
> - There are some macro combinations used many times in libgloss/arm,
> - like (__thumb2__ || (__thumb__ && __ARM_ARCH_6M__)), so factor
> - it out and use THUMB_V7_V6M instead, which stands for thumb on
> - v6-m/v7 arch as the combination does. */
> -#if defined(__thumb2__) || (defined(__thumb__) && defined(__ARM_ARCH_6M__))
> -# define THUMB_V7_V6M
> +#include "acle-compat.h"
> +
> +/* Checking for targets supporting only Thumb instructions (eg. ARMv6-M) or
> + supporting Thumb-2 instructions, whether ARM instructions are available
> or + not, is done many times in libgloss/arm. So factor it out and use +
> PREFER_THUMB instead. */
> +#if __thumb2__ || (__thumb__ && !__ARM_ARCH_ISA_ARM)
> +# define PREFER_THUMB
> +#endif
> +
> +/* Processor only capable of executing Thumb-1 instructions. */
> +#if __ARM_ARCH_ISA_THUMB == 1 && !__ARM_ARCH_ISA_ARM
> +# define THUMB1_ONLY
> #endif
>
> -/* The (__ARM_ARCH_7EM__ || __ARM_ARCH_7M__ || __ARM_ARCH_6M__) combination
> - stands for cortex-M profile architectures, which don't support ARM
> state. - Factor it out and use THUMB_V7M_V6M instead. */
> -#if defined(__ARM_ARCH_7M__) \
> - || defined(__ARM_ARCH_7EM__) \
> - || defined(__ARM_ARCH_6M__)
> -# define THUMB_V7M_V6M
> +/* M profile architectures. This is a different set of architectures than
> + those not having ARM ISA because it does not contain ARMv7. This macro
> is + necessary to test which architectures use bkpt as semihosting
> interface from
> + architectures using svc. */
> +#if !__ARM_ARCH_ISA_ARM && !__ARM_ARCH_7__
> +# define THUMB_VXM
> #endif
>
> /* Defined if this target supports the BLX Rm instruction. */
> diff --git a/newlib/libc/sys/arm/crt0.S b/newlib/libc/sys/arm/crt0.S
> index
> b56072fcba74c6d909bcbf4893a653b2615932a6..64d425900249609d86cd09fe638dc060e6
> af305b 100644
> --- a/newlib/libc/sys/arm/crt0.S
> +++ b/newlib/libc/sys/arm/crt0.S
> @@ -44,7 +44,7 @@
> /* .text is used instead of .section .text so it works with arm-aout too.
> */ .text
> .syntax unified
> -#ifdef THUMB_V7_V6M
> +#ifdef PREFER_THUMB
> .thumb
> .macro FUNC_START name
> .global \name
> @@ -99,7 +99,7 @@
> /* Issue Angel SWI to read stack info. */
> movs r0, #AngelSWI_Reason_HeapInfo
> adr r1, .LC0 /* Point at ptr to 4 words to receive data. */
> -#ifdef THUMB_V7M_V6M
> +#ifdef THUMB_VXM
> bkpt AngelSWI
> #elif defined(__thumb2__)
> /* We are in thumb mode for startup on armv7 architectures. */
> @@ -176,7 +176,7 @@
> have somehow missed it below (in which case it gets the same
> value as FIQ - not ideal, but better than nothing). */
> mov sp, r3
> -#ifdef THUMB_V7_V6M
> +#ifdef PREFER_THUMB
> /* XXX Fill in stack assignments for interrupt modes. */
> #else
> mrs r2, CPSR
> @@ -239,7 +239,7 @@
> subs a3, a3, a1 /* Third arg: length of block. */
>
>
> -#if defined(__thumb__) && !defined(THUMB_V7_V6M)
> +#if __thumb__ && !defined(PREFER_THUMB)
> /* Enter Thumb mode... */
> add a4, pc, #1 /* Get the address of the Thumb block. */
> bx a4 /* Go there and start Thumb decoding. */
> @@ -278,7 +278,7 @@ __change_mode:
> #else
> movs r0, #AngelSWI_Reason_GetCmdLine
> adr r1, .LC30 /* Space for command line. */
> -#ifdef THUMB_V7M_V6M
> +#ifdef THUMB_VXM
> bkpt AngelSWI
> #else
> AngelSWIAsm AngelSWI
> @@ -404,7 +404,7 @@ __change_mode:
>
> bl FUNCTION (exit) /* Should not return. */
>
> -#if defined(__thumb__) && !defined(THUMB_V7_V6M)
> +#if __thumb__ && !defined(PREFER_THUMB)
> /* Come out of Thumb mode. This code should be redundant. */
> mov a4, pc
> bx a4
> diff --git a/newlib/libc/sys/arm/swi.h b/newlib/libc/sys/arm/swi.h
> index
> 0f9313447fdbe5df4d217fda33d2a73544865752..b7fa243f86d32666a596da30aa671e1446
> cbebf1 100644
> --- a/newlib/libc/sys/arm/swi.h
> +++ b/newlib/libc/sys/arm/swi.h
> @@ -36,7 +36,7 @@
> #define AngelSWI AngelSWI_ARM
> #endif
> /* For thumb only architectures use the BKPT instruction instead of SWI.
> */ -#ifdef THUMB_V7M_V6M
> +#ifdef THUMB_VXM
> #define AngelSWIInsn "bkpt"
> #define AngelSWIAsm bkpt
> #else
>
>
>
> Tested by building newlib and comparing all *.a and *.o binaries before and
> after with objdump -D and readelf -A for all permutations of:
>
> Architectures:
> armv4 armv4t armv5 armv5t armv5te armv6 armv6j armv6k
> armv6z armv6kz armv6t2 armv6s-m armv7 armv7-a armv7ve
> armv7-r armv7-m armv7e-m armv8-a armv8-a+crc iwmmxt
> iwmmxt2
>
> ISAs:
> thumb arm
>
> Optimization Levels:
> Os O2
>
> Excluding:
> armv6s-m -marm
> armv7 -marm
> armv7-m -marm
> armv7e-m -marm
> iwmmxt -mthumb
> iwmmxt2 -mthumb
>
> as being rejected by the compiler or assembler. ARMv6-m was not tested
> because compilation fails due to svc instruction. The newlib built was
> configured with --disable-newlib-supplied-syscalls.
>
>
> Is this ok for master branch?
>
> Best regards,
>
> Thomas