Skip to content
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

No longer need librustc_llvm::static_link_hack_this_sucks? #19321

Closed
mystor opened this issue Nov 25, 2014 · 0 comments · Fixed by #22408
Closed

No longer need librustc_llvm::static_link_hack_this_sucks? #19321

mystor opened this issue Nov 25, 2014 · 0 comments · Fixed by #22408
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@mystor
Copy link
Contributor

mystor commented Nov 25, 2014

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.

@kmcallister kmcallister added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. C-cleanup Category: PRs that clean code up or issues documenting cleanup. labels Jan 28, 2015
@kmcallister kmcallister changed the title Potentially unnecessary code in librustc_llvm No longer need librustc_llvm::static_link_hack_this_sucks? Jan 28, 2015
steveklabnik added a commit to steveklabnik/rust that referenced this issue Feb 16, 2015
Manishearth added a commit to Manishearth/rust that referenced this issue Feb 17, 2015
Fixes rust-lang#19321

... I think? `make check` passes, but I'm not 100% sure that there's a test for that behavior. Thoughts?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants