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

BBQueue backing storage is put in .data instead of .bss #43

Closed
jonas-schievink opened this issue Dec 7, 2019 · 4 comments · Fixed by #44
Closed

BBQueue backing storage is put in .data instead of .bss #43

jonas-schievink opened this issue Dec 7, 2019 · 4 comments · Fixed by #44

Comments

@jonas-schievink
Copy link
Contributor

See jonas-schievink/rubble#100

This is a regression from 0.3.0 to 0.4.0.

@jonas-schievink
Copy link
Contributor Author

Hmm, https://github.com/rust-embedded/cortex-m-rt/issues/116 claims that MaybeUninit data will end up in .bss, but there was also rtic-rs/rtic#52 and rust-lang/rust#41315, which has apparently now been fixed, but maybe there is another rustc bug behind this?

@jamesmunns
Copy link
Owner

For reference, here is where I am explicitly zeroing the backing structure, and likely the source of why this is showing up in .data:

https://docs.rs/bbqueue/0.4.0/src/bbqueue/atomic.rs.html#127-128

@jamesmunns
Copy link
Owner

It's a little disappointing that the compiler isn't picking up that this is just zeroed in static (as bss) (or the optimizer decided that a memcpy is better than a memset)

@jamesmunns
Copy link
Owner

Also also for reference, I did try manually swapping the write_bytes call to a loop with a loop + ptr::write, and the generated code seemed the same, though I might need something more like https://github.com/japaric/r0/blob/master/src/lib.rs#L167-L176 to deter the optimizer, at the cost of a slower initialization.

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

Successfully merging a pull request may close this issue.

2 participants