Jajoo, Malhar via llvm-dev
2017-May-23 12:18 UTC
[llvm-dev] Removing "fno-rtti" flag from llvm-config --cxxflags
Hi everyone, I just had a question - I am aware that LLVM supports it's own form of RTTI ( using dyn_cast<>() ,etc) but I wish to use C++ RTTI currently. I have tried building with "cmake -G "Unix Makefiles" -LLVM_ENABLE_RTTI=ON" but that doesnt seem to remove the "fno-rtti" flag from llvm-config and I still get an error when I try using "dynamic_cast<>" from C++ RTTI. Is there any way to remove the "fno-rtti" flag from the llvm-config ( seen on running "llvm-config --cxxflags" ) ? Thanks , Malhar -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170523/058504c7/attachment.html>
David Chisnall via llvm-dev
2017-May-23 12:29 UTC
[llvm-dev] Removing "fno-rtti" flag from llvm-config --cxxflags
On 23 May 2017, at 13:18, Jajoo, Malhar via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > Hi everyone, > > I just had a question - > > I am aware that LLVM supports it's own form of RTTI ( using dyn_cast<>() ,etc) but > I wish to use C++ RTTI currently. > > I have tried building with "cmake -G "Unix Makefiles" -LLVM_ENABLE_RTTI=ON" > but that doesnt seem to remove the "fno-rtti" flag from llvm-config > and I still get an error when I try using "dynamic_cast<>" from C++ RTTI.You missed the D. All CMake definition flags need this. Try: -DLLVM_ENABLE_RTTI=ON Also, I’d recommend using Ninja not Unix Makefiles. Note that LLVM did work quite well with programs using RTTI without enabling RTTI for LLVM until someone broke IR/Instructions.h about a year ago to remove the out-of-line definitions and force the vtable for several instructions to be emitted in every compilation unit including this file (i.e. a lot of them). This means that any file using RTTI that includes this header tries to emit a vtable with type info that refers to superclass objects defined elsewhere. Fixing this would make LLVM significantly more useful as a library. David
Reid Kleckner via llvm-dev
2017-May-23 14:13 UTC
[llvm-dev] Removing "fno-rtti" flag from llvm-config --cxxflags
Well, i removed the vtable from Value and Instruction recently, so that shouldn't be a problem anymore. On May 23, 2017 5:30 AM, "David Chisnall via llvm-dev" < llvm-dev at lists.llvm.org> wrote:> On 23 May 2017, at 13:18, Jajoo, Malhar via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > > > > Hi everyone, > > > > I just had a question - > > > > I am aware that LLVM supports it's own form of RTTI ( using dyn_cast<>() > ,etc) but > > I wish to use C++ RTTI currently. > > > > I have tried building with "cmake -G "Unix Makefiles" > -LLVM_ENABLE_RTTI=ON" > > but that doesnt seem to remove the "fno-rtti" flag from llvm-config > > and I still get an error when I try using "dynamic_cast<>" from C++ RTTI. > > You missed the D. All CMake definition flags need this. Try: > > -DLLVM_ENABLE_RTTI=ON > > Also, I’d recommend using Ninja not Unix Makefiles. > > Note that LLVM did work quite well with programs using RTTI without > enabling RTTI for LLVM until someone broke IR/Instructions.h about a year > ago to remove the out-of-line definitions and force the vtable for several > instructions to be emitted in every compilation unit including this file > (i.e. a lot of them). This means that any file using RTTI that includes > this header tries to emit a vtable with type info that refers to superclass > objects defined elsewhere. Fixing this would make LLVM significantly more > useful as a library. > > David > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170523/46bdefb2/attachment.html>
David Blaikie via llvm-dev
2017-May-23 17:35 UTC
[llvm-dev] Removing "fno-rtti" flag from llvm-config --cxxflags
On Tue, May 23, 2017 at 5:30 AM David Chisnall via llvm-dev < llvm-dev at lists.llvm.org> wrote:> On 23 May 2017, at 13:18, Jajoo, Malhar via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > > > > Hi everyone, > > > > I just had a question - > > > > I am aware that LLVM supports it's own form of RTTI ( using dyn_cast<>() > ,etc) but > > I wish to use C++ RTTI currently. > > > > I have tried building with "cmake -G "Unix Makefiles" > -LLVM_ENABLE_RTTI=ON" > > but that doesnt seem to remove the "fno-rtti" flag from llvm-config > > and I still get an error when I try using "dynamic_cast<>" from C++ RTTI. > > You missed the D. All CMake definition flags need this. Try: > > -DLLVM_ENABLE_RTTI=ON > > Also, I’d recommend using Ninja not Unix Makefiles. > > Note that LLVM did work quite well with programs using RTTI without > enabling RTTI for LLVM until someone broke IR/Instructions.h about a year > ago to remove the out-of-line definitions and force the vtable for several > instructions to be emitted in every compilation unit including this file > (i.e. a lot of them).FWIW that is inconsistent with the LLVM coding conventions (which ask that every class with a vtable have a non-inline anchor function) so patches I think would be welcome to fix any case where it comes up - though LLVM's far from -Wweak-vtable clean (but if it were made clean, and then the warning were enabled - it'd probably stay fairly clean, I think).> This means that any file using RTTI that includes this header tries to > emit a vtable with type info that refers to superclass objects defined > elsewhere. Fixing this would make LLVM significantly more useful as a > library. > > David > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170523/7ff0aab4/attachment.html>