SergioBenitez / native_versioning

An experiment for simple versioning of C, C++, and assembly symbols in Rust code.
Apache License 2.0
2 stars 0 forks source link

For the C side: using llvm-objcopy? #1

Open est31 opened 5 years ago

est31 commented 5 years ago

Hi, I've just been pointed out the PR to ring and this is how I found this crate. It IMO solves a real problem in the Rust ecosystem that I ran into already multiple times.

As for using it, it seems quite unergonomic to me.

Apparently GNU objcopy from binutils has a feature to prefix all symbols by a given string. So for the C side: what about using that feature instead of the headers/macros/etc? Then you could essentially leave the way the C library is built alone.

Yes, Rust also targets non-gnu platforms. For these (or in general) we could use llvm-objcopy which seems to have the option to prefix symbols as well. What do you think?

est31 commented 5 years ago

Maybe just both could be provided to users of the crate: either using the C macros (less ergonomic), or using objcopy (less portable, but getting more portable in the future).

est31 commented 5 years ago

Hmmm it seems that the llvm-tools-preview rustup component already includes llvm-objcopy. It's available to users through the cargo-binutils crate.