-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Building v3.2.1 on ARM fails #6089
Building v3.2.1 on ARM fails #6089
Comments
Could you please give us the output of And which version of Mbed TLS were you using previously, or is this the first time you have tried? Update: on my own RPi 4:
|
/etc/os-release: uname -a: cc --version: Before 3.2.1, I used 3.1.0. |
Never mind this issue. It seems the mbed TLS building has changed. Need to address that too in my building scripts. |
Hmm, actually this does seem to be an issue when compiling with optimisation (i.e. anything > |
Yes, for some reason, this used to work, but now on a Pi no more... option(USE_STATIC_MBEDTLS_LIBRARY "Build mbed TLS static library." off) |
Yes, these changes are optimisations introduced in April 2022 in #5706 |
I don't understand what's said in #5706, I just wanna be able to use a TLS library. ;) |
Thanks for the report @Aethedor. A change was made to a piece of assembly under the assumption that this assembly would be used on M-profile systems only, but strangely (I don't know if intentionally, initially), it was also used and valid on Armv7-A systems. The change, however, was strictly M-profile only, and that's what's leading to the issue you're seeing. I guess the solution will be to reintroduce an A-class version of the code under correct compile time guards. |
If you have a patch that needs testing, let me know. |
Within the M-profile of the Arm architecture, some instructions admit both a 16-bit and a 32-bit encoding. For those instructions, some assemblers support the use of the .n (narrow) and .w (wide) suffixes to force a choice of instruction encoding width. Forcing the size of encodings may be useful to ensure alignment of code, which can have a significant performance impact on some microarchitectures. It is for this reason that a previous commit introduced explicit .w suffixes into what was believed to be M-profile only assembly in library/bn_mul.h. This change, however, introduced two issues: - First, the assembly block in question is used also for Armv7-A systems, on which the .n/.w distinction is not meaningful (all instructions are 32-bit). - Second, compiler support for .n/.w suffixes appears patchy, leading to compilation failures even when building for M-profile targets. This commit removes the .w annotations in order to restore working code, deferring controlled re-introduction for the sake of performance. Fixes Mbed-TLS#6089. Signed-off-by: Hanno Becker <[email protected]>
@hanno-arm The changes to bn_mul.h are as I mentioned in the first post. That works for me. Good to hear that my manual patch is indeed the right one. |
@Aethedor This is rather a workaround than the final solution -- the suffixes serve performance optimization purposes for M-class code, but compiler support seem brittle so we're removing them for now. |
Within the M-profile of the Arm architecture, some instructions admit both a 16-bit and a 32-bit encoding. For those instructions, some assemblers support the use of the .n (narrow) and .w (wide) suffixes to force a choice of instruction encoding width. Forcing the size of encodings may be useful to ensure alignment of code, which can have a significant performance impact on some microarchitectures. It is for this reason that a previous commit introduced explicit .w suffixes into what was believed to be M-profile only assembly in library/bn_mul.h. This change, however, introduced two issues: - First, the assembly block in question is used also for Armv7-A systems, on which the .n/.w distinction is not meaningful (all instructions are 32-bit). - Second, compiler support for .n/.w suffixes appears patchy, leading to compilation failures even when building for M-profile targets. This commit removes the .w annotations in order to restore working code, deferring controlled re-introduction for the sake of performance. Fixes Mbed-TLS#6089. Signed-off-by: Hanno Becker <[email protected]>
Within the M-profile of the Arm architecture, some instructions admit both a 16-bit and a 32-bit encoding. For those instructions, some assemblers support the use of the .n (narrow) and .w (wide) suffixes to force a choice of instruction encoding width. Forcing the size of encodings may be useful to ensure alignment of code, which can have a significant performance impact on some microarchitectures. It is for this reason that a previous commit introduced explicit .w suffixes into what was believed to be M-profile only assembly in library/bn_mul.h. This change, however, introduced two issues: - First, the assembly block in question is used also for Armv7-A systems, on which the .n/.w distinction is not meaningful (all instructions are 32-bit). - Second, compiler support for .n/.w suffixes appears patchy, leading to compilation failures even when building for M-profile targets. This commit removes the .w annotations in order to restore working code, deferring controlled re-introduction for the sake of performance. Fixes Mbed-TLS#6089. Signed-off-by: Hanno Becker <[email protected]>
Summary
I tried to build the Hiawatha webserver, which uses mbed TLS, on a Raspberry Pi v4. It fails with errors like these:
/tmp/ccWJfJUb.s:3868: Error: unexpected character
w' in type specifier /tmp/ccWJfJUb.s:3868: Error: bad instruction
ldr.w r5,[r3]'/tmp/ccWJfJUb.s:3870: Error: unexpected character
w' in type specifier /tmp/ccWJfJUb.s:3870: Error: bad instruction
str.w r5,[r3],#4'System information
Mbed TLS version (number or commit id): 3.2.1
Operating system and version: Raspberry Pi v4
Configuration (if not default, please attach
mbedtls_config.h
):Compiler and options (if you used a pre-built binary, please indicate how you obtained it):
Additional environment information:
Expected behavior
Compliation successful
Actual behavior
Compilation failed
Steps to reproduce
Compile Hiawatha v11.2 on a Raspberry Pi.
https://www.hiawatha-webserver.org/files/hiawatha-11.2.tar.gz
Additional information
In bn_mul.h, I changed ldr.w and str.w to ldr and str at line 752 and further. That solved my issue.
The text was updated successfully, but these errors were encountered: