jfsimon has quit [Remote host closed the connection]
jfsimon has joined #rust-embedded
jfsimon has quit [Remote host closed the connection]
jfsimon has joined #rust-embedded
Rahix has quit [Server closed connection]
Rahix has joined #rust-embedded
jfsimon has quit [Remote host closed the connection]
jfsimon has joined #rust-embedded
jfsimon has quit [Remote host closed the connection]
jfsimon has joined #rust-embedded
jfsimon has quit [Remote host closed the connection]
jfsimon has joined #rust-embedded
jfsimon has quit [Remote host closed the connection]
jfsimon has joined #rust-embedded
jfsimon has quit [Remote host closed the connection]
jfsimon has joined #rust-embedded
jfsimon has quit [Remote host closed the connection]
jfsimon has joined #rust-embedded
jfsimon has quit [Max SendQ exceeded]
jfsimon has joined #rust-embedded
glitchy has quit [Remote host closed the connection]
glitchy has joined #rust-embedded
sroemer has joined #rust-embedded
<Kaspar[m]>
<DavidBrown[m]> Maybe someone here has some ideas. In one project I'm working on, the underlying OS does initialization through an array of structs that are linked in the same section. I can make this work by using #[link_section...], and #[used] to make sure the symbol ends up there. The problem is that it...
<Kaspar[m]>
there is an unstable `#[used(linker)]` that solves this. alternatively, you can use an added linker script that marks the section `used`. without, linking is not guaranteed...
jfsimon has quit [Remote host closed the connection]
richardeoin has quit [Server closed connection]
richardeoin has joined #rust-embedded
jfsimon has joined #rust-embedded
dirbaio[m] has joined #rust-embedded
<dirbaio[m]>
<Kaspar[m]> there is an unstable `#[used(linker)]` that solves this. alternatively, you can use an added linker script that marks the section `used`. without, linking is not guaranteed...
<Kaspar[m]>
<dirbaio[m]> Are you using an old rustc? In 1.89 "used" is equivalent to "used(linker)"...
<Kaspar[m]>
wow, I missed that. probably allows us to us drop one of the linker scripts!
jfsimon has quit [Remote host closed the connection]
jfsimon has joined #rust-embedded
dkm has joined #rust-embedded
jfsimon has quit [Remote host closed the connection]
jfsimon has joined #rust-embedded
jfsimon has quit [Remote host closed the connection]
jfsimon has joined #rust-embedded
jfsimon has quit [Remote host closed the connection]
diondokter[m] has quit [Quit: Idle timeout reached: 172800s]
jfsimon has joined #rust-embedded
jfsimon has quit [Remote host closed the connection]
jfsimon has joined #rust-embedded
jfsimon has quit [Remote host closed the connection]
jfsimon has joined #rust-embedded
jfsimon has quit [Remote host closed the connection]
jfsimon has joined #rust-embedded
<DavidBrown[m]>
So, the section is 'KEEP' in the linker script. And I'm using #[used] with 1.89. It does seem that with codegen-units = 1, as long as something brings the entire crate in (I call a C function in lib.rs from the C code. So, I think this will at least work. But, with the default codegen-units, the compiler breaks the crate in a large number of separate .o files inside the archive, and parts that aren't directly referenced
<DavidBrown[m]>
get left out, don't have there init blocks. It, for example, means that something like a logger init that doesn't otherwise get called doesn't happen (things that are referenced from rust, like critical section, or global allocator do see to be brought in).
<DavidBrown[m]>
ChatGPT helpfully recommended I just have a tree of init functions I call into each of these modules, which kind of defeats the point of using the underlying kernel's init mechanism.
jfsimon has quit [Remote host closed the connection]
jfsimon has joined #rust-embedded
stgl has quit [Server closed connection]
stgl has joined #rust-embedded
andar1an has joined #rust-embedded
<Kaspar[m]>
<DavidBrown[m]> So, the section is 'KEEP' in the linker script. And I'm using #[used] with 1.89. It does seem that with codegen-units = 1, as long as something brings the entire crate in (I call a C function in lib.rs from the C code. So, I think this will at least work. But, with the default codegen-units...
<Kaspar[m]>
If the crate is otherwise unused, does `use your_crate as _;` help?
<DavidBrown[m]>
Kaspar[m]: Without codegen-units = 0, it doesn't help. With it, it is probably enough to bring the code in, not sure what symbol the use references. With linker gc on, it seems to pretty aggressively eliminate symbols.
<JamesMunns[m]>
<DavidBrown[m]> So, the section is 'KEEP' in the linker script. And I'm using #[used] with 1.89. It does seem that with codegen-units = 1, as long as something brings the entire crate in (I call a C function in lib.rs from the C code. So, I think this will at least work. But, with the default codegen-units...
<JamesMunns[m]>
Just checking, is your static pub and/or no_mangle?
<JamesMunns[m]>
<DavidBrown[m]> So, the section is 'KEEP' in the linker script. And I'm using #[used] with 1.89. It does seem that with codegen-units = 1, as long as something brings the entire crate in (I call a C function in lib.rs from the C code. So, I think this will at least work. But, with the default codegen-units...
<JamesMunns[m]>
If the static is "private" from Rust's perspective, and it can see that no one is using it, it is generally free to assume that it can be removed
andar1an has quit [Quit: andar1an]
andar1an has joined #rust-embedded
andar1an has quit [Remote host closed the connection]
andar1an has joined #rust-embedded
<DavidBrown[m]>
<JamesMunns[m]> If the static is "private" from Rust's perspective, and it can see that no one is using it, it is generally free to assume that it can be removed
<DavidBrown[m]>
Isn't `#[used]` though supposed to keep the symbol. This just seems like an interesting consequence of the multiple codegen units.
<Kaspar[m]>
<DavidBrown[m]> Isn't `#[used]` though supposed to keep the symbol. This just seems like an interesting consequence of the multiple codegen units.
<Kaspar[m]>
If it is private, there might not be a symbol.
<DavidBrown[m]>
Kaspar[m]: So, it does seem to show up in an object, and it is just a matter of making sure that the linker decides to bring that object in.
Noah[m]1 has quit [Quit: Idle timeout reached: 172800s]
andar1an has quit [Remote host closed the connection]
<Mihael[m]>
They're all small buffers but i can't simply reuse one bigger buffer due to the nature of data output
<i509vcb[m]>
The mspm0 and imxrt-rs rooms both upgraded to 12, I think the new room addresses need to be setup for the space?
firefrommoonligh has joined #rust-embedded
<firefrommoonligh>
<Mihael[m]> So i have a question i couldn't really find a solution for myself......
<firefrommoonligh>
Yes. I would do static buffers.
<firefrommoonligh>
If you really need that... if you're not running out of memory, maybe defining them locally in the function as you're doing is fine?
<davidtwco[m]>
<adamgreig[m]> probably best if we can gather thoughts from everyone here and/or next week and try to summarise them, and in particular please don't post on the RFC itself if you're not a wg member (at this time)
<davidtwco[m]>
I don’t check Matrix too often but happy to answer small questions on the build-std RFC here too. It’s not necessarily written for the Rust user but rather the maintainers that need to implement it and understand its implications.