diff mbox

Remove -fexceptions configure test

Message ID alpine.DEB.2.10.1510152146440.6002@digraph.polyomino.org.uk
State New
Headers show

Commit Message

Joseph Myers Oct. 15, 2015, 9:47 p.m. UTC
There is a configure test for -fexceptions.  This option was added in
GCC 2.8, so the test is obsolete - and indeed plenty of code is using
-fexceptions directly.  This patch removes the configure test and
makes all uses of $(exceptions) use -fexceptions directly.

Tested for x86_64 and x86 (testsuite, and that installed shared
libraries are unchanged by the patch).

2015-10-15  Joseph Myers  <joseph@codesourcery.com>

	* configure.ac (libc_cv_gcc_exceptions): Remove configure test.
	* configure: Regenerated.
	* sysdeps/arm/configure.ac (libc_cv_gcc_exceptions): Do not set
	variable.
	(exceptions): Likewise.
	* sysdeps/arm/configure: Regenerated.
	* config.make.in (exceptions): Remove variable.
	* Makeconfig (uses-callbacks): Use -fexceptions instead of
	$(exceptions).
	* debug/Makefile (CFLAGS-dprintf_chk.c): Likewise.
	(CFLAGS-vdprintf_chk.c): Likewise.
	(CFLAGS-printf_chk.c): Likewise.
	(CFLAGS-fprintf_chk.c): Likewise.
	(CFLAGS-vprintf_chk.c): Likewise.
	(CFLAGS-vfprintf_chk.c): Likewise.
	(CFLAGS-gets_chk.c): Likewise.
	(CFLAGS-fgets_chk.c): Likewise.
	(CFLAGS-fgets_u_chk.c): Likewise.
	(CFLAGS-fread_chk.c): Likewise.
	(CFLAGS-fread_u_chk.c): Likewise.
	(CFLAGS-wprintf_chk.c): Likewise.
	(CFLAGS-fwprintf_chk.c): Likewise.
	(CFLAGS-vwprintf_chk.c): Likewise.
	(CFLAGS-vfwprintf_chk.c): Likewise.
	(CFLAGS-fgetws_chk.c): Likewise.
	(CFLAGS-fgetws_u_chk.c): Likewise.
	* libio/Makefile (CFLAGS-fileops.c): Likewise.
	(CFLAGS-fputc.c): Likewise.
	(CFLAGS-fputwc.c): Likewise.
	(CFLAGS-freopen64.c): Likewise.
	(CFLAGS-freopen.c): Likewise.
	(CFLAGS-fseek.c): Likewise.
	(CFLAGS-fseeko64.c): Likewise.
	(CFLAGS-fseeko.c): Likewise.
	(CFLAGS-ftello64.c): Likewise.
	(CFLAGS-ftello.c): Likewise.
	(CFLAGS-fwide.c): Likewise.
	(CFLAGS-genops.c): Likewise.
	(CFLAGS-getc.c): Likewise.
	(CFLAGS-getchar.c): Likewise.
	(CFLAGS-getwc.c): Likewise.
	(CFLAGS-getwchar.c): Likewise.
	(CFLAGS-iofclose.c): Likewise.
	(CFLAGS-iofflush.c): Likewise.
	(CFLAGS-iofgetpos64.c): Likewise.
	(CFLAGS-iofgetpos.c): Likewise.
	(CFLAGS-iofgets.c): Likewise.
	(CFLAGS-iofgetws.c): Likewise.
	(CFLAGS-iofputs.c): Likewise.
	(CFLAGS-iofputws.c): Likewise.
	(CFLAGS-iofread.c): Likewise.
	(CFLAGS-iofsetpos64.c): Likewise.
	(CFLAGS-iofsetpos.c): Likewise.
	(CFLAGS-ioftell.c): Likewise.
	(CFLAGS-iofwrite.c): Likewise.
	(CFLAGS-iogetdelim.c): Likewise.
	(CFLAGS-iogetline.c): Likewise.
	(CFLAGS-iogets.c): Likewise.
	(CFLAGS-iogetwline.c): Likewise.
	(CFLAGS-ioputs.c): Likewise.
	(CFLAGS-ioseekoff.c): Likewise.
	(CFLAGS-ioseekpos.c): Likewise.
	(CFLAGS-iosetbuffer.c): Likewise.
	(CFLAGS-iosetvbuf.c): Likewise.
	(CFLAGS-ioungetc.c): Likewise.
	(CFLAGS-ioungetwc.c): Likewise.
	(CFLAGS-oldfileops.c): Likewise.
	(CFLAGS-oldiofclose.c): Likewise.
	(CFLAGS-oldiofgetpos64.c): Likewise.
	(CFLAGS-oldiofgetpos.c): Likewise.
	(CFLAGS-oldiofsetpos64.c): Likewise.
	(CFLAGS-oldiofsetpos.c): Likewise.
	(CFLAGS-peekc.c): Likewise.
	(CFLAGS-putc.c): Likewise.
	(CFLAGS-putchar.c): Likewise.
	(CFLAGS-putwc.c): Likewise.
	(CFLAGS-putwchar.c): Likewise.
	(CFLAGS-rewind.c): Likewise.
	(CFLAGS-wfileops.c): Likewise.
	(CFLAGS-wgenops.c): Likewise.
	(CFLAGS-oldiofopen.c): Likewise.
	(CFLAGS-iofopen.c): Likewise.
	(CFLAGS-iofopen64.c): Likewise.
	(CFLAGS-oldtmpfile.c): Likewise.
	* stdio-common/Makefile (CFLAGS-vfprintf.c): Likewise.
	(CFLAGS-fprintf.c): Likewise.
	(CFLAGS-printf.c): Likewise.
	(CFLAGS-vfwprintf.c): Likewise.
	(CFLAGS-vfscanf.c): Likewise.
	(CFLAGS-vfwscanf.c): Likewise.
	(CFLAGS-fscanf.c): Likewise.
	(CFLAGS-scanf.c): Likewise.
	(CFLAGS-isoc99_vfscanf.c): Likewise.
	(CFLAGS-isoc99_vscanf.c): Likewise.
	(CFLAGS-isoc99_fscanf.c): Likewise.
	(CFLAGS-isoc99_scanf.c): Likewise.
	* wcsmbs/Makefile (CFLAGS-isoc99_wscanf.c): Likewise.
	(CFLAGS-isoc99_fwscanf.c): Likewise.
	(CFLAGS-isoc99_vwscanf.c): Likewise.
	(CFLAGS-isoc99_vfwscanf.c): Likewise.

Comments

Roland McGrath Oct. 15, 2015, 9:58 p.m. UTC | #1
It sure would be nice if places using special compiler flags for
specific files said why they are doing what they are doing.  The
uses-callbacks variable is a nice implicit documentation for the
cases it's used in.  Yet we have a few instances that use
"$(uses-callbacks) -fexceptions".  This is redundant--but not
completely obviously so, because there is no explanation for
-fexceptions there.

What is the reason for -fexceptions in all those other places?  If
each is actually a uses-callbacks case, then we should use that
variable to clarify that in the documentation.  I think that's the
actual case for all the stdio cases, because they can lead to
callbacks via _IO_JUMPS.

Do we have any -fexceptions cases that are not actually uses-callbacks?
Joseph Myers Oct. 15, 2015, 10:06 p.m. UTC | #2
On Thu, 15 Oct 2015, Roland McGrath wrote:

> What is the reason for -fexceptions in all those other places?  If
> each is actually a uses-callbacks case, then we should use that
> variable to clarify that in the documentation.  I think that's the
> actual case for all the stdio cases, because they can lead to
> callbacks via _IO_JUMPS.

I don't know the specific reasons.  But cleaning up such uses has been 
listed in <https://sourceware.org/glibc/wiki/Development_Todo/Master> for 
some time: "Where makefiles use -fexceptions, -fasynchronous-unwind-tables 
or $(exceptions), make them use makefile variables that relate to the 
logical reason those options are needed (e.g. "may be cancelled"), as 
described in http://sourceware.org/ml/libc-alpha/2012-11/msg00147.html - 
and more generally, develop a way to check for consistency issues where a 
function using callbacks isn't marked as such, or where a function may be 
cancelled or uses callbacks but a caller of that function isn't marked 
accordingly (in some cases that may be OK, however).".  This patch is part 
of a different listed todo item, "Go through configure tests (both in the 
toplevel configure and in subdirectory configure and preconfigure scripts) 
and remove tests whose results can be assumed based on the minimum 
supported GCC and binutils versions (and the associated conditionals on 
the results of those tests).".

Whatever the specific reasons, $(exceptions) and -fexceptions are used 
interchangably and there is no useful abstraction that I can see involved 
in the $(exceptions) variable (unlike in $(uses-callbacks)).
Roland McGrath Oct. 15, 2015, 10:20 p.m. UTC | #3
If the meaningful cleanup will be done, then this meaningless cosmetic
cleanup is fine for now.  I just don't want to see the meaningful ones
ignored or delayed indefinitely while the meaningless ones give us a false
sense of progress on cleanliness.
Joseph Myers Oct. 15, 2015, 11:28 p.m. UTC | #4
On Thu, 15 Oct 2015, Roland McGrath wrote:

> What is the reason for -fexceptions in all those other places?  If
> each is actually a uses-callbacks case, then we should use that
> variable to clarify that in the documentation.  I think that's the
> actual case for all the stdio cases, because they can lead to
> callbacks via _IO_JUMPS.
> 
> Do we have any -fexceptions cases that are not actually uses-callbacks?

I think:

* If a function may be cancelled, it needs -fexceptions.  This includes 
most functions doing I/O unless explicitly using non-cancellable I/O 
functions.

* If the cancellation may occur from within an inline asm, not just at 
function call points, -fasynchronous-unwind-tables is needed as well.  
(I'm not sure what's going on with the few files using 
-fasynchronous-unwind-tables without -fexceptions.)

* If a function uses callbacks, it needs -fexceptions (both because the 
callbacks might use interfaces that can be cancelled, and also because 
they might throw exceptions).

* For all of the above, __THROW must not be used.

More than one of the above may apply to a function.  I don't know what 
makes sense regarding makefile variables in such cases (I/O and callbacks, 
for example).  And I don't know if we actually intend to allow exceptions 
to be thrown and cancellation to occur for arbitrary callbacks.  
(snprintf is marked __THROWNL - but custom printf handlers can be 
registered.)
Szabolcs Nagy Oct. 18, 2015, 12:49 p.m. UTC | #5
* Joseph Myers <joseph@codesourcery.com> [2015-10-15 23:28:49 +0000]:
> On Thu, 15 Oct 2015, Roland McGrath wrote:
> 
> > What is the reason for -fexceptions in all those other places?  If
> > each is actually a uses-callbacks case, then we should use that
> > variable to clarify that in the documentation.  I think that's the
> > actual case for all the stdio cases, because they can lead to
> > callbacks via _IO_JUMPS.
> > 
> > Do we have any -fexceptions cases that are not actually uses-callbacks?
> 
> I think:
> 
> * If a function may be cancelled, it needs -fexceptions.  This includes 
> most functions doing I/O unless explicitly using non-cancellable I/O 
> functions.
> 
> * If the cancellation may occur from within an inline asm, not just at 
> function call points, -fasynchronous-unwind-tables is needed as well.  
> (I'm not sure what's going on with the few files using 
> -fasynchronous-unwind-tables without -fexceptions.)
> 

i think -fasynchronous-unwind-tables don't need -fexceptions
(currently).

-fasync* means unwind can propagate from anywhere, cleanups
are not run.

-fexcept* means unwind can propagate from calls and cleanups
and exception handlers are run.

but glibc does not use exception based cleanups for cancellation
so pthread_cleanup_push/pop don't need -fexcept* if -fasync* is
already provided (e.g. when inline asm is cancelled and there
is *_push/pop around it in the same tu).

(glibc does use explicit __attribute__((cleanup(foo))), but only
when unwind comes from calls and then -fasync* is not used,
-fexcept* is enough.)

this might change when the cancellation redesign work of
Adhemerval Zanella is committed, then glibc can change the
internal cancel cleanup handling to use exceptions i think.

(although that would still change the behaviour of pthread_once
visibly: the callback does not have to be compiled with unwind
tables now and pthread_once still runs the cleanups if the
callback is canceled.. but that stops working with exception
based cleanup).

> * If a function uses callbacks, it needs -fexceptions (both because the 
> callbacks might use interfaces that can be cancelled, and also because 
> they might throw exceptions).
> 
> * For all of the above, __THROW must not be used.
> 
> More than one of the above may apply to a function.  I don't know what 
> makes sense regarding makefile variables in such cases (I/O and callbacks, 
> for example).  And I don't know if we actually intend to allow exceptions 
> to be thrown and cancellation to occur for arbitrary callbacks.  
> (snprintf is marked __THROWNL - but custom printf handlers can be 
> registered.)
> 
> -- 
> Joseph S. Myers
> joseph@codesourcery.com
Joseph Myers Oct. 19, 2015, 4:44 p.m. UTC | #6
On Sun, 18 Oct 2015, Szabolcs Nagy wrote:

> i think -fasynchronous-unwind-tables don't need -fexceptions
> (currently).
> 
> -fasync* means unwind can propagate from anywhere, cleanups
> are not run.

So do you think cases with callbacks (which might be C++ functions 
throwing exceptions through libc code) need -fexceptions, or only 
-funwind-tables?
Szabolcs Nagy Oct. 19, 2015, 5:28 p.m. UTC | #7
On 19/10/15 17:44, Joseph Myers wrote:
> On Sun, 18 Oct 2015, Szabolcs Nagy wrote:
>
>> i think -fasynchronous-unwind-tables don't need -fexceptions
>> (currently).
>>
>> -fasync* means unwind can propagate from anywhere, cleanups
>> are not run.
>
> So do you think cases with callbacks (which might be C++ functions
> throwing exceptions through libc code) need -fexceptions, or only
> -funwind-tables?
>

i think -funwind-tables is enough if there is no
__attribute__((cleanup(foo))) usage in the code
around the callback.

it makes sense to use -fexceptions consistently
anyway to be safe and future proof.

i just wanted to note the async case because it
is going to change with the cancel redesign so the
patch should take that into consideration.
(probably async unwind will not be needed at all then,
so -fexceptions can be used consistently for callbacks
and cancellation points).
diff mbox

Patch

diff --git a/Makeconfig b/Makeconfig
index bbe83ec..a03db7f 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -50,7 +50,7 @@  export sysdep_dir := $(sysdep_dir)
 include $(common-objpfx)config.make
 
 # What flags to give to sources which call user provided callbacks
-uses-callbacks = $(exceptions)
+uses-callbacks = -fexceptions
 
 # What flags to give to tests which test stack alignment
 stack-align-test-flags =
diff --git a/config.make.in b/config.make.in
index 6449559..a7d4662 100644
--- a/config.make.in
+++ b/config.make.in
@@ -70,7 +70,6 @@  use-default-link = @use_default_link@
 output-format = @libc_cv_output_format@
 have-cxx-thread_local = @libc_cv_cxx_thread_local@
 
-exceptions = @exceptions@
 multi-arch = @multi_arch@
 
 mach-interface-list = @mach_interface_list@
diff --git a/configure b/configure
index de49ba6..81d003c 100755
--- a/configure
+++ b/configure
@@ -624,7 +624,6 @@  LIBGD
 libc_cv_cc_loop_to_function
 libc_cv_cc_submachine
 libc_cv_cc_nofma
-exceptions
 gnu89_inline
 libc_cv_ssp
 fno_unit_at_a_time
@@ -6471,36 +6470,6 @@  if test $libc_cv_ld_no_whole_archive = no; then
   as_fn_error $? "support for --no-whole-archive is needed" "$LINENO" 5
 fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc -fexceptions" >&5
-$as_echo_n "checking for gcc -fexceptions... " >&6; }
-if ${libc_cv_gcc_exceptions+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat > conftest.c <<\EOF
-_start () {}
-int __eh_pc;
-__throw () {}
-EOF
-if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
-			    -nostdlib -nostartfiles -fexceptions
-			    -o conftest conftest.c 1>&5'
-  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }; then
-  libc_cv_gcc_exceptions=yes
-else
-  libc_cv_gcc_exceptions=no
-fi
-rm -f conftest*
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_gcc_exceptions" >&5
-$as_echo "$libc_cv_gcc_exceptions" >&6; }
-if test $libc_cv_gcc_exceptions = yes; then
-  exceptions=-fexceptions
-fi
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_memset" >&5
 $as_echo_n "checking for __builtin_memset... " >&6; }
 if ${libc_cv_gcc_builtin_memset+:} false; then :
diff --git a/configure.ac b/configure.ac
index 384bf3f..d74bef4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1629,26 +1629,6 @@  if test $libc_cv_ld_no_whole_archive = no; then
   AC_MSG_ERROR([support for --no-whole-archive is needed])
 fi
 
-AC_CACHE_CHECK(for gcc -fexceptions, libc_cv_gcc_exceptions, [dnl
-cat > conftest.c <<\EOF
-_start () {}
-int __eh_pc;
-__throw () {}
-EOF
-dnl No \ in command here because it ends up inside ''.
-if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
-			    -nostdlib -nostartfiles -fexceptions
-			    -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
-  libc_cv_gcc_exceptions=yes
-else
-  libc_cv_gcc_exceptions=no
-fi
-rm -f conftest*])
-if test $libc_cv_gcc_exceptions = yes; then
-  exceptions=-fexceptions
-fi
-AC_SUBST(exceptions)dnl
-
 AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
 cat > conftest.c <<\EOF
 void zero (void *x)
diff --git a/debug/Makefile b/debug/Makefile
index f871ba9..a383417 100644
--- a/debug/Makefile
+++ b/debug/Makefile
@@ -60,25 +60,25 @@  CFLAGS-vsnprintf_chk.c = $(libio-mtsafe)
 CFLAGS-asprintf_chk.c = $(libio-mtsafe)
 CFLAGS-vasprintf_chk.c = $(libio-mtsafe)
 CFLAGS-obprintf_chk.c = $(libio-mtsafe)
-CFLAGS-dprintf_chk.c = $(libio-mtsafe) $(exceptions)
-CFLAGS-vdprintf_chk.c = $(libio-mtsafe) $(exceptions)
-CFLAGS-printf_chk.c = $(libio-mtsafe) $(exceptions)
-CFLAGS-fprintf_chk.c = $(libio-mtsafe) $(exceptions)
-CFLAGS-vprintf_chk.c = $(libio-mtsafe) $(exceptions)
-CFLAGS-vfprintf_chk.c = $(libio-mtsafe) $(exceptions)
-CFLAGS-gets_chk.c = $(libio-mtsafe) $(exceptions)
-CFLAGS-fgets_chk.c = $(libio-mtsafe) $(exceptions)
-CFLAGS-fgets_u_chk.c = $(libio-mtsafe) $(exceptions)
-CFLAGS-fread_chk.c = $(libio-mtsafe) $(exceptions)
-CFLAGS-fread_u_chk.c = $(libio-mtsafe) $(exceptions)
+CFLAGS-dprintf_chk.c = $(libio-mtsafe) -fexceptions
+CFLAGS-vdprintf_chk.c = $(libio-mtsafe) -fexceptions
+CFLAGS-printf_chk.c = $(libio-mtsafe) -fexceptions
+CFLAGS-fprintf_chk.c = $(libio-mtsafe) -fexceptions
+CFLAGS-vprintf_chk.c = $(libio-mtsafe) -fexceptions
+CFLAGS-vfprintf_chk.c = $(libio-mtsafe) -fexceptions
+CFLAGS-gets_chk.c = $(libio-mtsafe) -fexceptions
+CFLAGS-fgets_chk.c = $(libio-mtsafe) -fexceptions
+CFLAGS-fgets_u_chk.c = $(libio-mtsafe) -fexceptions
+CFLAGS-fread_chk.c = $(libio-mtsafe) -fexceptions
+CFLAGS-fread_u_chk.c = $(libio-mtsafe) -fexceptions
 CFLAGS-swprintf_chk.c = $(libio-mtsafe)
 CFLAGS-vswprintf_chk.c = $(libio-mtsafe)
-CFLAGS-wprintf_chk.c = $(libio-mtsafe) $(exceptions)
-CFLAGS-fwprintf_chk.c = $(libio-mtsafe) $(exceptions)
-CFLAGS-vwprintf_chk.c = $(libio-mtsafe) $(exceptions)
-CFLAGS-vfwprintf_chk.c = $(libio-mtsafe) $(exceptions)
-CFLAGS-fgetws_chk.c = $(libio-mtsafe) $(exceptions)
-CFLAGS-fgetws_u_chk.c = $(libio-mtsafe) $(exceptions)
+CFLAGS-wprintf_chk.c = $(libio-mtsafe) -fexceptions
+CFLAGS-fwprintf_chk.c = $(libio-mtsafe) -fexceptions
+CFLAGS-vwprintf_chk.c = $(libio-mtsafe) -fexceptions
+CFLAGS-vfwprintf_chk.c = $(libio-mtsafe) -fexceptions
+CFLAGS-fgetws_chk.c = $(libio-mtsafe) -fexceptions
+CFLAGS-fgetws_u_chk.c = $(libio-mtsafe) -fexceptions
 CFLAGS-read_chk.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-pread_chk.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-pread64_chk.c = -fexceptions -fasynchronous-unwind-tables
diff --git a/libio/Makefile b/libio/Makefile
index 273c240..1f4feb8 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -84,64 +84,64 @@  endif
 CPPFLAGS += $(libio-mtsafe)
 
 # Support for exception handling.
-CFLAGS-fileops.c = $(exceptions)
-CFLAGS-fputc.c = $(exceptions)
-CFLAGS-fputwc.c = $(exceptions)
-CFLAGS-freopen64.c = $(exceptions)
-CFLAGS-freopen.c = $(exceptions)
-CFLAGS-fseek.c = $(exceptions)
-CFLAGS-fseeko64.c = $(exceptions)
-CFLAGS-fseeko.c = $(exceptions)
-CFLAGS-ftello64.c = $(exceptions)
-CFLAGS-ftello.c = $(exceptions)
-CFLAGS-fwide.c = $(exceptions)
-CFLAGS-genops.c = $(exceptions)
-CFLAGS-getc.c = $(exceptions)
-CFLAGS-getchar.c = $(exceptions)
-CFLAGS-getwc.c = $(exceptions)
-CFLAGS-getwchar.c = $(exceptions)
-CFLAGS-iofclose.c = $(exceptions)
-CFLAGS-iofflush.c = $(exceptions)
-CFLAGS-iofgetpos64.c = $(exceptions)
-CFLAGS-iofgetpos.c = $(exceptions)
-CFLAGS-iofgets.c = $(exceptions)
-CFLAGS-iofgetws.c = $(exceptions)
-CFLAGS-iofputs.c = $(exceptions)
-CFLAGS-iofputws.c = $(exceptions)
-CFLAGS-iofread.c = $(exceptions)
-CFLAGS-iofsetpos64.c = $(exceptions)
-CFLAGS-iofsetpos.c = $(exceptions)
-CFLAGS-ioftell.c = $(exceptions)
-CFLAGS-iofwrite.c = $(exceptions)
-CFLAGS-iogetdelim.c = $(exceptions)
-CFLAGS-iogetline.c = $(exceptions)
-CFLAGS-iogets.c = $(exceptions)
-CFLAGS-iogetwline.c = $(exceptions)
-CFLAGS-ioputs.c = $(exceptions)
-CFLAGS-ioseekoff.c = $(exceptions)
-CFLAGS-ioseekpos.c = $(exceptions)
-CFLAGS-iosetbuffer.c = $(exceptions)
-CFLAGS-iosetvbuf.c = $(exceptions)
-CFLAGS-ioungetc.c = $(exceptions)
-CFLAGS-ioungetwc.c = $(exceptions)
-CFLAGS-oldfileops.c = $(exceptions)
-CFLAGS-oldiofclose.c = $(exceptions)
-CFLAGS-oldiofgetpos64.c = $(exceptions)
-CFLAGS-oldiofgetpos.c = $(exceptions)
-CFLAGS-oldiofsetpos64.c = $(exceptions)
-CFLAGS-oldiofsetpos.c = $(exceptions)
-CFLAGS-peekc.c = $(exceptions)
-CFLAGS-putc.c = $(exceptions)
-CFLAGS-putchar.c = $(exceptions)
-CFLAGS-putwc.c = $(exceptions)
-CFLAGS-putwchar.c = $(exceptions)
-CFLAGS-rewind.c = $(exceptions)
-CFLAGS-wfileops.c = $(exceptions)
-CFLAGS-wgenops.c = $(exceptions)
-CFLAGS-oldiofopen.c = $(exceptions)
-CFLAGS-iofopen.c = $(exceptions)
-CFLAGS-iofopen64.c = $(exceptions)
-CFLAGS-oldtmpfile.c = $(exceptions)
+CFLAGS-fileops.c = -fexceptions
+CFLAGS-fputc.c = -fexceptions
+CFLAGS-fputwc.c = -fexceptions
+CFLAGS-freopen64.c = -fexceptions
+CFLAGS-freopen.c = -fexceptions
+CFLAGS-fseek.c = -fexceptions
+CFLAGS-fseeko64.c = -fexceptions
+CFLAGS-fseeko.c = -fexceptions
+CFLAGS-ftello64.c = -fexceptions
+CFLAGS-ftello.c = -fexceptions
+CFLAGS-fwide.c = -fexceptions
+CFLAGS-genops.c = -fexceptions
+CFLAGS-getc.c = -fexceptions
+CFLAGS-getchar.c = -fexceptions
+CFLAGS-getwc.c = -fexceptions
+CFLAGS-getwchar.c = -fexceptions
+CFLAGS-iofclose.c = -fexceptions
+CFLAGS-iofflush.c = -fexceptions
+CFLAGS-iofgetpos64.c = -fexceptions
+CFLAGS-iofgetpos.c = -fexceptions
+CFLAGS-iofgets.c = -fexceptions
+CFLAGS-iofgetws.c = -fexceptions
+CFLAGS-iofputs.c = -fexceptions
+CFLAGS-iofputws.c = -fexceptions
+CFLAGS-iofread.c = -fexceptions
+CFLAGS-iofsetpos64.c = -fexceptions
+CFLAGS-iofsetpos.c = -fexceptions
+CFLAGS-ioftell.c = -fexceptions
+CFLAGS-iofwrite.c = -fexceptions
+CFLAGS-iogetdelim.c = -fexceptions
+CFLAGS-iogetline.c = -fexceptions
+CFLAGS-iogets.c = -fexceptions
+CFLAGS-iogetwline.c = -fexceptions
+CFLAGS-ioputs.c = -fexceptions
+CFLAGS-ioseekoff.c = -fexceptions
+CFLAGS-ioseekpos.c = -fexceptions
+CFLAGS-iosetbuffer.c = -fexceptions
+CFLAGS-iosetvbuf.c = -fexceptions
+CFLAGS-ioungetc.c = -fexceptions
+CFLAGS-ioungetwc.c = -fexceptions
+CFLAGS-oldfileops.c = -fexceptions
+CFLAGS-oldiofclose.c = -fexceptions
+CFLAGS-oldiofgetpos64.c = -fexceptions
+CFLAGS-oldiofgetpos.c = -fexceptions
+CFLAGS-oldiofsetpos64.c = -fexceptions
+CFLAGS-oldiofsetpos.c = -fexceptions
+CFLAGS-peekc.c = -fexceptions
+CFLAGS-putc.c = -fexceptions
+CFLAGS-putchar.c = -fexceptions
+CFLAGS-putwc.c = -fexceptions
+CFLAGS-putwchar.c = -fexceptions
+CFLAGS-rewind.c = -fexceptions
+CFLAGS-wfileops.c = -fexceptions
+CFLAGS-wgenops.c = -fexceptions
+CFLAGS-oldiofopen.c = -fexceptions
+CFLAGS-iofopen.c = -fexceptions
+CFLAGS-iofopen64.c = -fexceptions
+CFLAGS-oldtmpfile.c = -fexceptions
 # XXX Do we need filedoalloc and wfiledoalloc?  Others?
 
 CFLAGS-tst_putwc.c = -DOBJPFX=\"$(objpfx)\"
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index d92d9d1..4a70060 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -114,18 +114,18 @@  CFLAGS-psignal.c = -fexceptions
 CFLAGS-vprintf.c = -fexceptions
 CFLAGS-cuserid.c = -fexceptions
 
-CFLAGS-vfprintf.c += $(exceptions)
-CFLAGS-fprintf.c += $(exceptions)
-CFLAGS-printf.c += $(exceptions)
-CFLAGS-vfwprintf.c += $(exceptions)
-CFLAGS-vfscanf.c += $(exceptions)
-CFLAGS-vfwscanf.c += $(exceptions)
-CFLAGS-fscanf.c += $(exceptions)
-CFLAGS-scanf.c += $(exceptions)
-CFLAGS-isoc99_vfscanf.c += $(exceptions)
-CFLAGS-isoc99_vscanf.c += $(exceptions)
-CFLAGS-isoc99_fscanf.c += $(exceptions)
-CFLAGS-isoc99_scanf.c += $(exceptions)
+CFLAGS-vfprintf.c += -fexceptions
+CFLAGS-fprintf.c += -fexceptions
+CFLAGS-printf.c += -fexceptions
+CFLAGS-vfwprintf.c += -fexceptions
+CFLAGS-vfscanf.c += -fexceptions
+CFLAGS-vfwscanf.c += -fexceptions
+CFLAGS-fscanf.c += -fexceptions
+CFLAGS-scanf.c += -fexceptions
+CFLAGS-isoc99_vfscanf.c += -fexceptions
+CFLAGS-isoc99_vscanf.c += -fexceptions
+CFLAGS-isoc99_fscanf.c += -fexceptions
+CFLAGS-isoc99_scanf.c += -fexceptions
 CFLAGS-errlist.c = $(fno-unit-at-a-time)
 CFLAGS-siglist.c = $(fno-unit-at-a-time)
 
diff --git a/sysdeps/arm/configure b/sysdeps/arm/configure
index 158116b..87ec430 100644
--- a/sysdeps/arm/configure
+++ b/sysdeps/arm/configure
@@ -313,6 +313,3 @@  libc_cv_gcc_unwind_find_fde=no
 
 # Remove -fno-unwind-tables that was added in sysdeps/arm/preconfigure.ac.
 CFLAGS=${CFLAGS% -fno-unwind-tables}
-
-libc_cv_gcc_exceptions=yes
-exceptions=-fexceptions
diff --git a/sysdeps/arm/configure.ac b/sysdeps/arm/configure.ac
index 859c92a..a9b114e 100644
--- a/sysdeps/arm/configure.ac
+++ b/sysdeps/arm/configure.ac
@@ -123,9 +123,3 @@  libc_cv_gcc_unwind_find_fde=no
 
 # Remove -fno-unwind-tables that was added in sysdeps/arm/preconfigure.ac.
 CFLAGS=${CFLAGS% -fno-unwind-tables}
-
-dnl The normal configure check for gcc -fexecptions fails because it can't
-dnl find __aeabi_unwind_cpp_pr0.  Work around this here; our GCC definitely
-dnl has -fexceptions.
-libc_cv_gcc_exceptions=yes
-exceptions=-fexceptions
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index a59a005..f333fa8 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -84,10 +84,10 @@  CFLAGS-wcstold_l.c = $(strtox-CFLAGS)
 CFLAGS-wcstof_l.c = $(strtox-CFLAGS)
 CPPFLAGS-tst-wchar-h.c = -D_FORTIFY_SOURCE=2
 
-CFLAGS-isoc99_wscanf.c += $(exceptions)
-CFLAGS-isoc99_fwscanf.c += $(exceptions)
-CFLAGS-isoc99_vwscanf.c += $(exceptions)
-CFLAGS-isoc99_vfwscanf.c += $(exceptions)
+CFLAGS-isoc99_wscanf.c += -fexceptions
+CFLAGS-isoc99_fwscanf.c += -fexceptions
+CFLAGS-isoc99_vwscanf.c += -fexceptions
+CFLAGS-isoc99_vfwscanf.c += -fexceptions
 
 CPPFLAGS += $(libio-mtsafe)