]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #30401 - DiamondLovesYou:pnacl-target, r=alexcrichton
authorbors <bors@rust-lang.org>
Sat, 19 Dec 2015 21:29:04 +0000 (21:29 +0000)
committerbors <bors@rust-lang.org>
Sat, 19 Dec 2015 21:29:04 +0000 (21:29 +0000)
r? @alexcrichton

1  2 
src/librustc_llvm/lib.rs

diff --combined src/librustc_llvm/lib.rs
index 8dcaa4b5064c18095c2ceeb61c48edb37f11b0c3,50539f35b7461b2619c25fc2a4aa3eb2bc95057b..ebb0caa0dfae22a2bfa04f8b5b95c0a91a580187
@@@ -616,7 -616,6 +616,7 @@@ extern 
                                               C: ContextRef)
                                               -> ModuleRef;
      pub fn LLVMGetModuleContext(M: ModuleRef) -> ContextRef;
 +    pub fn LLVMCloneModule(M: ModuleRef) -> ModuleRef;
      pub fn LLVMDisposeModule(M: ModuleRef);
  
      /// Data layout. See Module::getDataLayout.
      pub fn LLVMIsAAllocaInst(value_ref: ValueRef) -> ValueRef;
      pub fn LLVMIsAConstantInt(value_ref: ValueRef) -> ValueRef;
  
-     pub fn LLVMInitializeX86TargetInfo();
-     pub fn LLVMInitializeX86Target();
-     pub fn LLVMInitializeX86TargetMC();
-     pub fn LLVMInitializeX86AsmPrinter();
-     pub fn LLVMInitializeX86AsmParser();
-     pub fn LLVMInitializeARMTargetInfo();
-     pub fn LLVMInitializeARMTarget();
-     pub fn LLVMInitializeARMTargetMC();
-     pub fn LLVMInitializeARMAsmPrinter();
-     pub fn LLVMInitializeARMAsmParser();
-     pub fn LLVMInitializeAArch64TargetInfo();
-     pub fn LLVMInitializeAArch64Target();
-     pub fn LLVMInitializeAArch64TargetMC();
-     pub fn LLVMInitializeAArch64AsmPrinter();
-     pub fn LLVMInitializeAArch64AsmParser();
-     pub fn LLVMInitializeMipsTargetInfo();
-     pub fn LLVMInitializeMipsTarget();
-     pub fn LLVMInitializeMipsTargetMC();
-     pub fn LLVMInitializeMipsAsmPrinter();
-     pub fn LLVMInitializeMipsAsmParser();
-     pub fn LLVMInitializePowerPCTargetInfo();
-     pub fn LLVMInitializePowerPCTarget();
-     pub fn LLVMInitializePowerPCTargetMC();
-     pub fn LLVMInitializePowerPCAsmPrinter();
-     pub fn LLVMInitializePowerPCAsmParser();
      pub fn LLVMRustAddPass(PM: PassManagerRef, Pass: *const c_char) -> bool;
      pub fn LLVMRustCreateTargetMachine(Triple: *const c_char,
                                         CPU: *const c_char,
      pub fn LLVMRustGetModuleDataLayout(M: ModuleRef) -> TargetDataRef;
  }
  
+ #[cfg(have_component_x86)]
+ extern {
+     pub fn LLVMInitializeX86TargetInfo();
+     pub fn LLVMInitializeX86Target();
+     pub fn LLVMInitializeX86TargetMC();
+     pub fn LLVMInitializeX86AsmPrinter();
+     pub fn LLVMInitializeX86AsmParser();
+ }
+ #[cfg(have_component_arm)]
+ extern {
+     pub fn LLVMInitializeARMTargetInfo();
+     pub fn LLVMInitializeARMTarget();
+     pub fn LLVMInitializeARMTargetMC();
+     pub fn LLVMInitializeARMAsmPrinter();
+     pub fn LLVMInitializeARMAsmParser();
+ }
+ #[cfg(have_component_aarch64)]
+ extern {
+     pub fn LLVMInitializeAArch64TargetInfo();
+     pub fn LLVMInitializeAArch64Target();
+     pub fn LLVMInitializeAArch64TargetMC();
+     pub fn LLVMInitializeAArch64AsmPrinter();
+     pub fn LLVMInitializeAArch64AsmParser();
+ }
+ #[cfg(have_component_mips)]
+ extern {
+     pub fn LLVMInitializeMipsTargetInfo();
+     pub fn LLVMInitializeMipsTarget();
+     pub fn LLVMInitializeMipsTargetMC();
+     pub fn LLVMInitializeMipsAsmPrinter();
+     pub fn LLVMInitializeMipsAsmParser();
+ }
+ #[cfg(have_component_powerpc)]
+ extern {
+     pub fn LLVMInitializePowerPCTargetInfo();
+     pub fn LLVMInitializePowerPCTarget();
+     pub fn LLVMInitializePowerPCTargetMC();
+     pub fn LLVMInitializePowerPCAsmPrinter();
+     pub fn LLVMInitializePowerPCAsmParser();
+ }
+ #[cfg(have_component_pnacl)]
+ extern {
+     pub fn LLVMInitializePNaClTargetInfo();
+     pub fn LLVMInitializePNaClTarget();
+     pub fn LLVMInitializePNaClTargetMC();
+ }
  // LLVM requires symbols from this library, but apparently they're not printed
  // during llvm-config?
  #[cfg(windows)]
@@@ -2358,6 -2378,20 +2379,20 @@@ pub fn initialize_available_targets() 
      init_target!(have_component_aarch64 AArch64);
      init_target!(have_component_arm ARM);
      init_target!(have_component_x86 X86);
+     // PNaCl doesn't provide some of the optional target components, so we
+     // manually initialize it here.
+     #[cfg(have_component_pnacl)]
+     fn init_pnacl() {
+         unsafe {
+             LLVMInitializePNaClTargetInfo();
+             LLVMInitializePNaClTarget();
+             LLVMInitializePNaClTargetMC();
+         }
+     }
+     #[cfg(not(have_component_pnacl))]
+     fn init_pnacl() { }
+     init_pnacl();
  }
  
  // The module containing the native LLVM dependencies, generated by the build system