Recently murath submitted a pull request adding a new feature to rustc_llvm crate.
The added feature is not directly needed by rustc. @nrc opined that rustc_llvm should support features directly needed by rustc, and no more. And that more fully featured LLVM binding should be published on crates.io.
That is reasonable for people who want to use LLVM. But as murath replied on GitHub, it is of no use for people who want to use LLVM used by Rust. As far as I know, two different versions of LLVM have no compatibility guarantee whatsoever.
Possible solutions:
- Add features to rustc_llvm even if not needed by rustc. This is the easiest in the short term, but not ideal. For example, this ties LLVM binding to Rust release cycle.
- Fix LLVM version used by Rust, so other people can write code against it. To be useful, this ideally should be the version widely available as binary. But “system LLVM” versions do not agree between systems. Also, I think we would like to reserve the right to patch LLVM to fix bugs, instead of working around bugs. Although we have no such bug fixes right now, we had them in the past.
- In Rust binary releases and Rust installs from source, provide LLVM library one can link against. That is, install.sh and “make install” installs, say, libllvmForRust.so, and librustc_llvm-$hash.so uses it, instead of what is done now, static linking. JavaScriptCore does something similar: libllvmForJSC.so.
Thoughts?