[LLVMdev] Problem linking class to a pass in a loadable module

Henrique Santos hnsantos at gmx.com
Thu Feb 28 13:58:31 PST 2013


Check out the bug report at http://llvm.org/bugs/show_bug.cgi?id=13144  and try adding KEEP_SYMBOLS := 1 to tools/opt/Makefile like the OP suggests.
Good luck.
----- Original Message -----
From: Raphael Ernani Rodrigues
Sent: 02/28/13 05:59 PM
To: LLVM Developers Mailing List
Subject: Problem linking class to a pass in a loadable module

Dear LLVMers, I have a class X that represents a set of Value* in a specific way. That class is stored in two files: X.cpp and X.h The class X works perfectly in a pass that I already have. However, I need to use that class in some other passes, but I don't want to have a copy of X.cpp and X.h in every pass folder. I've tried to do the following: - put X.h in the folder <llvm_root>/include/lllvm/Analysis - put X.cpp in the folder <llvm_root>/lib/Analysis - go to <llvm_root> and execute "make", to compile everything again, with my new files - change the includes of my passes to replace #include "X.h" by #include "llvm/Analysis/X.h" - compile my pass again Until this point everything works fine. Although everything compiles without any warnings, I can't run my pass after I change the location of the source code of the class X. When I use the command: raphael at ubuntu:~/$ opt -f -load myPassModule.so -myPass test.bc I get the following error message: opt: symbol lookup error: /ho!
 st/Raphael/bin/llvm-3.2/Release+Asserts/bin/../lib/myPassModule.so: undefined symbol: _ZN4llvm5GraphC1Ei I know that this error message means that X.h was successfully linked to myPass, but when I call opt, opt can't find the actual implementation of the class and the methods declared in the header file. Does anybody know what I did wrong or what I should do to make this work?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130228/2596fc5d/attachment.html>


More information about the llvm-dev mailing list