[LLVMdev] Porting pass from llvm 3.1 to 3.4

442 views
Skip to first unread message

Diogo Sampaio

unread,
Jul 2, 2014, 1:41:38 PM7/2/14
to llv...@cs.uiuc.edu
Dear llvmers

I'm trying to port some code that was written for llvm 3.1 to 3.4.2.
I'm having two linking problems and I couldn't find the source of the
problem. Usually it is an error for a virtual method not declared. The
error starts even when changing llvm version from 3.1 to 3.2.

The current line declaring an command line option:
-----
static cl::opt<string> InputFilename(cl::Positional, cl::Required,
cl::desc("<input bitcode file>"), cl::init("-"),
cl::value_desc("filename"));

And the class declaration:
class Ids : public ModulePass {
}
-----
Gives me these linking time errors:


cd /home/sampaio/3.2/ddg/build/tools/dynamic-graph && /usr/bin/cmake
-E cmake_link_script CMakeFiles/cdag_disk.dir/link.txt --verbose=1
/usr/bin/g++-4.6 CMakeFiles/cdag_disk.dir/cdag_disk.cxx.o -o
cdag_disk -rdynamic -L/home/sampaio/llvm/lib
../../lib/analysis/libddg-analysis.a -lLLVMBitReader -lLLVMAsmParser
-lLLVMAnalysis -lLLVMTarget -lLLVMCore -lLLVMMC -lLLVMObject
-lLLVMSupport -ldl -lpthread -lboost_iostreams-mt
-Wl,-rpath,/home/sampaio/llvm/lib:
CMakeFiles/cdag_disk.dir/cdag_disk.cxx.o:(.data.rel.ro._ZTIN4llvm2cl15OptionValueCopyISsEE[typeinfo
for llvm::cl::OptionValueCopy<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >]+0x10): undefined
reference to `typeinfo for llvm::cl::GenericOptionValue'
../../lib/analysis/libddg-analysis.a(Ids.cxx.o):(.data.rel.ro._ZTIN3ddg3IdsE[typeinfo
for ddg::Ids]+0x10): undefined reference to `typeinfo for
llvm::ModulePass'alue'

-----
Thank you very much
--
Diogo Nunes Sampaio
_______________________________________________
LLVM Developers mailing list
LLV...@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

Reid Kleckner

unread,
Jul 2, 2014, 4:09:27 PM7/2/14
to Diogo Sampaio, LLVM Developers Mailing List
Most likely LLVM is built with RTTI disabled, which LLVM does by the default, and your code is built with RTTI enabled.  Make sure the RTTI settings match.  The easiest fix for you is probably to add -fno-rtti to CFLAGS.

Markus Trippelsdorf

unread,
Jul 3, 2014, 2:26:19 AM7/3/14
to Reid Kleckner, LLVM Developers Mailing List
On 2014.07.02 at 13:02 -0700, Reid Kleckner wrote:
> Most likely LLVM is built with RTTI disabled, which LLVM does by the
> default, and your code is built with RTTI enabled. Make sure the RTTI
> settings match. The easiest fix for you is probably to add -fno-rtti to
> CFLAGS.

BTW on Linux "llvm-config --cxxflags" doesn't contain -fno-rtti, even if
LLVM is build with RTTI disabled.

Here's a patch I've found that fixes the issue:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20131014/191264.html

--
Markus

Diogo Sampaio

unread,
Jul 3, 2014, 1:50:23 PM7/3/14
to LLVM Developers Mailing List
Hi,

the rtti information helped, I was compiling the code without
-fno-rtti. As the code being ported uses boost library, that uses
typeid at some point, it was required to compile llvm without using
this flag. I don't know if it is a bug, but Cmake ignored the
REQUIRES_RTTI=1 flag, so I had to manually remove it from all
compiling configuration files it generated.

Thanks for the help.
Regards
Diogo

On Thu, Jul 3, 2014 at 8:22 AM, Markus Trippelsdorf
<mar...@trippelsdorf.de> wrote:
> On 2014.07.02 at 13:02 -0700, Reid Kleckner wrote:
>> Most likely LLVM is built with RTTI disabled, which LLVM does by the
>> default, and your code is built with RTTI enabled. Make sure the RTTI
>> settings match. The easiest fix for you is probably to add -fno-rtti to
>> CFLAGS.
>
> BTW on Linux "llvm-config --cxxflags" doesn't contain -fno-rtti, even if
> LLVM is build with RTTI disabled.
>
> Here's a patch I've found that fixes the issue:
> http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20131014/191264.html
>
> --
> Markus



--
Diogo Nunes Sampaio
Reply all
Reply to author
Forward
0 new messages