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

Compilation fails with -mips16 flag #9772

Open
andreaskse opened this issue Nov 12, 2024 · 0 comments
Open

Compilation fails with -mips16 flag #9772

andreaskse opened this issue Nov 12, 2024 · 0 comments
Labels
bug help-wanted This issue is not being actively worked on, but PRs welcome.

Comments

@andreaskse
Copy link

Summary

When compiling with mips16 the assembler in bn_muil.h https://github.com/Mbed-TLS/mbedtls/blob/main/library/bn_mul.h
fails with error messsage:
[12%] Building C object library/CMakeFiles/mbedcrypto.dir/bignum_core.c.o cd /workspace/2UGW/ugw_sw/openwrt/build_dir/xRX500_BootCore/build_dir/target-mips_24kc_musl/mbedtls-3.6.2/library && /workspace/2UGW/ugw_sw/openwrt/build_dir/xRX500_BootCore/staging_dir/toolchain-mips_24kc_gcc-8.3.0_musl/bin/mips-openwrt-linux-musl-gcc -Dmbedcrypto_EXPORTS -I/workspace/2UGW/ugw_sw/openwrt/build_dir/xRX500_BootCore/build_dir/target-mips_24kc_musl/mbedtls-3.6.2/include -I/workspace/2UGW/ugw_sw/openwrt/build_dir/xRX500_BootCore/build_dir/target-mips_24kc_musl/mbedtls-3.6.2/library -I/workspace/2UGW/ugw_sw/openwrt/build_dir/xRX500_BootCore/build_dir/target-mips_24kc_musl/mbedtls-3.6.2/3rdparty/everest/include -I/workspace/2UGW/ugw_sw/openwrt/build_dir/xRX500_BootCore/build_dir/target-mips_24kc_musl/mbedtls-3.6.2/3rdparty/p256-m -I/workspace/2UGW/ugw_sw/openwrt/build_dir/xRX500_BootCore/build_dir/target-mips_24kc_musl/mbedtls-3.6.2/3rdparty/p256-m/p256-m -pipe -mno-branch-likely -mips32r2 -mtune=24kc -g -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result - msoft-float -mips16 -minterlink-mips16 -fmacro-prefix-map=/workspace/2UGW/ugw_sw/openwrt/build_dir/xRX500_BootCore/build_dir/target-mips_24kc_musl/mbedtls-3.6.2=mbedtls-3.6.2 -Wformat -Werror=format-security -fpic -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wl,-z,now -Wl,-z,relro -Wall -Wextra -Wwrite-strings -Wmissing-prototypes -Wformat=2 -Wno-format-nonliteral -Wvla -Wlogical-op -Wshadow -Wformat-signedness -Wformat-overflow=2 -Wformat-truncation -Werror -Wmissing-declarations -O2 -fPIC -std=c99 -o CMakeFiles/mbedcrypto.dir/bignum_core.c.o -c /workspace/2UGW/ugw_sw/openwrt/build_dir/xRX500_BootCore/build_dir/target-mips_24kc_musl/mbedtls-3.6.2/library/bignum_core.c {standard input}: Assembler messages: {standard input}:2982: Error: invalid operands lw $10,24($sp)'
{standard input}:2983: Error: invalid operands lw $11,28($sp)' {standard input}:2984: Error: invalid operands lw $12,32($sp)'
{standard input}:2985: Error: invalid operands lw $13,64($sp)' {standard input}:2986: Error: invalid operands lw $14,0($10)'
{standard input}:2987: Error: invalid operands multu $13,$14' {standard input}:2988: Error: unrecognized opcode addi $10,$10,4'
{standard input}:2989: Error: invalid operands mflo $14' ...

System information

Mbed TLS version (number or commit id): 3.6.2
Operating system and version: Ubuntu
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):
Additional environment information:

Expected behavior

Actual behavior

Steps to reproduce

Additional information

A workaround is to add __attribute__((nomips16)) to the function mbedtls_mpi_core_mla in bignum_core

@minosgalanakis minosgalanakis added bug help-wanted This issue is not being actively worked on, but PRs welcome. labels Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug help-wanted This issue is not being actively worked on, but PRs welcome.
Projects
Status: No status
Development

No branches or pull requests

2 participants