Index: lib/builtins/arm/aeabi_cdcmp.S =================================================================== --- lib/builtins/arm/aeabi_cdcmp.S +++ lib/builtins/arm/aeabi_cdcmp.S @@ -51,6 +51,9 @@ #if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) mov ip, #APSR_C msr APSR_nzcvq, ip +#elif defined(USE_THUMB_2) + mov ip, #APSR_C + msr CPSR_f, ip #else msr CPSR_f, #APSR_C #endif Index: lib/builtins/arm/aeabi_cfcmp.S =================================================================== --- lib/builtins/arm/aeabi_cfcmp.S +++ lib/builtins/arm/aeabi_cfcmp.S @@ -51,6 +51,9 @@ #if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) mov ip, #APSR_C msr APSR_nzcvq, ip +#elif defined(USE_THUMB_2) + mov ip, #APSR_C + msr CPSR_f, ip #else msr CPSR_f, #APSR_C #endif Index: lib/builtins/arm/aeabi_memset.S =================================================================== --- lib/builtins/arm/aeabi_memset.S +++ lib/builtins/arm/aeabi_memset.S @@ -24,6 +24,7 @@ DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memset4, __aeabi_memset) DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memset8, __aeabi_memset) + .p2align 2 DEFINE_COMPILERRT_FUNCTION(__aeabi_memclr) mov r2, r1 movs r1, #0 Index: lib/builtins/assembly.h =================================================================== --- lib/builtins/assembly.h +++ lib/builtins/assembly.h @@ -75,7 +75,7 @@ * - for '-mthumb -march=armv7' compiler defines '__thumb__' and '__thumb2__' */ #if defined(__thumb2__) || defined(__thumb__) -#define DEFINE_CODE_STATE .thumb +#define DEFINE_CODE_STATE .thumb SEPARATOR #define DECLARE_FUNC_ENCODING .thumb_func SEPARATOR #if defined(__thumb2__) #define USE_THUMB_2 @@ -89,7 +89,7 @@ #define ITE(cond) #endif // defined(__thumb__2) #else // !defined(__thumb2__) && !defined(__thumb__) -#define DEFINE_CODE_STATE .arm +#define DEFINE_CODE_STATE .arm SEPARATOR #define DECLARE_FUNC_ENCODING #define IT(cond) #define ITT(cond) @@ -146,6 +146,7 @@ #endif #define DEFINE_COMPILERRT_FUNCTION(name) \ + DEFINE_CODE_STATE \ FILE_LEVEL_DIRECTIVE SEPARATOR \ .globl SYMBOL_NAME(name) SEPARATOR \ SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \ @@ -154,6 +155,7 @@ SYMBOL_NAME(name): #define DEFINE_COMPILERRT_THUMB_FUNCTION(name) \ + DEFINE_CODE_STATE \ FILE_LEVEL_DIRECTIVE SEPARATOR \ .globl SYMBOL_NAME(name) SEPARATOR \ SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \ @@ -162,6 +164,7 @@ SYMBOL_NAME(name): #define DEFINE_COMPILERRT_PRIVATE_FUNCTION(name) \ + DEFINE_CODE_STATE \ FILE_LEVEL_DIRECTIVE SEPARATOR \ .globl SYMBOL_NAME(name) SEPARATOR \ SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \ @@ -170,6 +173,7 @@ SYMBOL_NAME(name): #define DEFINE_COMPILERRT_PRIVATE_FUNCTION_UNMANGLED(name) \ + DEFINE_CODE_STATE \ .globl name SEPARATOR \ SYMBOL_IS_FUNC(name) SEPARATOR \ HIDDEN(name) SEPARATOR \