Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR #5706 broke building for ARM Cortex A-9 VFPv3 #6124

Closed
tuxuser opened this issue Jul 23, 2022 · 1 comment
Closed

PR #5706 broke building for ARM Cortex A-9 VFPv3 #6124

tuxuser opened this issue Jul 23, 2022 · 1 comment

Comments

@tuxuser
Copy link

tuxuser commented Jul 23, 2022

Summary

Cleanup of ARM assembler code in bignum.c (PR #5706) broke building for ARM Cortex A9, VFPv3

System information

Mbed TLS version (number or commit id): v1.3.1, commit >= 46435f0, PR #5706
Operating system and version: Linux (Kernel headers v3.0.13) / Cross-toolchain
Configuration (if not default, please attach mbedtls_config.h): default
Compiler and options (if you used a pre-built binary, please indicate how you obtained it):

Cross-toolchain: ARM Cortex-A9 / VFPv3 / soft-fp
GCC 11.2.0

Additional environment information:

Toolchain tarball: https://github.com/openlgtv/buildroot-nc4/releases/tag/webos-9f5b1a1 (arm-webos-linux-gnueabi_sdk-buildroot.tar.gz)

BR2_ARCH="arm"
BR2_ENDIAN="LITTLE"
BR2_GCC_TARGET_ABI="aapcs-linux"
BR2_GCC_TARGET_CPU="cortex-a9"
BR2_GCC_TARGET_FPU="vfpv3"
BR2_GCC_TARGET_FLOAT_ABI="softfp"
BR2_GCC_TARGET_MODE="arm"
BR2_ARM_ENABLE_NEON=y
BR2_ARM_ENABLE_VFP=y
BR2_ARM_EABI=y
BR2_ARM_FPU_VFPV3=y

Expected behavior

mbedtls should compile the bignum-module successfully.

Actual behavior

Build fails, ARM opcode ldr.w ˋstr.wˋ is not understood by the compiler:

/tmp/cc9bU4kd.s:1714: Error: unexpected character `w' in type specifier
/tmp/cc9bU4kd.s:1714: Error: bad instruction `ldr.w r5,[r2],#+8'

Full output:

# make
make[1]: Entering directory '/tmp/mbedtls_bignum_issue/mbedtls/library'
  CC    aes.c
  CC    aesni.c
  CC    aria.c
  CC    asn1parse.c
  CC    asn1write.c
  CC    base64.c
  CC    bignum.c
/tmp/ccgzTp3R.s: Assembler messages:
/tmp/ccgzTp3R.s:1523: Error: unexpected character `w' in type specifier
/tmp/ccgzTp3R.s:1523: Error: bad instruction `ldr.w r5,[r2],#+8'
/tmp/ccgzTp3R.s:1524: Error: unexpected character `w' in type specifier
/tmp/ccgzTp3R.s:1524: Error: bad instruction `ldr.w r6,[lr],#+8'
/tmp/ccgzTp3R.s:1525: Error: unexpected character `w' in type specifier
/tmp/ccgzTp3R.s:1525: Error: bad instruction `ldr.w r7,[r2,#-4]'
/tmp/ccgzTp3R.s:1526: Error: unexpected character `w' in type specifier
/tmp/ccgzTp3R.s:1526: Error: bad instruction `ldr.w r8,[lr,#-4]'
/tmp/ccgzTp3R.s:1529: Error: unexpected character `w' in type specifier
/tmp/ccgzTp3R.s:1529: Error: bad instruction `str.w r6,[lr,#-8]'
/tmp/ccgzTp3R.s:1530: Error: unexpected character `w' in type specifier
/tmp/ccgzTp3R.s:1530: Error: bad instruction `str.w r8,[lr,#-4]'
/tmp/ccgzTp3R.s:1532: Error: unexpected character `w' in type specifier
/tmp/ccgzTp3R.s:1532: Error: bad instruction `ldr.w r5,[r2],#+8'
/tmp/ccgzTp3R.s:1533: Error: unexpected character `w' in type specifier
/tmp/ccgzTp3R.s:1533: Error: bad instruction `ldr.w r6,[lr],#+8'
/tmp/ccgzTp3R.s:1534: Error: unexpected character `w' in type specifier
/tmp/ccgzTp3R.s:1534: Error: bad instruction `ldr.w r7,[r2,#-4]'
/tmp/ccgzTp3R.s:1535: Error: unexpected character `w' in type specifier
/tmp/ccgzTp3R.s:1535: Error: bad instruction `ldr.w r8,[lr,#-4]'
/tmp/ccgzTp3R.s:1538: Error: unexpected character `w' in type specifier
/tmp/ccgzTp3R.s:1538: Error: bad instruction `str.w r6,[lr,#-8]'
/tmp/ccgzTp3R.s:1539: Error: unexpected character `w' in type specifier
/tmp/ccgzTp3R.s:1539: Error: bad instruction `str.w r8,[lr,#-4]'
/tmp/ccgzTp3R.s:1541: Error: unexpected character `w' in type specifier
/tmp/ccgzTp3R.s:1541: Error: bad instruction `ldr.w r5,[r2],#+8'
/tmp/ccgzTp3R.s:1542: Error: unexpected character `w' in type specifier
/tmp/ccgzTp3R.s:1542: Error: bad instruction `ldr.w r6,[lr],#+8'
/tmp/ccgzTp3R.s:1543: Error: unexpected character `w' in type specifier
/tmp/ccgzTp3R.s:1543: Error: bad instruction `ldr.w r7,[r2,#-4]'
/tmp/ccgzTp3R.s:1544: Error: unexpected character `w' in type specifier
/tmp/ccgzTp3R.s:1544: Error: bad instruction `ldr.w r8,[lr,#-4]'
/tmp/ccgzTp3R.s:1547: Error: unexpected character `w' in type specifier
/tmp/ccgzTp3R.s:1547: Error: bad instruction `str.w r6,[lr,#-8]'
/tmp/ccgzTp3R.s:1548: Error: unexpected character `w' in type specifier
/tmp/ccgzTp3R.s:1548: Error: bad instruction `str.w r8,[lr,#-4]'
/tmp/ccgzTp3R.s:1550: Error: unexpected character `w' in type specifier
/tmp/ccgzTp3R.s:1550: Error: bad instruction `ldr.w r5,[r2],#+8'
/tmp/ccgzTp3R.s:1551: Error: unexpected character `w' in type specifier
/tmp/ccgzTp3R.s:1551: Error: bad instruction `ldr.w r6,[lr],#+8'
/tmp/ccgzTp3R.s:1552: Error: unexpected character `w' in type specifier
/tmp/ccgzTp3R.s:1552: Error: bad instruction `ldr.w r7,[r2,#-4]'
/tmp/ccgzTp3R.s:1553: Error: unexpected character `w' in type specifier
/tmp/ccgzTp3R.s:1553: Error: bad instruction `ldr.w r8,[lr,#-4]'
/tmp/ccgzTp3R.s:1556: Error: unexpected character `w' in type specifier
/tmp/ccgzTp3R.s:1556: Error: bad instruction `str.w r6,[lr,#-8]'
/tmp/ccgzTp3R.s:1557: Error: unexpected character `w' in type specifier
/tmp/ccgzTp3R.s:1557: Error: bad instruction `str.w r8,[lr,#-4]'
/tmp/ccgzTp3R.s:1567: Error: unexpected character `w' in type specifier
/tmp/ccgzTp3R.s:1567: Error: bad instruction `ldr.w r4,[r2],#4'
/tmp/ccgzTp3R.s:1568: Error: unexpected character `w' in type specifier
/tmp/ccgzTp3R.s:1568: Error: bad instruction `ldr.w r5,[lr]'
/tmp/ccgzTp3R.s:1570: Error: unexpected character `w' in type specifier
/tmp/ccgzTp3R.s:1570: Error: bad instruction `str.w r5,[lr],#4'
make[1]: *** [Makefile:289: bignum.o] Error 1
make[1]: Leaving directory '/tmp/mbedtls_bignum_issue/mbedtls/library'
make: *** [Makefile:18: lib] Error 2

Steps to reproduce

NOTE: Maybe distro-provided toolchains are also available that yield the same result via passing compile-flags, sorry for the tedious way of getting the toolchain env setup..

# Toolchain setup
mkdir /tmp/mbedtls_bignum_issue && cd /tmp/mbedtls_bignum_issue
wget https://github.com/openlgtv/buildroot-nc4/releases/download/webos-9f5b1a1/arm-webos-linux-gnueabi_sdk-buildroot.tar.gz
tar xf arm-webos-linux-gnueabi_sdk-buildroot.tar.gz
# Relocate toolchain
./arm-webos-linux-gnueabi_sdk-buildroot/relocate-sdk.sh

# Build mbedtls
git clone https://github.com/Mbed-TLS/mbedtls
cd mbedtls
source /tmp/mbedtls_bignum_issue/arm-webos-linux-gnueabi_sdk-buildroot/environment-setup
make

Additional information

Starting with this commit, before PR #5706

09dc05b Merge pull request #5635 from gilles-peskine-arm/psa-test-op-fail

building works again

@tuxuser
Copy link
Author

tuxuser commented Jul 24, 2022

Oops, totally missed it's already tracked in #6089

Closing

@tuxuser tuxuser closed this as completed Jul 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant