about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog40
-rw-r--r--Makeconfig7
-rw-r--r--debug/Makefile54
-rw-r--r--grp/Makefile7
-rw-r--r--gshadow/Makefile6
-rw-r--r--libio/Makefile6
-rw-r--r--nptl/ChangeLog6
-rw-r--r--nptl/Makefile6
-rw-r--r--pwd/Makefile4
-rw-r--r--shadow/Makefile6
-rw-r--r--stdio-common/Makefile4
-rw-r--r--stdio-common/isoc99_scanf.c4
-rw-r--r--stdlib/Makefile6
-rw-r--r--sysdeps/mach/hurd/Makeconfig3
-rw-r--r--sysdeps/mach/hurd/configure.in3
-rw-r--r--sysdeps/pthread/Makeconfig2
-rw-r--r--sysdeps/pthread/configure3
-rw-r--r--wcsmbs/Makefile5
18 files changed, 111 insertions, 61 deletions
diff --git a/ChangeLog b/ChangeLog
index ba4ea3636f..3e37db91a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,43 @@
+2012-08-17  Roland McGrath  <roland@hack.frob.com>
+
+	* Makeconfig [$(libc-reentrant) = yes] (libio-mtsafe): New variable.
+	* libio/Makefile (CPPFLAGS): Append $(libio-mtsafe) unconditionally
+	rather than -D_IO_MTSAFE_IO conditionally.
+	* stdio-common/Makefile (CPPFLAGS): Likewise.
+	* wcsmbs/Makefile (CPPFLAGS): Likewise.
+	* stdlib/Makefile (CFLAGS-strfmon.c, CFLAGS-strfmon_l.c):
+	Use $(libio-mtsafe).
+	* debug/Makefile (CFLAGS-sprintf_chk.c): Use $(libio-mtsafe) instead
+	of -D_IO_MTSAFE_IO.
+	(CFLAGS-snprintf_chk.c, CFLAGS-vsprintf_chk.c): Likewise.
+	(CFLAGS-vsnprintf_chk.c, CFLAGS-asprintf_chk.c): Likewise.
+	(CFLAGS-vasprintf_chk.c, CFLAGS-obprintf_chk.c): Likewise.
+	(CFLAGS-dprintf_chk.c, CFLAGS-vdprintf_chk.c): Likewise.
+	(CFLAGS-printf_chk.c, CFLAGS-fprintf_chk.c): Likewise.
+	(CFLAGS-vprintf_chk.c, CFLAGS-vfprintf_chk.c): Likewise.
+	(CFLAGS-gets_chk.c, CFLAGS-fgets_chk.c): Likewise.
+	(CFLAGS-fgets_u_chk.c, CFLAGS-fread_chk.c): Likewise.
+	(CFLAGS-fread_u_chk.c): Likewise.
+	(CFLAGS-swprintf_chk.c, CFLAGS-vswprintf_chk.c): Likewise.
+	(CFLAGS-wprintf_chk.c, CFLAGS-fwprintf_chk.c): Likewise.
+	(CFLAGS-vwprintf_chk.c, CFLAGS-vfwprintf_chk.c): Likewise.
+	(CFLAGS-fgetws_chk.c, CFLAGS-fgetws_u_chk.c): Likewise.
+	* grp/Makefile (CFLAGS-fgetgrent_r.c, CFLAGS-putgrent.c): Likewise.
+	* gshadow/Makefile (CFLAGS-fgetsgent_r.c, CFLAGS-putsgent.c): Likewise.
+	* misc/Makefile (CFLAGS-mntent_r.c): Likewise.
+	* pwd/Makefile (CFLAGS-fgetpwent_r.c): Likewise.
+	* shadow/Makefile (CFLAGS-fgetspent_r.c, CFLAGS-putspent.c): Likewise.
+
+	* libio/Makefile: Test [$(libc-reentrant) = yes]
+	instead of [$(filter %REENTRANT, $(defines)) nonempty].
+
+	* Makeconfig
+	[$(libc-reentrant) = yes] (defines): Append -D_LIBC_REENTRANT.
+	* sysdeps/pthread/configure: File removed.
+	* sysdeps/pthread/Makeconfig: New file.
+	* sysdeps/mach/hurd/Makeconfig (libc-reentrant): New variable.
+	* sysdeps/mach/hurd/configure.in: Don't touch DEFINES here.
+
 2012-08-16  Gary Benson  <gbenson@redhat.com>
 
 	* elf/dl-close.c (_dl_close_worker): Also set r->r_map when
diff --git a/Makeconfig b/Makeconfig
index 10df8eeb93..57f35f957f 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -1005,6 +1005,13 @@ endif
 sysd-rules-targets := $(sort $(foreach p,$(sysd-rules-patterns),\
 					 $(firstword $(subst :, ,$p))))
 
+# A sysdeps Makeconfig fragment may set libc-reentrant to yes.
+ifeq (yes,$(libc-reentrant))
+defines += -D_LIBC_REENTRANT
+
+libio-mtsafe = -D_IO_MTSAFE_IO
+endif
+
 endif # Makeconfig not yet included
 
 # Local Variables:
diff --git a/debug/Makefile b/debug/Makefile
index 4c01a66e39..f4e38b4328 100644
--- a/debug/Makefile
+++ b/debug/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2001,2004-2008, 2009, 2011, 2012 Free Software Foundation, Inc.
+# Copyright (C) 1998-2012 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -48,32 +48,32 @@ routines  = backtrace backtracesyms backtracesymsfd noophooks \
 static-only-routines := warning-nop stack_chk_fail_local
 
 CFLAGS-backtrace.c = -fno-omit-frame-pointer
-CFLAGS-sprintf_chk.c = -D_IO_MTSAFE_IO
-CFLAGS-snprintf_chk.c = -D_IO_MTSAFE_IO
-CFLAGS-vsprintf_chk.c = -D_IO_MTSAFE_IO
-CFLAGS-vsnprintf_chk.c = -D_IO_MTSAFE_IO
-CFLAGS-asprintf_chk.c = -D_IO_MTSAFE_IO
-CFLAGS-vasprintf_chk.c = -D_IO_MTSAFE_IO
-CFLAGS-obprintf_chk.c = -D_IO_MTSAFE_IO
-CFLAGS-dprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
-CFLAGS-vdprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
-CFLAGS-printf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
-CFLAGS-fprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
-CFLAGS-vprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
-CFLAGS-vfprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
-CFLAGS-gets_chk.c = -D_IO_MTSAFE_IO $(exceptions)
-CFLAGS-fgets_chk.c = -D_IO_MTSAFE_IO $(exceptions)
-CFLAGS-fgets_u_chk.c = -D_IO_MTSAFE_IO $(exceptions)
-CFLAGS-fread_chk.c = -D_IO_MTSAFE_IO $(exceptions)
-CFLAGS-fread_u_chk.c = -D_IO_MTSAFE_IO $(exceptions)
-CFLAGS-swprintf_chk.c = -D_IO_MTSAFE_IO
-CFLAGS-vswprintf_chk.c = -D_IO_MTSAFE_IO
-CFLAGS-wprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
-CFLAGS-fwprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
-CFLAGS-vwprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
-CFLAGS-vfwprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
-CFLAGS-fgetws_chk.c = -D_IO_MTSAFE_IO $(exceptions)
-CFLAGS-fgetws_u_chk.c = -D_IO_MTSAFE_IO $(exceptions)
+CFLAGS-sprintf_chk.c = $(libio-mtsafe)
+CFLAGS-snprintf_chk.c = $(libio-mtsafe)
+CFLAGS-vsprintf_chk.c = $(libio-mtsafe)
+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-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-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/grp/Makefile b/grp/Makefile
index 127310f0de..384faa062f 100644
--- a/grp/Makefile
+++ b/grp/Makefile
@@ -1,5 +1,4 @@
-# Copyright (C) 1991,1992,1996-2000,2003,2004,2012
-# Free Software Foundation, Inc.
+# Copyright (C) 1991-2012 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -44,8 +43,8 @@ CFLAGS-getgrnam_r.c = -DUSE_NSCD=1 -fexceptions
 CFLAGS-getgrent_r.c = -fexceptions
 CFLAGS-getgrent.c = -fexceptions
 CFLAGS-fgetgrent.c = -fexceptions
-CFLAGS-fgetgrent_r.c = -fexceptions -D_IO_MTSAFE_IO
-CFLAGS-putgrent.c = -fexceptions -D_IO_MTSAFE_IO
+CFLAGS-fgetgrent_r.c = -fexceptions $(libio-mtsafe)
+CFLAGS-putgrent.c = -fexceptions $(libio-mtsafe)
 CFLAGS-initgroups.c = -DUSE_NSCD=1 -fexceptions
 CFLAGS-getgrgid.c = -fexceptions
 
diff --git a/gshadow/Makefile b/gshadow/Makefile
index a482c5d702..2cb714fde9 100644
--- a/gshadow/Makefile
+++ b/gshadow/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 Free Software Foundation, Inc.
+# Copyright (C) 2009-2012 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -29,8 +29,8 @@ tests = tst-gshadow
 CFLAGS-getsgent_r.c = -fexceptions
 CFLAGS-getsgent.c = -fexceptions
 CFLAGS-fgetsgent.c = -fexceptions
-CFLAGS-fgetsgent_r.c = -fexceptions -D_IO_MTSAFE_IO
-CFLAGS-putsgent.c = -fexceptions -D_IO_MTSAFE_IO
+CFLAGS-fgetsgent_r.c = -fexceptions $(libio-mtsafe)
+CFLAGS-putsgent.c = -fexceptions $(libio-mtsafe)
 CFLAGS-getsgnam.c = -fexceptions
 CFLAGS-getsgnam_r.c = -fexceptions
 
diff --git a/libio/Makefile b/libio/Makefile
index 02efe1b3a3..c555dd0004 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -70,14 +70,14 @@ routines += oldiofopen oldiofdopen oldiofclose oldiopopen oldpclose \
 	    oldiofsetpos64
 endif
 
-ifneq (,$(filter %REENTRANT, $(defines)))
+ifeq (yes,$(libc-reentrant))
 routines += clearerr_u feof_u ferror_u fputc_u getc_u getchar_u		      \
 	    iofflush_u putc_u putchar_u peekc iofread_u iofwrite_u iofgets_u  \
 	    iofputs_u
-
-CPPFLAGS += -D_IO_MTSAFE_IO
 endif
 
+CPPFLAGS += $(libio-mtsafe)
+
 # Support for exception handling.
 CFLAGS-fileops.c = $(exceptions)
 CFLAGS-fputc.c = $(exceptions)
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 6f5527242d..8a8cbb8d3d 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,9 @@
+2012-08-15  Roland McGrath  <roland@hack.frob.com>
+
+	* Makefile (CFLAGS-flockfile.c): Use $(libio-mtsafe) instead
+	of -D_IO_MTSAFE_IO.
+	(CFLAGS-ftrylockfile.c, CFLAGS-funlockfile.c): Likewise.
+
 2012-08-16  Joseph Myers  <joseph@codesourcery.com>
 
 	* pthread_cond_timedwait.c (__pthread_cond_timedwait)
diff --git a/nptl/Makefile b/nptl/Makefile
index ef8e874cd8..8cd168d451 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -341,9 +341,9 @@ extra-objs += $(crti-objs) $(crtn-objs)
 extra-objs += pt-crti.o
 endif
 
-CFLAGS-flockfile.c = -D_IO_MTSAFE_IO
-CFLAGS-ftrylockfile.c = -D_IO_MTSAFE_IO
-CFLAGS-funlockfile.c = -D_IO_MTSAFE_IO
+CFLAGS-flockfile.c = $(libio-mtsafe)
+CFLAGS-ftrylockfile.c = $(libio-mtsafe)
+CFLAGS-funlockfile.c = $(libio-mtsafe)
 
 link-libc-static := $(common-objpfx)libc.a $(static-gnulib) \
 		    $(common-objpfx)libc.a
diff --git a/pwd/Makefile b/pwd/Makefile
index 1da4059cb7..52a917f55d 100644
--- a/pwd/Makefile
+++ b/pwd/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991,1996-1999,2003,2004 Free Software Foundation, Inc.
+# Copyright (C) 1991-2012 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -36,6 +36,6 @@ CFLAGS-getpwnam_r.c = -DUSE_NSCD=1
 CFLAGS-getpwent_r.c = -fexceptions
 CFLAGS-getpwent.c = -fexceptions
 CFLAGS-getpw.c = -fexceptions
-CFLAGS-fgetpwent_r.c = -D_IO_MTSAFE_IO
+CFLAGS-fgetpwent_r.c = $(libio-mtsafe)
 
 endif
diff --git a/shadow/Makefile b/shadow/Makefile
index 7c17a7f9be..4b17b29d10 100644
--- a/shadow/Makefile
+++ b/shadow/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1996, 2003, 2004, 2009 Free Software Foundation, Inc.
+# Copyright (C) 1996-2012 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -30,8 +30,8 @@ tests = tst-shadow
 CFLAGS-getspent_r.c = -fexceptions
 CFLAGS-getspent.c = -fexceptions
 CFLAGS-fgetspent.c = -fexceptions
-CFLAGS-fgetspent_r.c = -fexceptions -D_IO_MTSAFE_IO
-CFLAGS-putspent.c = -fexceptions -D_IO_MTSAFE_IO
+CFLAGS-fgetspent_r.c = -fexceptions $(libio-mtsafe)
+CFLAGS-putspent.c = -fexceptions $(libio-mtsafe)
 CFLAGS-getspnam.c = -fexceptions
 CFLAGS-getspnam_r.c = -fexceptions
 
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index a29924bc7c..5d7ab532f4 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -123,9 +123,7 @@ scanf13-ENV = LOCPATH=$(common-objpfx)localedata
 bug14-ENV = LOCPATH=$(common-objpfx)localedata
 tst-grouping-ENV = LOCPATH=$(common-objpfx)localedata
 
-ifneq (,$(filter %REENTRANT, $(defines)))
-CPPFLAGS += -D_IO_MTSAFE_IO
-endif
+CPPFLAGS += $(libio-mtsafe)
 
 $(objpfx)tst-setvbuf1.out: tst-setvbuf1.expect $(objpfx)tst-setvbuf1
 	$(built-program-cmd) > $@ 2>&1
diff --git a/stdio-common/isoc99_scanf.c b/stdio-common/isoc99_scanf.c
index 2e04e700e4..2bd1e512c1 100644
--- a/stdio-common/isoc99_scanf.c
+++ b/stdio-common/isoc99_scanf.c
@@ -28,13 +28,17 @@ __isoc99_scanf (const char *format, ...)
   va_list arg;
   int done;
 
+#ifdef _IO_MTSAFE_IO
   _IO_acquire_lock_clear_flags2 (stdin);
+#endif
   stdin->_flags2 |= _IO_FLAGS2_SCANF_STD;
 
   va_start (arg, format);
   done = _IO_vfscanf (stdin, format, arg, NULL);
   va_end (arg);
 
+#ifdef _IO_MTSAFE_IO
   _IO_release_lock (stdin);
+#endif
   return done;
 }
diff --git a/stdlib/Makefile b/stdlib/Makefile
index 10674f2cd7..39cab1710e 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -100,10 +100,8 @@ CFLAGS-system.c = -fexceptions
 CFLAGS-system.os = -fomit-frame-pointer
 CFLAGS-fmtmsg.c = -fexceptions
 
-ifneq (,$(filter %REENTRANT, $(defines)))
-CFLAGS-strfmon.c = -D_IO_MTSAFE_IO
-CFLAGS-strfmon_l.c = -D_IO_MTSAFE_IO
-endif
+CFLAGS-strfmon.c = $(libio-mtsafe)
+CFLAGS-strfmon_l.c = $(libio-mtsafe)
 
 CFLAGS-tst-bsearch.c = $(stack-align-test-flags)
 CFLAGS-tst-qsort.c = $(stack-align-test-flags)
diff --git a/sysdeps/mach/hurd/Makeconfig b/sysdeps/mach/hurd/Makeconfig
index 1b65bb07aa..fe3b7c553e 100644
--- a/sysdeps/mach/hurd/Makeconfig
+++ b/sysdeps/mach/hurd/Makeconfig
@@ -2,3 +2,6 @@
 # See Makefile in this directory for the rule that builds this.
 # We must define this variable earlier than sysdeps Makefiles are included.
 static-start-installed-name = crt0.o
+
+# GNU libc on the Hurd is always reentrant.
+libc-reentrant = yes
diff --git a/sysdeps/mach/hurd/configure.in b/sysdeps/mach/hurd/configure.in
index 6220142265..ad915a568b 100644
--- a/sysdeps/mach/hurd/configure.in
+++ b/sysdeps/mach/hurd/configure.in
@@ -1,8 +1,5 @@
 GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
 
-# GNU libc on the Hurd is always reentrant.
-DEFINES="$DEFINES -D_LIBC_REENTRANT"
-
 dnl We need this setting because of the need for PLT calls in ld.so.
 AC_DEFINE([NO_HIDDEN])
 
diff --git a/sysdeps/pthread/Makeconfig b/sysdeps/pthread/Makeconfig
new file mode 100644
index 0000000000..2b564eae5d
--- /dev/null
+++ b/sysdeps/pthread/Makeconfig
@@ -0,0 +1,2 @@
+# Compile libc code to do internal locking.
+libc-reentrant = yes
diff --git a/sysdeps/pthread/configure b/sysdeps/pthread/configure
deleted file mode 100644
index e39d31138d..0000000000
--- a/sysdeps/pthread/configure
+++ /dev/null
@@ -1,3 +0,0 @@
-# Local configure fragment for sysdeps/pthread.
-
-DEFINES="$DEFINES -D_LIBC_REENTRANT"
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index 983fd76f61..7402ec9fd6 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -72,9 +72,8 @@ CFLAGS-isoc99_wscanf.c += $(exceptions)
 CFLAGS-isoc99_fwscanf.c += $(exceptions)
 CFLAGS-isoc99_vwscanf.c += $(exceptions)
 CFLAGS-isoc99_vfwscanf.c += $(exceptions)
-ifneq (,$(filter %REENTRANT, $(defines)))
-CPPFLAGS += -D_IO_MTSAFE_IO
-endif
+
+CPPFLAGS += $(libio-mtsafe)
 
 # We need to find the default version of strtold_l in stdlib.
 CPPFLAGS-wcstold_l.c = -I../stdlib