From: Daniel Malea Date: Mon, 10 Dec 2012 21:05:57 +0000 (+0000) Subject: Enable RTTI for liblldbCore.a when GCC is the compiler X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=48b917bceb60f12c7158db8b56d4d5432dd50527;p=platform%2Fupstream%2Fllvm.git Enable RTTI for liblldbCore.a when GCC is the compiler - gcc does not like -fno-rtti mixed with dynamic_cast<> (in cxa_demangle.cpp) llvm-svn: 169767 --- diff --git a/lldb/lib/Makefile b/lldb/lib/Makefile index 5b1ec76..9f02129 100644 --- a/lldb/lib/Makefile +++ b/lldb/lib/Makefile @@ -67,6 +67,14 @@ USEDLIBS = lldbAPI.a \ lldbPluginPlatformLinux.a \ lldbPluginPlatformFreeBSD.a +# Because GCC requires RTTI enabled for lldbCore (see source/Core/Makefile) it is +# necessary to also link the clang rewriter libraries so vtable references can +# be resolved correctly, if we are building with GCC. +ifeq (g++,$(shell basename $(CXX))) + USEDLIBS += clangRewriteCore.a \ + clangRewriteFrontend.a +endif + include $(LLDB_LEVEL)/../../Makefile.config LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader bitwriter codegen \ diff --git a/lldb/source/Core/Makefile b/lldb/source/Core/Makefile index b7773e3..5278dc5 100644 --- a/lldb/source/Core/Makefile +++ b/lldb/source/Core/Makefile @@ -11,4 +11,15 @@ LLDB_LEVEL := ../.. LIBRARYNAME := lldbCore BUILD_ARCHIVE = 1 +# Enable RTTI on GCC builds because one source file in this directory +# (cxa_demangle.cpp) uses dynamic_cast<> and GCC (at least 4.6 and 4.7) +# complain if we try to compile it with -fno-rtti. This is somewhat of a +# kludge because it forces us to enable RTTI in liblldbUtility.a and also +# link in additional clang static libraries to resolve vtable references, +# but actually has negligible impact on (shard object) file size. +$(info shell basename CXX is $(shell basename $(CXX))) +ifeq (g++,$(shell basename $(CXX))) + REQUIRES_RTTI = 1 +endif + include $(LLDB_LEVEL)/Makefile diff --git a/lldb/source/Utility/Makefile b/lldb/source/Utility/Makefile index 13bcd83..3997da3 100644 --- a/lldb/source/Utility/Makefile +++ b/lldb/source/Utility/Makefile @@ -12,4 +12,11 @@ LIBRARYNAME := lldbUtility BUILD_ARCHIVE = 1 NO_PEDANTIC = 1 +# Enable RTTI on GCC builds because liblldbCore.a requires RTTI. +# See source/Core/Makefile for details. +ifeq (g++,$(shell basename $(CXX))) + REQUIRES_RTTI = 1 +endif + + include $(LLDB_LEVEL)/Makefile