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

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 <Matthieu.Moy@grenoble-inp.fr> writes:

[snip]

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?

This was discussed here some weeks (days?) ago. LLVM now defaults to
-fno-rtti. There is a setting for enabling RTTI while building LLVM.

Here's the recent discussion on this:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2010-February/029495.html

Summary: no-rtti speeds up LLVM compile time thus developers do not
want RTTI on by default, plus it makes the binaries a bit smaller.
Distro packagers are asked to enable it by default to allow using
LLVM better as a library.