[haskell-llvm] Make sure you include the correct TargetSelect.h and that InitializeAllTargetMCs() is being invoked!

Henning Thielemann lemming at henning-thielemann.de
Mon Apr 30 20:07:49 BST 2012


On Mon, 30 Apr 2012, Nathan Howell wrote:

> On Mon, Apr 30, 2012 at 10:05 AM, Henning Thielemann
> <lemming at henning-thielemann.de> wrote:
>> llvm-3.0-git/examples$ ./Align_dyn.exe
>> Align_dyn.exe: LLVMTargetMachine.cpp:123:
>> llvm::LLVMTargetMachine::LLVMTargetMachine(const llvm::Target&,
>> llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::Reloc::Model,
>> llvm::CodeModel::Model): Assertion `AsmInfo && "MCAsmInfo not initialized."
>> "Make sure you include the correct TargetSelect.h" "and that
>> InitializeAllTargetMCs() is being invoked!"' failed.
>> Abgebrochen
>
> The way initializeNativeTarget works in the main repo is broken for
> MCJIT targets. There needs to be a call to
> LLVMInitializeNativeTarget() instead of LLVMInitializeX86Target() to
> boot up the JIT/MCJIT. This should also work on pre-3.0 branches (at
> least as far back as 2.6) since it is the intended way to initialize
> the JIT.
>
> https://github.com/alphaHeavy/llvm/commit/5a4b509dee79abb60a0071c02c1e97bccd0e2c53

I have copied the changed lines from your patch manually into my llvm 
working copy. I wondered why you used a #def and did not write just:

foreign import ccall unsafe "LLVMInitializeNativeTarget" initializeNativeTarget :: IO CUInt


But it does not matter, I still get the following error, when running 
Align_dyn.exe:

Align_dyn.exe: LLVMTargetMachine.cpp:123: 
llvm::LLVMTargetMachine::LLVMTargetMachine(const llvm::Target&, 
llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::Reloc::Model, 
llvm::CodeModel::Model): Assertion `AsmInfo && "MCAsmInfo not 
initialized." "Make sure you include the correct TargetSelect.h" "and that 
InitializeAllTargetMCs() is being invoked!"' failed.



More information about the Haskell-llvm mailing list