[Lldb-commits] [lldb] r169767 - in /lldb/trunk: lib/Makefile source/Core/Makefile source/Utility/Makefile

Malea, Daniel daniel.malea at intel.com
Wed Dec 12 18:18:15 PST 2012


Hi,

After a little bit of research, I'm not sure we can rely on the system demangler library. On Ubuntu 12.04 (but probably also lots of distros) __cxa_demangle is available in the libsupc++ part of libstdc++ which is only provided as a static library :S

Maybe there's an alternative implementation we can use. For now though, I think it's safest to not require linking LLDB to any such static libraries...


Dan


On 2012-12-11, at 8:27 PM, "Malea, Daniel" <daniel.malea at intel.com> wrote:

> Hi Chris, thanks for the note; I like the simpler approach you suggest.
> 
> I tried it out and it seems to work on Linux with both clang/gcc. Unless someone has any concerns, I will revert r169767 and conditionally compile source/Core/cxa_demangle.cpp if the host is Darwin.
> 
> 
> Thanks,
> Dan
> 
> 
> 
> On 2012-12-11, at 1:02 AM, Chris Lattner wrote:
> 
>> 
>> On Dec 10, 2012, at 1:05 PM, Daniel Malea <daniel.malea at intel.com> wrote:
>> 
>>> Author: dmalea
>>> Date: Mon Dec 10 15:05:57 2012
>>> New Revision: 169767
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=169767&view=rev
>>> Log:
>>> Enable RTTI for liblldbCore.a when GCC is the compiler
>>> - gcc does not like -fno-rtti mixed with dynamic_cast<> (in cxa_demangle.cpp)
>> 
>> FWIW, another approach might just be to use the system version of __cxa_demangle on linux.  We use cxa_demangle.cpp on the mac specifically to work around system bugs with C++'11 symbols.  If this isn't a concern, you could just disable that file entirely.
>> 
>> -Chris
>> 
>>> 
>>> 
>>> Modified:
>>>  lldb/trunk/lib/Makefile
>>>  lldb/trunk/source/Core/Makefile
>>>  lldb/trunk/source/Utility/Makefile
>>> 
>>> Modified: lldb/trunk/lib/Makefile
>>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lib/Makefile?rev=169767&r1=169766&r2=169767&view=diff
>>> ==============================================================================
>>> --- lldb/trunk/lib/Makefile (original)
>>> +++ lldb/trunk/lib/Makefile Mon Dec 10 15:05:57 2012
>>> @@ -67,6 +67,14 @@
>>>    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 \
>>> 
>>> Modified: lldb/trunk/source/Core/Makefile
>>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Makefile?rev=169767&r1=169766&r2=169767&view=diff
>>> ==============================================================================
>>> --- lldb/trunk/source/Core/Makefile (original)
>>> +++ lldb/trunk/source/Core/Makefile Mon Dec 10 15:05:57 2012
>>> @@ -11,4 +11,15 @@
>>> 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
>>> 
>>> Modified: lldb/trunk/source/Utility/Makefile
>>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/Makefile?rev=169767&r1=169766&r2=169767&view=diff
>>> ==============================================================================
>>> --- lldb/trunk/source/Utility/Makefile (original)
>>> +++ lldb/trunk/source/Utility/Makefile Mon Dec 10 15:05:57 2012
>>> @@ -12,4 +12,11 @@
>>> 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
>>> 
>>> 
>>> _______________________________________________
>>> lldb-commits mailing list
>>> lldb-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>> 
> 




More information about the lldb-commits mailing list