Skip to content

No longer need librustc_llvm::static_link_hack_this_sucks? #19321

Closed
@mystor

Description

@mystor

I noticed while browsing through the code that this function:

rust/src/librustc_llvm/lib.rs

Lines 2164 to 2210 in f1f6c12

// FIXME #15460 - create a public function that actually calls our
// static LLVM symbols. Otherwise the linker will just throw llvm
// away. We're just calling lots of stuff until we transitively get
// all of LLVM. This is worse than anything.
pub unsafe fn static_link_hack_this_sucks() {
LLVMInitializePasses();
LLVMInitializeX86TargetInfo();
LLVMInitializeX86Target();
LLVMInitializeX86TargetMC();
LLVMInitializeX86AsmPrinter();
LLVMInitializeX86AsmParser();
LLVMInitializeARMTargetInfo();
LLVMInitializeARMTarget();
LLVMInitializeARMTargetMC();
LLVMInitializeARMAsmPrinter();
LLVMInitializeARMAsmParser();
LLVMInitializeMipsTargetInfo();
LLVMInitializeMipsTarget();
LLVMInitializeMipsTargetMC();
LLVMInitializeMipsAsmPrinter();
LLVMInitializeMipsAsmParser();
LLVMRustSetLLVMOptions(0 as c_int,
0 as *const _);
LLVMPassManagerBuilderPopulateModulePassManager(0 as *mut _, 0 as *mut _);
LLVMPassManagerBuilderPopulateLTOPassManager(0 as *mut _, 0 as *mut _, False, False);
LLVMPassManagerBuilderPopulateFunctionPassManager(0 as *mut _, 0 as *mut _);
LLVMPassManagerBuilderSetOptLevel(0 as *mut _, 0 as c_uint);
LLVMPassManagerBuilderUseInlinerWithThreshold(0 as *mut _, 0 as c_uint);
LLVMWriteBitcodeToFile(0 as *mut _, 0 as *const _);
LLVMPassManagerBuilderCreate();
LLVMPassManagerBuilderDispose(0 as *mut _);
LLVMRustLinkInExternalBitcode(0 as *mut _, 0 as *const _, 0 as size_t);
LLVMLinkInMCJIT();
LLVMLinkInInterpreter();
extern {
fn LLVMLinkInMCJIT();
fn LLVMLinkInInterpreter();
}
}
was present in the source tree.

Curious as to the cause, I looked up issue #15460, and realized that it had been closed. I imagine that this hack is probably unnecessary now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-cleanupCategory: PRs that clean code up or issues documenting cleanup.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions