wolfSSL / wolfssl

The wolfSSL library is a small, fast, portable implementation of TLS/SSL for embedded devices to the cloud. wolfSSL supports up to TLS 1.3 and DTLS 1.3!
https://www.wolfssl.com
GNU General Public License v2.0
2.22k stars 798 forks source link

20240624-arm-thumb-includes #7679

Closed douzzer closed 1 week ago

douzzer commented 1 week ago

src/include.am and configure.ac: build ARM thumb sources only on thumb builds, to avoid "ISO C forbids an empty translation unit".

motivated by this defect report:

[cross-armv7a-armasm-fips-140-3-ready-sp-all-testsuite-sanitizer] [210 of 264] [2312cb4563]
    setting up FIPS "ready"... done [fips="master" (0437f961f5), wolfCrypt=current OID under test (2312cb4563)]
    using armv7a-unknown-linux-gnueabihf-gcc 12.3.1
    configure...   real 0m19.219s  user 0m8.545s  sys 0m12.250s
    build...wolfcrypt/src/port/arm/thumb2-sha3-asm_c.c:1171: error: ISO C forbids an empty translation unit [-Werror=pedantic]

tested with wolfssl-multi-test.sh ... check-source-text cross-armv7a-all-armasm-testsuite-sanitizer cross-armv7a-armasm-fips-140-3-ready-sp-all-testsuite-sanitizer cross-aarch64-armasm-fips-140-3-dev-all-unittest-sanitizer

note, I added an optional thumb-armasm scenario to multi-test but couldn't get it to build -- oodles of assembler errors like this:

wolfcrypt/src/port/arm/thumb2-sha256-asm.S:164: Error: selected processor does not support `strd r4,r5,[sp,#32]' in Thumb mode
SparkiDev commented 1 week ago

The thumb2 code won't work with thumb only processors. Thumb2 instructions aren't really supported until ARMv7-M. For example the Cortex-M0/M0+/M1 which are ARMv6-M have some Thumb2 instructions. ARMv6 doesn't have Thumb2 instructions while ARMv6T2 does.

SparkiDev commented 1 week ago

https://github.com/wolfSSL/wolfssl/pull/7681

douzzer commented 1 week ago

closing in favor of #7681 and, as discussed, because this PR isn't quite the right idea.