[LLVMdev] Why does `llvm-config --cxxflags` now include -fno-rtti ?

Matthieu Moy Matthieu.Moy at grenoble-inp.fr
Sun Mar 14 03:10:08 PDT 2010


Hi,

I'm trying to port a piece of code using LLVM as a library to the
latest SVN version.

One difference between 2.6 and 2.7svn is that `llvm-config --cxxflags`
now include -fno-rtti. Since my code does use RTTI information (in
non-trivial dynamic_cast), my code can't compile with this. Same goes
for -fexceptions.

I've tried setting my CXXFLAGS to `llvm-config --cxxflags` -frtti
-fexceptions, now my code compiles, but it doesn't link against LLVM,
giving error messages like:

undefined reference to `typeinfo for llvm::TargetMachine'
undefined reference to `typeinfo for llvm::MCAsmInfo'

(for classes inherinting from the classes named by the error messages)

So, I have two questions:

* What's the rationale for including -fno-rtti in `llvm-config
  --cxxflags`? Is this a bug? If not, it should be mentionned in the
  release notes for 2.7.

* How can a user (like me) of the LLVM library derive from LLVM
  classes and use rtti information?

Thanks,

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/



More information about the llvm-dev mailing list