From 4171347709cfe0beb7e685d27fa7efd9e4bc89e1 Mon Sep 17 00:00:00 2001 From: Simon Butcher Date: Tue, 10 Jul 2018 20:18:29 +0100 Subject: [PATCH] Disable use of the i386 assembly for option -O0 We don't compile in the assembly code if compiler optimisations are disabled as the number of registers used in the assembly code doesn't work with the -O0 option. Also anyone select -O0 probably doesn't want to compile in the assembly code anyway. --- include/mbedtls/bn_mul.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/mbedtls/bn_mul.h b/include/mbedtls/bn_mul.h index 0590882cc..8d799ec9b 100644 --- a/include/mbedtls/bn_mul.h +++ b/include/mbedtls/bn_mul.h @@ -48,7 +48,14 @@ /* armcc5 --gnu defines __GNUC__ but doesn't support GNU's extended asm */ #if defined(__GNUC__) && \ ( !defined(__ARMCC_VERSION) || __ARMCC_VERSION >= 6000000 ) -#if defined(__i386__) + +/* + * Disable use of the i386 assembly code below if option -O0, to disable all + * compiler optimisations, is passed, detected with __OPTIMIZE__ + * This is done as the number of registers used in the assembly code doesn't + * work with the -O0 option. + */ +#if defined(__i386__) && !defined(__OPTIMIZE__) #define MULADDC_INIT \ asm( \