Skip to content

compiling Mbed TLS for cortex-m0 with optimization and ARMC6 compiler results in error #1077

@RonEld

Description

@RonEld

Description

  • Type: Bug
  • Priority: Major
    compilation error with ARMC6 toolchain, on cortex-m0 and optimization flag

Bug

OS
linux

mbed TLS build:
Version: 2.6.0
OS version: Ubuntu 16.04

ARMC6
Additional environment information:

Expected behavior
compilation to succeed
Actual behavior
compilation error:

./library/bignum.c:1130:9: error: inline assembly requires more registers than available
        MULADDC_INIT
        ^
./include/mbedtls/bn_mul.h:581:13: note: expanded from macro 'MULADDC_INIT'
            "ldr    r0, %3                      \n\t"   \
            ^
./library/bignum.c:1145:9: error: inline assembly requires more registers than available
        MULADDC_INIT
        ^

Steps to reproduce
compile using ARMC6 with optimization, such as -Os
Reproduces only for cortex-m0

armclang --target=arm-arm-none-eabi -Os -mthumb -Wno-armcc-pragma-push-pop -Wno-armcc-pragma-anon-unions -mcpu=cortex-m0 -march=armv7-m -I./include -D__ASSERT_MSG -std=gnu99 -o library/bignum.o ./library/bignum.c

Note:
Can be worked around using -DMULADDC_CANNOT_USE_R7 compilation flag, or without optimization flag, but this will compile without the assmebly optimization

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcomponent-cryptoCrypto primitives and low-level interfaceshelp-wantedThis issue is not being actively worked on, but PRs welcome.historical-reviewingCurrently reviewing (for legacy PR/issues)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions