Duncan,<br><br>I have this same issue using the 2.8 release in Linux.  The function <span style="font-family: courier new,monospace;">CreateGlobalString</span> is declared on line 150 of <span style="font-family: courier new,monospace;">llvm/Support/IRBuilder.h</span> in the <span style="font-family: courier new,monospace;">IRBuilderBase</span> class but without implementation:<br>
<br><span style="font-family: courier new,monospace;">  Value *CreateGlobalString(const char *Str = "", const Twine &Name = "");</span><br><br><span style="font-family: courier new,monospace;">CreateGlobalStringPtr</span> is implemented in terms of <span style="font-family: courier new,monospace;">CreateGlobalString</span> starting on line 818 of <span style="font-family: courier new,monospace;">llvm/Support/IRBuilder.h</span> in the <span style="font-family: courier new,monospace;">IRBuilder</span> class::<br>
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  /// CreateGlobalStringPtr - Same as CreateGlobalString, but return a pointer</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">  /// with "i8*" type instead of a pointer to array of i8.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  Value *CreateGlobalStringPtr(const char *Str = "", const Twine &Name = "") {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    Value *gv = CreateGlobalString(Str, Name);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    Value *zero = ConstantInt::get(Type::getInt32Ty(Context), 0);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    Value *Args[] = { zero, zero };</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    return CreateInBoundsGEP(gv, Args, Args+2, Name);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">  }</span><br style="font-family: courier new,monospace;"><br>The implementation of <span style="font-family: courier new,monospace;">CreateGlobalString</span> starts on line 25 of <span style="font-family: courier new,monospace;">lib/VMCore/IRBuilder.cpp</span>.  That file implements just one other function, <span style="font-family: courier new,monospace;">getCurrentFunctionReturnType</span>.  Attempting to call <span style="font-family: courier new,monospace;">getCurrentFunctionReturnType</span> has the same issue, it compiles but fails with <span style="font-family: courier new,monospace;">opt</span> due to the symbol being undefined.<br>
<br>However, there are stock transforms that successfully call these functions, for example <span style="font-family: courier new,monospace;">lib/Transforms/InstCombine</span>.  InstCombine is being built as a static library (using <span style="font-family: courier new,monospace;">BUILD_ARCHIVE</span>), whereas our transform is a loadable module.  Does that offer any clue as to the problem?  Perhaps we need to specify something for <span style="font-family: courier new,monospace;">LIBS</span> or <span style="font-family: courier new,monospace;">USEDLIBS</span> in our Makefile?<br>
<br>Thanks.<br><br>-Jake<br><br><div class="gmail_quote">On Tue, Apr 5, 2011 at 2:44 AM, Duncan Sands <span dir="ltr"><<a href="mailto:baldrick@free.fr">baldrick@free.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi George,<br>
<div class="im"><br>
> This is the seg fault I am getting.<br>
><br>
> dyld: lazy symbol binding failed: Symbol not found:<br>
> __ZN4llvm13IRBuilderBase18CreateGlobalStringEPKcRKNS_5TwineE<br>
>    Referenced from:<br>
> /Users/georgebaah/llvm_dir/llvm-2.8/Debug+Asserts/lib/LLVMArrayBoundsCheck.dylib<br>
>    Expected in: flat namespace<br>
><br>
> dyld: Symbol not found: __ZN4llvm13IRBuilderBase18CreateGlobalStringEPKcRKNS_5TwineE<br>
>    Referenced from:<br>
> /Users/georgebaah/llvm_dir/llvm-2.8/Debug+Asserts/lib/LLVMArrayBoundsCheck.dylib<br>
>    Expected in: flat namespace<br>
<br>
</div>this is quite a different kind failure to what I was imagining when you<br>
mentioned getting a segfault!  Indeed calling a function will clearly fail<br>
if that function doesn't exist.  I suggest you work out where in LLVM these<br>
symbols are defined (or determine that they are not defined anywhere) and<br>
then try to work out why your library wasn't linked with them.  Probably<br>
you forgot to link with the right LLVM library.<br>
<br>
Ciao, Duncan.<br>
<div><div></div><div class="h5">_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div></div></blockquote></div><br>