uniffi-rs icon indicating copy to clipboard operation
uniffi-rs copied to clipboard

FR: Support bitcode for library mode bindings generation

Open cerisier opened this issue 1 year ago • 0 comments
trafficstars

When using LTO and especially the -Clinker-plugin-lto option, object files are emitted as LLVM bitcode and not machine code.

Currently, uniffi_bindgen only supports proper machine code and fails to extract metadata from object files that contain LLVM bitcode and fails with a Unknown library format.

https://github.com/mozilla/uniffi-rs/blob/305454d6a451326f981ecfa295c78f154e85bb09/uniffi_bindgen/src/macro_metadata/extract.rs#L27-L35

Since the binary metadata extraction is currently solely based on goblin capabilities, I was wondering:

  1. Does it makes sense for uniffi to support bitcode ? a. Given that it contains all required metadata as in normal machine code.
  2. What would be the way to implement it as I am not sure that the goblin crate would accept bitcode support.

cerisier avatar Oct 02 '24 09:10 cerisier