[LLVMdev] llvm-config --cxxflags is not consistent when building by cmake.
baldrick at free.fr
Sun Dec 9 00:59:19 PST 2012
Hi Óscar, I've opened PR14539 for this.
On 23/11/12 01:06, Óscar Fuentes wrote:
> Duncan Sands <baldrick at free.fr> writes:
>>> 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.
> From http://llvm.org/docs/CommandGuide/llvm-config.html :
> llvm-config makes it easier to build applications that use LLVM. It can
> print the compiler flags, linker flags and object libraries needed to
> link against LLVM.
> Print the C++ compiler flags needed to use LLVM headers.
> I think the above clears the question about the purpose of
> llvm-config. And I think you are right about -O2, -g etc. IMO
> -fno-exceptions and -fno-rtti are on almost the same category, because
> although the may be required for some uses, listing them on the output
> of --cxxflags may confuse the user by giving the idea that they are
> strictly required for using LLVM libraries, which is mostly false. It
> would be a bad thing if some user ends redesigning his compiler's
> implementation because he thinks that RTTI and exceptions are not
> Please note that LLVM uses RTTI and (IRC) exceptions on certain files,
> so the output of llvm-config --cxxflags wouldn't be valid for building
> LLVM itself!
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
More information about the llvm-dev