diff mbox

Get rid of useless -fno-rtti for libubsan

Message ID 529728FE.4080407@samsung.com
State New
Headers show

Commit Message

Yury Gribov Nov. 28, 2013, 11:29 a.m. UTC
> I wonder if this can't be done through
 > just adding -fno-rtti to AM_CXXFLAGS and say
 > ubsan_handlers_cxx.% ubsan_type_hash.% : AM_CXXFLAGS += -frtti

Yup, that did the trick. Attaching modified patch.
2013-11-28  Jakub Jelinek  <jakub@redhat.com>
	    Yury Gribov  <y.gribov@samsung.com>

	PR sanitizer/59106
	* ubsan/Makefile.am (AM_CXXFLAGS): Disable -frtti for files that
	don't need it.
	* ubsan/Makefile.in: Regenerated.

Comments

Jakub Jelinek Nov. 28, 2013, 11:31 a.m. UTC | #1
On Thu, Nov 28, 2013 at 03:29:02PM +0400, Yury Gribov wrote:
> > I wonder if this can't be done through
> > just adding -fno-rtti to AM_CXXFLAGS and say
> > ubsan_handlers_cxx.% ubsan_type_hash.% : AM_CXXFLAGS += -frtti
> 
> Yup, that did the trick. Attaching modified patch.

> @@ -13,11 +13,13 @@ toolexeclib_LTLIBRARIES = libubsan.la
>  ubsan_files = \
>  	ubsan_diag.cc \
>  	ubsan_handlers.cc \
> -	ubsan_handlers_cxx.cc \
> -	ubsan_type_hash.cc \
>  	ubsan_value.cc
>  
> -libubsan_la_SOURCES = $(ubsan_files) 
> +ubsan_cxx_files = \
> +	ubsan_handlers_cxx.cc \
> +	ubsan_type_hash.cc
> +
> +libubsan_la_SOURCES = $(ubsan_files) $(ubsan_cxx_files)
>  libubsan_la_LIBADD = $(top_builddir)/sanitizer_common/libsanitizer_common.la 
>  if !USING_MAC_INTERPOSE
>  libubsan_la_LIBADD += $(top_builddir)/interception/libinterception.la

The above hunk is not needed anymore, is it?

Ok for trunk without that hunk (and with Makefile.in regenerated again).

> 2013-11-28  Jakub Jelinek  <jakub@redhat.com>
> 	    Yury Gribov  <y.gribov@samsung.com>
> 
> 	PR sanitizer/59106
> 	* ubsan/Makefile.am (AM_CXXFLAGS): Disable -frtti for files that
> 	don't need it.
> 	* ubsan/Makefile.in: Regenerated.

	Jakub
Yury Gribov Nov. 28, 2013, 12:21 p.m. UTC | #2
> The above hunk is not needed anymore, is it?

Right.

 > Ok for trunk without that hunk (and with Makefile.in regenerated again).

Done, r205482.

-Y
diff mbox

Patch

diff --git a/libsanitizer/ubsan/Makefile.am b/libsanitizer/ubsan/Makefile.am
index e98984a..86fcaca 100644
--- a/libsanitizer/ubsan/Makefile.am
+++ b/libsanitizer/ubsan/Makefile.am
@@ -4,7 +4,7 @@  AM_CPPFLAGS = -I $(top_srcdir) -I $(top_srcdir)/include
 gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
 
 DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long  -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros
+AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long  -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros
 AM_CXXFLAGS += $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
 ACLOCAL_AMFLAGS = -I m4
 
@@ -13,11 +13,13 @@  toolexeclib_LTLIBRARIES = libubsan.la
 ubsan_files = \
 	ubsan_diag.cc \
 	ubsan_handlers.cc \
-	ubsan_handlers_cxx.cc \
-	ubsan_type_hash.cc \
 	ubsan_value.cc
 
-libubsan_la_SOURCES = $(ubsan_files) 
+ubsan_cxx_files = \
+	ubsan_handlers_cxx.cc \
+	ubsan_type_hash.cc
+
+libubsan_la_SOURCES = $(ubsan_files) $(ubsan_cxx_files)
 libubsan_la_LIBADD = $(top_builddir)/sanitizer_common/libsanitizer_common.la 
 if !USING_MAC_INTERPOSE
 libubsan_la_LIBADD += $(top_builddir)/interception/libinterception.la
@@ -25,6 +27,9 @@  endif
 libubsan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDFLAGS)
 libubsan_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` -lpthread -ldl
 
+# Use special rules for files that require RTTI support.
+ubsan_handlers_cxx.% ubsan_type_hash.% : AM_CXXFLAGS += -frtti
+
 # Work around what appears to be a GNU make bug handling MAKEFLAGS
 # values defined in terms of make variables, as is the case for CC and
 # friends when we are called from the top level Makefile.
diff --git a/libsanitizer/ubsan/Makefile.in b/libsanitizer/ubsan/Makefile.in
index 6812538..2e85384 100644
--- a/libsanitizer/ubsan/Makefile.in
+++ b/libsanitizer/ubsan/Makefile.in
@@ -81,9 +81,9 @@  am__DEPENDENCIES_1 =
 libubsan_la_DEPENDENCIES =  \
 	$(top_builddir)/sanitizer_common/libsanitizer_common.la \
 	$(am__append_1) $(am__DEPENDENCIES_1)
-am__objects_1 = ubsan_diag.lo ubsan_handlers.lo ubsan_handlers_cxx.lo \
-	ubsan_type_hash.lo ubsan_value.lo
-am_libubsan_la_OBJECTS = $(am__objects_1)
+am__objects_1 = ubsan_diag.lo ubsan_handlers.lo ubsan_value.lo
+am__objects_2 = ubsan_handlers_cxx.lo ubsan_type_hash.lo
+am_libubsan_la_OBJECTS = $(am__objects_1) $(am__objects_2)
 libubsan_la_OBJECTS = $(am_libubsan_la_OBJECTS)
 libubsan_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
@@ -240,7 +240,7 @@  AM_CPPFLAGS = -I $(top_srcdir) -I $(top_srcdir)/include
 # May be used by toolexeclibdir.
 gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
 AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic \
-	-Wno-long-long -fPIC -fno-builtin -fno-exceptions \
+	-Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti \
 	-fomit-frame-pointer -funwind-tables -fvisibility=hidden \
 	-Wno-variadic-macros $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
 ACLOCAL_AMFLAGS = -I m4
@@ -248,11 +248,13 @@  toolexeclib_LTLIBRARIES = libubsan.la
 ubsan_files = \
 	ubsan_diag.cc \
 	ubsan_handlers.cc \
-	ubsan_handlers_cxx.cc \
-	ubsan_type_hash.cc \
 	ubsan_value.cc
 
-libubsan_la_SOURCES = $(ubsan_files) 
+ubsan_cxx_files = \
+	ubsan_handlers_cxx.cc \
+	ubsan_type_hash.cc
+
+libubsan_la_SOURCES = $(ubsan_files) $(ubsan_cxx_files)
 libubsan_la_LIBADD =  \
 	$(top_builddir)/sanitizer_common/libsanitizer_common.la \
 	$(am__append_1) $(LIBSTDCXX_RAW_CXX_LDFLAGS)
@@ -575,6 +577,9 @@  uninstall-am: uninstall-toolexeclibLTLIBRARIES
 	tags uninstall uninstall-am uninstall-toolexeclibLTLIBRARIES
 
 
+# Use special rules for files that require RTTI support.
+ubsan_handlers_cxx.% ubsan_type_hash.% : AM_CXXFLAGS += -frtti
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT: