Luba Tang
2012-Nov-21 13:09 UTC
[LLVMdev] llvm-config --cxxflags is not consistent when building by cmake.
Hi, We found `llvm-config --cxxflags' does not have -fno-exceptions -fno-rtti when using cmake to build LLVM. Does anyone know how to fix it? Best regards, Luba ---------- Forwarded message ---------- From: Luba Tang <lubatang at gmail.com> Date: 2012/11/21 Subject: Re: [MCLinker] Re: Major release - MCLinker 2.0.0 - RockBull To: mclinker at googlegroups.com Hi, We make sure the fault source is from llvm-config. When you build LLVM by cmake, cmake will add -fno-rtti to build LLVM for you. But there is something wrong on llvm-config. cmake does not add correct options in llvm-config. Best regards, Luba 2012/11/21 Luba Tang <lubatang at gmail.com>> Hi, Kito, > > Did you ever use --enable-expensive-checks when you configure LLVM? > > ${LLVM_BUILD}/configure --enable-expensive-checks > > or > > _GLIBCXX_DEBUG > > is in your environment? > > This will enable RTTI for LLVM > > > 2012/11/21 Kito Cheng <kito at 0xlab.org> > >> > Hi, Kito, >> > >> > I check the trunk r168413, `llvm-config --cxxflags' shows >> > -I/Users/lubatang/SysRoot/include -D_DEBUG -D_GNU_SOURCE >> > -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -g >> > -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -fno-common >> > -Woverloaded-virtual -Wcast-qual >> > >> > And -fno-rtti really in our compilation flags. >> > >> > The other possibility is llvm::MachineFunctionPass declares a virtual >> > function but without implementation. >> > I check the newest LLVM, and I'm sure all member functions are >> implemented. >> >> Wow, it's not in my llvm-config --cxxflags...XD >> >> [kito at iCare ~]$ llvm-config --cxxflags >> -I/home/kito/include -fPIC -fvisibility-inlines-hidden -O3 -DNDEBUG >> -D_GNU_SOURCE -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic >> -Wno-long-long -Wcovered-switch-default -D__STDC_CONSTANT_MACROS >> -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS >> >> fedora 16 x86_64 + clang/llvm trunk(r168418), and compile clang/llvm by >> it self. >> > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121121/71e7e109/attachment.html>
Óscar Fuentes
2012-Nov-22 08:41 UTC
[LLVMdev] llvm-config --cxxflags is not consistent when building by cmake.
Luba Tang <lubatang at gmail.com> writes:> We found `llvm-config --cxxflags' does not have -fno-exceptions -fno-rtti > when using cmake to build LLVM. > Does anyone know how to fix it?Using -fno-rtti and -fno-exceptions is an internal LLVM policy. There is no reason to impose it on client code.
Duncan Sands
2012-Nov-22 09:55 UTC
[LLVMdev] llvm-config --cxxflags is not consistent when building by cmake.
Hi Óscar, On 22/11/12 09:41, Óscar Fuentes wrote:> Luba Tang <lubatang at gmail.com> writes: > >> We found `llvm-config --cxxflags' does not have -fno-exceptions -fno-rtti >> when using cmake to build LLVM. >> Does anyone know how to fix it? > > Using -fno-rtti and -fno-exceptions is an internal LLVM policy. There is > no reason to impose it on client code.actually it does impact external code. For example dragonegg does #include "llvm/Support/PluginLoader.h" This file contains // This causes operator= above to be invoked for every -load option. static cl::opt<PluginLoader, false, cl::parser<std::string> > LoadOpt("load", cl::ZeroOrMore, cl::value_desc("pluginfilename"), cl::desc("Load the specified plugin")); If dragonegg is compiled with RTTI then linking fails because there is no RTTI for the cl::opt class. Thus dragonegg is forced to compile with -fno-rtti if it wants to work with this part of LLVM. There is also the question of what `llvm-config --cxxflags` is supposed to mean. Is it supposed to give the flags that LLVM was compiled with? Or is it supposed to give the flags that users of LLVM must compile themselves with? If it's the second why does it have optimization levels (-O2), debug info (-g) and so on, which are not at all required for code using LLVM? To my mind the only thing that really makes sense if that `llvm-config --cxxflags` gives the flags that LLVM was compiled with, in which case it should contain -fno-rtti and -fno-exceptions because LLVM was compiled with those. Ciao, Duncan.
Possibly Parallel Threads
- [LLVMdev] llvm-config --cxxflags is not consistent when building by cmake.
- [LLVMdev] llvm-config --cxxflags is not consistent when building by cmake.
- [LLVMdev] llvm-config --cxxflags is not consistent when building by cmake.
- [LLVMdev] llvm-config --cxxflags is not consistent when building by cmake.
- [LLVMdev] CGO Tutorial on MCLinker and LLVM 2013 - Call for Participation