[LLVMdev] Symbol not found in opt when using own pass

Luke Dalessandro luked at cs.rochester.edu
Tue Apr 7 07:03:11 PDT 2009


James Stanier wrote:
> Hi everyone,
> 
> I have a terrible feeling I'm doing something really silly here, but I can't
> seem to solve the problem after a day of trying now. I'm currently writing
> my own pass which I am running by loading it into the opt tool. Everything I
> had written in the pass so far had worked, until I started declaring an
> #include of some extra header files which I had written myself (they are
> objects for modeling a graph I am constructing):

Jamie, I've found that opt doesn't work quite right when using custom 
loaded modules. If you use the opt in the build bin directory rather 
than the installed one you shouldn't have this problem, i.e.,

   ~/path/to/build/Release/bin/opt -load whatever

rather than just

   opt -load whatever

I have absolutely no idea what the problem actually is, since the 
workaround works and I haven't felt the need to track anything down. I 
usually have a make target and set OPT appropriately.

Hope this works for you,
Luke

> 
> #include "VSDGNode.h"
> #include "VSDGPlace.h"
> #include "VSDGTransition.h"
> using namespace vsdg;
> 
> In my function for constructing my graph, I declare an object:
> 
>    VSDGTransition t;
> 
> however, at run-time, the pass fails with the following error:
> 
> dyld: lazy symbol binding failed: Symbol not found:
> __ZN4vsdg14VSDGTransitionC1Ev
>   Referenced from:
> /Users/js231/svn-check/js231/code/llvm-2.5/Release/lib/VSDGConstruct.0.0.0.dylib
>   Expected in: flat namespace
> 
> dyld: Symbol not found: __ZN4vsdg14VSDGTransitionC1Ev
>   Referenced from:
> /Users/js231/svn-check/js231/code/llvm-2.5/Release/lib/VSDGConstruct.0.0.0.dylib
>   Expected in: flat namespace
> 
> // Memory dump omitted...
> 
> Segmentation fault
> 
> Which seems to suggest that in the .dylib file the symbol cannot be found.
> However, actually looking at the .dylib file it appears to be in there. Is
> there some kind of linking problem with my pass, or is there something very
> stupid that I am or am not doing? I can provide any more information if
> needed, I just didn't want to make the post unreadable if it was an obvious
> answer.
> 
> Thanks very much, as ever.
> 
> James




More information about the llvm-dev mailing list