From: Michael Matz <matz@suse.de>
To: Paolo Bonzini <bonzini@gnu.org>, Ralf.Wildenhues@gmx.de
Cc: Eric Botcazou <ebotcazou@adacore.com>,
Richard Guenther <richard.guenther@gmail.com>,
Ian Lance Taylor <iant@google.com>,
gcc-patches@gcc.gnu.org
Subject: Build gcc/ with -fno-exceptions -fno-rtti
Date: Thu, 03 Nov 2011 14:23:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.64.1111031509150.30317@wotan.suse.de> (raw)
In-Reply-To: <201111031023.09208.ebotcazou@adacore.com>
Hi,
On Thu, 3 Nov 2011, Eric Botcazou wrote:
> > There is a bug about not using -fexceptions (50857).
>
> Then let's fix it, as you said there "We fail to pass -fno-exceptions
> -fno-rtti to g++ for stage2 and stage3 building the host binaries.
> That leads to increased compile-time and possibly runtime."
This follows Ians suggestion from PR50857, testing in libcpp/ and gcc/ if
-fno-exceptions and -fno-rtti work with the compiler, and add them to
ALL_CXXFLAGS. It does fix bootstrap with c,c++,ada and my patch. No yet
put through an all-language bootstrap of testsuite. What do you think?
(I also looked at doing this from top-level configure/Makefile/whatever,
but that's too complicated for me it seems).
Ciao,
Michael.
libcpp/
* configure.ac: Check for -fno-exceptions -fno-rtti.
* configure: Regenerate.
* Makefile.in (NOEXCEPTION_FLAGS): New flag.
(ALL_CXXFLAGS): Use it.
gcc/
* configure.ac: Check for -fno-exceptions -fno-rtti.
* configure: Regenerate.
* Makefile.in (NOEXCEPTION_FLAGS): New flag.
(ALL_CXXFLAGS): Use it.
Index: libcpp/configure.ac
===================================================================
--- libcpp/configure.ac (revision 180700)
+++ libcpp/configure.ac (working copy)
@@ -39,6 +39,10 @@ ACX_PROG_CC_WARNING_OPTS([-Wstrict-proto
-Wold-style-definition -Wc++-compat], [c_warn])
ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([-Wno-long-long])
+# Disable exceptions and RTTI if building with g++
+ACX_PROG_CC_WARNING_OPTS(
+ m4_quote(m4_do([-fno-exceptions -fno-rtti])), [noexception_flags])
+
# Only enable with --enable-werror-always until existing warnings are
# corrected.
ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual])
Index: libcpp/Makefile.in
===================================================================
--- libcpp/Makefile.in (revision 180700)
+++ libcpp/Makefile.in (working copy)
@@ -56,6 +56,7 @@ XGETTEXT = @XGETTEXT@
CCDEPMODE = @CCDEPMODE@
CXXDEPMODE = @CXXDEPMODE@
DEPDIR = @DEPDIR@
+NOEXCEPTION_FLAGS = @noexception_flags@
datarootdir = @datarootdir@
datadir = @datadir@
@@ -72,7 +73,8 @@ INCLUDES = -I$(srcdir) -I. -I$(srcdir)/.
-I$(srcdir)/include
ALL_CFLAGS = $(CFLAGS) $(WARN_CFLAGS) $(INCLUDES) $(CPPFLAGS)
-ALL_CXXFLAGS = $(CXXFLAGS) $(WARN_CXXFLAGS) $(INCLUDES) $(CPPFLAGS)
+ALL_CXXFLAGS = $(CXXFLAGS) $(WARN_CXXFLAGS) $(NOEXCEPTION_FLAGS) $(INCLUDES) \
+ $(CPPFLAGS)
# The name of the compiler to use.
ENABLE_BUILD_WITH_CXX = @ENABLE_BUILD_WITH_CXX@
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac (revision 180700)
+++ gcc/configure.ac (working copy)
@@ -357,6 +357,10 @@ fi
AC_SUBST(warn_cflags)
AC_SUBST(warn_cxxflags)
+# Disable exceptions and RTTI if building with g++
+ACX_PROG_CC_WARNING_OPTS(
+ m4_quote(m4_do([-fno-exceptions -fno-rtti])), [noexception_flags])
+
# Enable expensive internal checks
is_release=
if test x"`cat $srcdir/DEV-PHASE`" != xexperimental; then
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in (revision 180700)
+++ gcc/Makefile.in (working copy)
@@ -164,6 +164,8 @@ C_STRICT_WARN = @c_strict_warn@
# "extern" tags in header files.
NOCOMMON_FLAG = @nocommon_flag@
+NOEXCEPTION_FLAGS = @noexception_flags@
+
# This is set by --disable-maintainer-mode (default) to "#"
# FIXME: 'MAINT' will always be set to an empty string, no matter if
# --disable-maintainer-mode is used or not. This is because the
@@ -1033,7 +1035,7 @@ ALL_CFLAGS = $(T_CFLAGS) $(CFLAGS-$@) \
# The C++ version.
ALL_CXXFLAGS = $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS) $(INTERNAL_CFLAGS) \
- $(COVERAGE_FLAGS) $(WARN_CXXFLAGS) @DEFS@
+ $(COVERAGE_FLAGS) $(NOEXCEPTION_FLAGS) $(WARN_CXXFLAGS) @DEFS@
# Likewise. Put INCLUDES at the beginning: this way, if some autoconf macro
# puts -I options in CPPFLAGS, our include files in the srcdir will always
next prev parent reply other threads:[~2011-11-03 14:17 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-03 0:05 Mark objects death at end of scope Michael Matz
2011-11-03 1:21 ` Eric Botcazou
2011-11-03 9:24 ` Richard Guenther
2011-11-03 10:26 ` Eric Botcazou
2011-11-03 12:52 ` Richard Guenther
2011-11-03 13:42 ` Michael Matz
2011-11-03 14:33 ` Eric Botcazou
2011-11-03 14:46 ` Michael Matz
2011-11-03 14:55 ` Eric Botcazou
2011-11-03 14:23 ` Michael Matz [this message]
2011-11-03 14:26 ` Build gcc/ with -fno-exceptions -fno-rtti Paolo Bonzini
2011-11-03 14:31 ` Richard Guenther
2011-11-03 15:08 ` Eric Botcazou
2011-11-03 17:46 ` Michael Matz
2011-11-03 9:59 ` Mark objects death at end of scope Richard Guenther
2011-11-03 11:07 ` Michael Matz
2011-11-07 16:05 ` Michael Matz
2011-11-07 22:10 ` Richard Guenther
2011-11-10 23:57 ` Steve Ellcey
2011-11-11 15:32 ` Michael Matz
2011-11-11 16:20 ` Mark objects death@end " Ulrich Weigand
2011-11-11 17:22 ` Michael Matz
2011-11-11 17:45 ` Ulrich Weigand
2011-11-11 17:45 ` Michael Matz
2011-11-03 10:57 ` Mark objects death at end " Jakub Jelinek
2011-11-03 11:57 ` Michael Matz
2011-11-03 12:47 ` Jakub Jelinek
2011-11-03 13:14 ` Michael Matz
2011-11-04 12:28 ` Jakub Jelinek
2011-11-04 12:45 ` Jakub Jelinek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.1111031509150.30317@wotan.suse.de \
--to=matz@suse.de \
--cc=Ralf.Wildenhues@gmx.de \
--cc=bonzini@gnu.org \
--cc=ebotcazou@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=iant@google.com \
--cc=richard.guenther@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).