-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Export LLVM init functions from rustc_llvm #35113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
Err, r? @alexcrichton Brain, work please. |
Out of curiosity, why do we want to actively export APIs? Seems like we would prefer the opposite, actively hiding them. |
@alexcrichton my primary motivation for this PR is llvm_build_utils crate. For its purposes I do not want to demand people to install system-wide LLVM or, even worse, build my own, because it is supposed to be just a lean utility for As far as stability goes, I’m very aware about all potential stability concerns – even the LLVM’s own C API is not stable and try to warn my users about unstability of the crate. Nobody would be able to complain even if librustc_llvm went away. |
This seems... like exactly what we don't want librustc_llvm.so to be used for? In the past we've tried supporting things like the executing engine and that just ended in sadness. Our LLVM is intended to be used by rustc and only rustc, and ideally we wouldn't expose any LLVM symbols and would internalize everything. cc @brson |
On its own merits, I think the patch makes sense. But from past experience I think we should actively discourage people from using our LLVM. Constantly-breaking APIs that people depend on are a nightmare. That said, I recognize that Rust puts great effort into making LLVM work and it would be nice if people writing compilers in Rust could benefit from that. The linked llvm_build_utils project worries me. With either in-tree or out-of-tree LLVM it will not have any stability guarantees. As written it looks oriented toward producing asm, not LLVM IR to be linked in with Rust's LLVM IR, but I'm still alarmed. Any attempt to use an out-of-tree LLVM to interop with Rust is in for a lot of pain because of bitcode drift. Any attempt to use an in-tree LLVM for interop with Rust is in for a lot of pain because of API drift. It could be even worse than the serde situation. |
Aww, that seems like a waste of space. On the other hand, when I put the goggles of a rustc dev, I fully understand and somewhat support this stance. Perhaps it would be a good idea to only ship a
That’s true. LLVM-IR format or LLVM instruction format may change slightly between LLVM versions (see this, for example), thus potentially making LLVM-IR supplied by to the crate incompatible with new LLVM versions. There’s nothing new about that.
As written, it takes LLVM-IR and produces an
Both IR-format and API drift apply equally to both out-of-tree and in-tree LLVM, provided only the |
Seems that our goal would indeed one day be exposing a shared library that has 0 exposed LLVM symbols, so perhaps we don't want to take this route of actively exporting new symbols from LLVM for now? |
Yeah, close this for me if you could. I'll submit some ideas about how to On Jul 31, 2016 10:20, "Alex Crichton" notifications@github.com wrote:
|
Previously these functions would’ve been not exposed in the dynamic libraries for some targets, despite them being regular LLVM API and having no reason to be hidden.
cc @alexcrichton