-
Notifications
You must be signed in to change notification settings - Fork 38
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
C functions arguments wrong alignment #171
Comments
Maybe esp-rs/esp-wifi-sys#16 is related. My experiments initially showed it might work correctly but it probably depends on the number of arguments |
This is a bug in the Xtensa port of LLVM. C.f. espressif/llvm-project#66. If you're responsible for compiling all of the code a workaround would be to compile the C portions with clang instead of GCC. |
Patch release is now available here: https://github.com/esp-rs/rust, builds are on the way. |
Builds are now available. Closing this issue. |
I'm binding a Rust function to a C function that takes 10 parameters. What I'm seeing now is some kind of misalignment where the parameters following the 7th parameter are misaligned by two bytes. We are using esp32 S3
To reproduce the issue please clone https://github.com/elotom/rust-esp32-std-demo/tree/c-parameters-align-issue
then run the following commands:
1.
xtensa-esp32s3-elf-gcc -Ilibtest_parameters -o c/test_parameters.o -c c/test_parameters.c
2.
xtensa-esp32s3-elf-ar csrDT c/libtest_parameters.a -c c/test_parameters.o
3. Flash your device with
cargo +esp espflash --target xtensa-esp32s3-espidf --release --monitor
The C function only returns param8
The Rust function calls test_parameters and I'm expecting a return value of 800 but I'm getting 900 instead

Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: