[Mesa-dev] [PATCH] build: remove forced -fno-rtti
Johannes Obermayr
johannesobermayr at gmx.de
Tue Oct 15 17:04:26 CEST 2013
Am Montag, 14. Oktober 2013, 16:57:20 schrieb Francisco Jerez:
> Alexander von Gluck IV <kallisti5 at unixzen.com> writes:
>
> > * As discussed on the mailing list,
> > forced no-rtti breaks C++ public
> > API's such as the Haiku C++ libGL.so
> > * -fno-rtti *can* be still set however
> > instead of blindly forcing -fno-rtti,
> > we can rely on the llvm-config
> > --cppflags output.
> > If the system llvm is built without
> > rtti (default), the no-rtti flag will be
> > present in llvm-config --cppflags
> > (which we pick up on)
> > If llvm is built with rtti
> > (REQUIRES_RTTI=1), then -fno-rtti is
> > removed from llvm-config --cppflags.
> > * We could selectively add / remove rtti
> > from various components, however mixing
> > rtti and non-rtti code is tricky and
> > could introduce bugs.
> > * This needs impact tested.
>
> This looks like the right thing to do to me,
>
> Reviewed-by: Francisco Jerez <currojerez at riseup.net>
>
> Thanks.
ATM NACK because llvm-config doesn't output required -fno-rtti:
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr -DLLVM_LIBDIR_SUFFIX=64 '-DLLVM_TARGETS_TO_BUILD=CppBackend;NVPTX;R600;X86;XCore' -DBUILD_SHARED_LIBS=ON -DLLVM_ENABLE_TIMESTAMPS=OFF -DLLVM_ENABLE_FFI=ON -DLLVM_USE_OPROFILE=ON -DLLVM_BUILD_TESTS=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_BUILD_EXAMPLES=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_BUILD_TOOLS=ON -DLLVM_INCLUDE_TOOLS=ON -DLLVM_WC_REVISION=192557
$ llvm-config --cppflags
-I/usr/include -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
$ llvm-config --cxxflags
-I/usr/include -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wnon-virtual-dtor -O2 -g -DNDEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
$ llvm-config --cflags
-I/usr/include -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -fPIC -Wall -W -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -pedantic -Wno-long-long -O2 -g -DNDEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
[ 576s] CXXLD libgallium.la
[ 579s] gallivm/.libs/lp_bld_debug.o:(.data.rel.ro._ZTI17raw_debug_ostream[_ZTI17raw_debug_ostream]+0x10): undefined reference to `typeinfo for llvm::raw_ostream'
[ 579s] gallivm/.libs/lp_bld_debug.o:(.data.rel.ro._ZTIN4llvm14format_object1ImEE[_ZTIN4llvm14format_object1ImEE]+0x10): undefined reference to `typeinfo for llvm::format_object_base'
[ 579s] gallivm/.libs/lp_bld_debug.o:(.data.rel.ro._ZTI18BufferMemoryObject[_ZTI18BufferMemoryObject]+0x10): undefined reference to `typeinfo for llvm::MemoryObject'
Please revert commit ce8eadb!
>
> > ---
> > configure.ac | 1 -
> > scons/llvm.py | 3 ---
> > src/gallium/auxiliary/Makefile.am | 6 ------
> > 3 files changed, 10 deletions(-)
> >
> > diff --git a/configure.ac b/configure.ac
> > index 0d082d2..3335575 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -1943,7 +1943,6 @@ AM_CONDITIONAL(HAVE_LOADER_GALLIUM, test x$enable_gallium_loader = xyes)
> > AM_CONDITIONAL(HAVE_DRM_LOADER_GALLIUM, test x$enable_gallium_drm_loader = xyes)
> > AM_CONDITIONAL(HAVE_GALLIUM_COMPUTE, test x$enable_opencl = xyes)
> > AM_CONDITIONAL(HAVE_MESA_LLVM, test x$MESA_LLVM = x1)
> > -AM_CONDITIONAL(LLVM_NEEDS_FNORTTI, test $LLVM_VERSION_INT -ge 302)
> >
> > AC_SUBST([ELF_LIB])
> >
> > diff --git a/scons/llvm.py b/scons/llvm.py
> > index 7cd609c..c1c3736 100644
> > --- a/scons/llvm.py
> > +++ b/scons/llvm.py
> > @@ -195,9 +195,6 @@ def generate(env):
> > if llvm_version >= distutils.version.LooseVersion('3.1'):
> > components.append('mcjit')
> >
> > - if llvm_version >= distutils.version.LooseVersion('3.2'):
> > - env.Append(CXXFLAGS = ('-fno-rtti',))
> > -
> > env.ParseConfig('llvm-config --libs ' + ' '.join(components))
> > env.ParseConfig('llvm-config --ldflags')
> > except OSError:
> > diff --git a/src/gallium/auxiliary/Makefile.am b/src/gallium/auxiliary/Makefile.am
> > index 670e124..2d2d8d4 100644
> > --- a/src/gallium/auxiliary/Makefile.am
> > +++ b/src/gallium/auxiliary/Makefile.am
> > @@ -25,12 +25,6 @@ AM_CXXFLAGS += \
> > $(GALLIUM_CFLAGS) \
> > $(LLVM_CXXFLAGS)
> >
> > -if LLVM_NEEDS_FNORTTI
> > -
> > -AM_CXXFLAGS += -fno-rtti
> > -
> > -endif
> > -
> > libgallium_la_SOURCES += \
> > $(GALLIVM_SOURCES) \
> > $(GALLIVM_CPP_SOURCES)
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list