-
Notifications
You must be signed in to change notification settings - Fork 17
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
Rust binary (after objcopy) too large #6
Comments
Technical Details 2Playing around with
Here, Why is this not happening on C? Simply because the sections are not spread out that much:
So how can the section addressed be controlled? |
Ah, now I get it: icebreaker-litex-examples/rust/icebesoc-pac/memory.x Lines 1 to 13 in b5be086
The issue is that one part is the spiflash, the other one the RAM but everything must be one chunk for the flashing process (or at least the way it is implemented). So two question now remain:
|
I observed the issue with On my machine right now:
Probably something is wrong with |
This seems to be a known (and fixed) issue: rust-lang/rust#73201 |
Thanks a lot for investigating. I'll try out the Rust beta (which by now should contain the fix) next week and will report my findings. I can confirm that I'm using the Arch Linux toolchain, not the one SiFive provides. So if the Rust beta does not fix the issue, I will try to change that and see if that helps. |
Turns out that the behavior I saw before with ArchLinux toolchain is a different story... It worked like that long before May 2020. As for the issue described here, I can reproduce it with any toolchain I have. |
Abstract
The binary that is flashed via the rust example is over 250MB large, too large for the target system. The C example does NOT suffer from this issue.
Reproduction
cd r-riscv-blink
cargo build --release
(although the issue also exists w/o the release flag)Technical Details
So while the input ELF (
r-riscv-blink
) has a somewhat expected size for an unstripped Rust program, the output binary (r-riscv-blink.bin
) is just huge. If we look at the ELF file:Nothing too large here (largest is
.text.dummy
with 256kB). However, what is bizzare is the following:This looks much better. Is the stack section somewhat broken? Version info:
The text was updated successfully, but these errors were encountered: