This is the seg fault I am getting.
dyld: lazy symbol binding failed: Symbol not found:
__ZN4llvm13IRBuilderBase18CreateGlobalStringEPKcRKNS_5TwineE
Referenced from:
/Users/georgebaah/llvm_dir/llvm-2.8/Debug+Asserts/lib/LLVMArrayBoundsCheck.dylib
Expected in: flat namespace
dyld: Symbol not found:
__ZN4llvm13IRBuilderBase18CreateGlobalStringEPKcRKNS_5TwineE
Referenced from:
/Users/georgebaah/llvm_dir/llvm-2.8/Debug+Asserts/lib/LLVMArrayBoundsCheck.dylib
Expected in: flat namespace
0 opt 0x0045e01c
llvm::SearchForAddressOfSpecialSymbol(char const*) + 284
1 opt 0x0045e61e llvm::sys::RunInterruptHandlers() +
354
2 libSystem.B.dylib 0x93bcb2bb _sigtramp + 43
3 libSystem.B.dylib 0xffffffff _sigtramp + 1816350063
4 libSystem.B.dylib 0x8fe18c2f _sigtramp + 18446744073644857759
5 LLVMArrayBoundsCheck.dylib 0x0102c9df
6 LLVMArrayBoundsCheck.dylib 0x0102ca95
7 LLVMArrayBoundsCheck.dylib 0x0102ce2c
8 LLVMArrayBoundsCheck.dylib 0x0102ceec
9 opt 0x003d265b
llvm::FPPassManager::doInitialization(llvm::Module&) + 63
10 opt 0x003d6062
llvm::FPPassManager::runOnModule(llvm::Module&) + 24
11 opt 0x003d5b4d
llvm::MPPassManager::runOnModule(llvm::Module&) + 375
12 opt 0x003d5d9c
llvm::PassManagerImpl::run(llvm::Module&) + 112
13 opt 0x003d5df5
llvm::PassManager::run(llvm::Module&) + 27
14 opt 0x0000d68e main + 4026
15 opt 0x00002146 start + 54
16 opt 0x00000005 start + 18446744073709543157
Stack dump:
0. Program arguments: opt -mem2reg -load
../llvm-2.8/Debug+Asserts/lib/LLVMArrayBoundsCheck.dylib -paa
1. Running pass 'Function Pass Manager' on module
'<stdin>'.
Segmentation fault
On Mon, Apr 4, 2011 at 11:33 PM, John Criswell <criswell at
illinois.edu>wrote:
> On 4/4/2011 6:26 PM, George Baah wrote:
>
> Hi Everyone,
> I am trying to construct the print statement :
printf("value:%d\n",
> value);
> This is my llvm code. It is seg faulting at
> builder.CreateGlobalStringPtr(str,"").
>
>
> This might be easier to debug with a stack trace. Use a debugger to see
> the call stack when the segfault occurs. Also try to isolate which pointer
> value is bad.
>
> As a guess, did you give the builder object all the information it needs to
> insert IR (e.g., which LLVM Module * it is modifying, which BasicBlock or
> Instruction it is to use when inserting instructions, etc)?
>
> -- John T.
>
>
> Thanks.
>
> George
>
> vector<const Type *> params;
> params.push_back(Type::getInt8PtrTy(M.getContext()));
> FunctionType *fType >
FunctionType::get(Type::getInt32Ty(M.getContext()), params, true);
> Constant *temp = M.getOrInsertFunction("printf",fType);
> if(!temp){
> errs() << "printf function not in symbol table\n";
> exit(1);
> }
> Function *f = cast<Function>(temp);
> f->setCallingConv(CallingConv::C);
>
> const char *str = "value: %d\n";
> Value *intparam = ...
> Value *strPtr = builder.CreateGlobalStringPtr(str,"");
> builder.CreateCall2(PrintF, strPtr, intparam,"tmp6");
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20110404/f0c3c93b/attachment.html>