-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
[LLVM] Use the LLVMInitializeAllTargets* functions #34962
Comments
Do we get any benefits from this, if we still support older LLVM versions? cc @alexcrichton @badboy |
Primary benefit is an ability to target |
Secondary benefit is that it would not force the dynamically linked LLVM to actually provide all those targets (i.e. if some distro distributes LLVM which can only do some of the targets we currently hardcode). Of course that would introduce an error-case for this call which would need to be checked for and reported appropriately. |
Apparently the I adjusted the PR text to account for the new knowledge. |
Primary benefit of this change is that Rust now can support all LLVM targets which the LLVM that has been linked to supports. Namely, this if the system LLVM, which supports extra targets, is used, then rustc could also build code for them. Fixes rust-lang#34962
LLVM has the functions to initialize all supported targets already. We should get rid of this monstrosity and use the functions instead.
The problem is that these functions are currently
static inline
and thus have no symbol of their own. In order to be able to use them in rustc, we need to create a binding for it.For now the migration would look something like this:
RustLLVMInitializeAll{Targets,TargetInfos,TargetMCs,AsmPrinters,AsmParsers}
in rust_llvm. These would call thestatic inline
counterparts directly.initialize_available_targets
gets changed to call newly created wrappers;cc @rust-lang/compiler
I also would consider this as an
E-easy
issue. The general direction for fixing this issue are listed above and this issue would help to understand how LLVM initialisation works and how rustc ties into the LLVM.Once something like this patch lands and gets into all LLVM versions we support we could then remove the wrapper altogether.
The text was updated successfully, but these errors were encountered: