<thejpster[m]>
a random idea popped into my head - instead of using the PAC to create singletons, each peripheral gets a macro that generates a specially named (non-mangled) static variable. Now the singleton nature of the peripheral is guarded by the linker and name collisions. If you want to share the peripheral, put it in a place where both the main thread function and the ISR function can see it.
<thejpster[m]>
dirbaio: are you using LTO? If so, codegen is performed by your linker. So maybe check which linker you are using, and that they are bit-for-bit the same? Maybe transfer all the object code from one machine to the other and try using the other machine's linker? Or even check if the object code is the same across the two machines?
sroemer has quit [Ping timeout: 252 seconds]
ben[m] has joined #rust-embedded
<ben[m]>
<hadez[m]> "I'm working with a ch32v203k8tx..." <- you should checkout `embedded-hal-bus`
limpkin has quit [Ping timeout: 252 seconds]
starblue has quit [Ping timeout: 265 seconds]
limpkin has joined #rust-embedded
starblue has joined #rust-embedded
Makarov has quit [Quit: Client closed]
Makarov has joined #rust-embedded
<thejpster[m]>
dirbaio: other ideas - does your tree compile any C code with `cc`? Is your C compiler the same?
<dirbaio[m]>
<thejpster[m]> "dirbaio: are you using LTO? If..." <- it's rust-lld, installed by rustup, and it's identical yep. it also reproduces without LTO though
<dirbaio[m]>
thejpster[m]: no C code, just Rust. (it does link precompiled .a libs from Nordic, but it also reproduces with the embassy examples which are pure rust so it's not that...)
<dirbaio[m]>
it seems it really is just rust itself
<dirbaio[m]>
asm code in the object files is different before linking, so it's not the linker
<thejpster[m]>
but it's the same rustc binary?
<thejpster[m]>
so rustc is pulling something from the environment, or it's one of the libraries it's linked to
<thejpster[m]>
you sure you don't have RUSTFLAGS="-Copt-level=3" ? ;)
<dirbaio[m]>
I also tried "transplanting" all env vars from arch to ubuntu, no change :D
<thejpster[m]>
you could replace rustc with a shell script that logs all environment and arguments to disk and then runs the real rustc
<thejpster[m]>
but we're getting desperate
<dirbaio[m]>
100% sure no rustflags. they would show up in rustc invocations in cargo -v...
<thejpster[m]>
I don't think they would
<thejpster[m]>
I think rustc reads them and not cargo?
<dirbaio[m]>
hmmmmm
<dirbaio[m]>
I think it's just a Cargo thing?
<dirbaio[m]>
rustc just reads argv
<dirbaio[m]>
at least all the docs I can find on RUSTFLAGS are Cargo, not rustc
<dirbaio[m]>
the annoying thing is Cargo puts different fingerprints on the artifacts
<dirbaio[m]>
so you can't simply hash them and compare
<thejpster[m]>
yeah, maybe you're right
<thejpster[m]>
what's the input to the fingerprint? weird that they aren't the same
<dirbaio[m]>
yeah actually that's a very good question
<dirbaio[m]>
i'm not sure exactly, it's a hash of everything that could cause changes to a crate
<thejpster[m]>
I guess you want "reproduceable builds with rust" or something
<dirbaio[m]>
version, deps, rustflags, rust version
<thejpster[m]>
uid 0, path is /rustc, etc.
<dirbaio[m]>
yeah i've tried googling, but everything I find always starts with "ensure you have same version of compiler, os, etc" 🫠
<dirbaio[m]>
I can already get reproducible builds if I use locally the same docker image CI uses
<dirbaio[m]>
I was just hoping that's avoidable
<dirbaio[m]>
I don't want bit-by-bit reproducible builds, I just want CI not to output a binary that's 10kb bigger than local :D
<Koen[m]>
Unreproducible builds as a service 😁
<thejpster[m]>
well, yeah, if the whole OS is part of making it repeatable than that begs the question ... why?
<thejpster[m]>
can it really be libz?
<dirbaio[m]>
exactly my question 😭
<JamesMunns[m]>
oh wait
<JamesMunns[m]>
change the paths dirbaio
<JamesMunns[m]>
try putting them all at some base /demo path
<dirbaio[m]>
docker on arch vs ubuntu, both with the repo mounted at /code, they still gave different results 🫠
<JamesMunns[m]>
damn
<dirbaio[m]>
lol so the path where rustc is installed changes the results
<JamesMunns[m]>
lolol
<dirbaio[m]>
arch was /home/dirbaio/.rustup, ubuntu was /home/ubuntu/.rustup
<dirbaio[m]>
changing ubuntu to /home/dirbaio
<dirbaio[m]>
now ubuntu is 100 bytes bigger than arch, instead of 10k bigger
<dirbaio[m]>
STILL different
<JamesMunns[m]>
I wonder if the bin path (and other weird metadata) acts as a hash/prng seed
<dirbaio[m]>
yea
<dirbaio[m]>
target/.rustc_info.json seems to imply hte path gets hashed
<dirbaio[m]>
that's how I found it
<JamesMunns[m]>
I know sometimes longer paths end up inhibiting opts sometimes just due to debuginfo size or other similiar shenanigans that make you run out of "optimizer fuel"
<dirbaio[m]>
* target/.rustc_info.json seems to imply the rustc path gets hashed
<dirbaio[m]>
the results don't change if I change the path where the repo is though
<JamesMunns[m]>
I know there was a reproducible builds project for rust at some point, that I think was able to do them in some controlled case?
<JamesMunns[m]>
might be worth hunting for that tracking issue, they've probably at least documented a bunch of things that can impact it