Skip to content

[LLVM] Use the LLVMInitializeAllTargets* functions #34962

Closed
@nagisa

Description

@nagisa

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:

  • Implement RustLLVMInitializeAll{Targets,TargetInfos,TargetMCs,AsmPrinters,AsmParsers} in rust_llvm. These would call the static inline counterparts directly.
  • initialize_available_targets gets changed to call newly created wrappers;
  • Make sure our distribution LLVM is only compiled with the targets that we want to support (x86, ARM, Aarch64, MIPS, PNaCl);

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions