My new job is so awesome that I get 2 weeks of paid work time to work with a small team on a project of our choosing. It will most likely be coded in Go. Any ideas on what it could be that would be beneficial to Rust ecosystem?
No guarantees on whether it would be released to the public, but I could get something prototyped for you at least
Add support for modifying symbols in object files. Currently the Go standard library only supports parsing object files.
That may sound out of left field, but it would unlock using multiple different versions of a Rust crate which depends on a C library.
Obviously even better if it's in Rust rather than Go, but anything would be great.
I'm not sure I understand the task. Are we talking about .o files? What kind of modifications do you expect and what are the use cases?
Whatever the platform-specific object file format is. Mach-O for Mac, ELF for Linux, PE for Windows, etc. I think those three would be the biggest deal. Most crates probably don't target outside of those three.
And the modifications are simply symbol renaming.
The goal is to compile and then rename the objects in the object file with a custom prefix which is specific to this version of your crate.
E.g., say you have a crate called
foo. If you were compiling version 1.2.3 of that crate, you'd add the prefix
__FOO_1_2_3_ to all of the symbols. That way, two different object files build from the same library but built for different versions of the crate would have no overlapping symbols, and so linking would succeed.
That... sounds actually pretty trivial. Is there any reason it hasn't been done before?
Not sure why. I suspect it just wasn't needed for their use cases.
If you want more details on how this works - and the awful lengths you have to go to if you don't have object-file-level symbol renaming - see the README here: https://github.com/google/mundane/tree/master/boringssl
Why have I never heard of Mundane before? It actually looks very interesting
We haven't officially announced it yet. It's been on my back burner, but I got super swamped with other stuff recently.
Is mundane no longer developed on the fuschia git?
It is, but it's mirrored to GitHub.
And @Shnatsel, to give you a sense of how awesome it'd be to have object file symbol renaming, it took me probably a month of full time work to get the symbol renaming in Mundane working.
Part of that was adding symbol prefixing support to BoringSSL, and part of it was integrating it into Mundane. It was a giant PITA.
C build systems are always a giant PITA
I trust you've written the Go program to discover symbols as well?
Anyway, thanks for the input, I'll float that idea to the team
@Shnatsel productionize https://blog.filippo.io/rustgo/ ? :stuck_out_tongue_wink:
Why is that different from linking C libraries? Or that's somehow made a PITA in Go?
it avoids CGo and libffi and the associated overhead
Okay, that's pretty cool, but I'm not sure I can handle that much unsafety, and I have no clue how to debug what's going on. Still, that's neat. I'll float this idea
indeed it seems hard :dizzy: