mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-21 01:12:26 +08:00
BZ#10375: Configure magic to use -U_FORTIFY_SOURCE if needed.
This commit is contained in:
parent
90c885c87b
commit
61653dfb81
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
||||
2012-05-16 Roland McGrath <roland@hack.frob.com>
|
||||
|
||||
[BZ #10375]
|
||||
* configure.in: Check for _FORTIFY_SOURCE being predefined.
|
||||
(CPPUNDEFS): New substituted variable; add -U_FORTIFY_SOURCE if needed.
|
||||
* configure: Regenerated.
|
||||
* config.make.in (CPPUNDEFS): New substituted variable.
|
||||
* Makeconfig (CPPFLAGS): Put $(CPPUNDEFS) at the beginning.
|
||||
* Makerules ($(stdio_lim:h=st)): Use $(CPPUNDEFS).
|
||||
* time/ctime.c: Don't #undef __OPTIMIZE__ and ctime.
|
||||
|
||||
2012-05-16 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
* sysdeps/unix/sysv/linux/bits/mqueue.h: Include <bits/types.h>.
|
||||
|
@ -661,7 +661,8 @@ libio-include = -I$(..)libio
|
||||
# Note that we can't use -std=* in CPPFLAGS, because it overrides
|
||||
# the implicit -lang-asm and breaks cpp behavior for .S files--notably
|
||||
# it causes cpp to stop predefining __ASSEMBLER__.
|
||||
CPPFLAGS = $(CPPFLAGS-config) $($(subdir)-CPPFLAGS) $(+includes) $(defines) \
|
||||
CPPFLAGS = $(CPPUNDEFS) $(CPPFLAGS-config) $($(subdir)-CPPFLAGS) \
|
||||
$(+includes) $(defines) \
|
||||
-include $(..)include/libc-symbols.h $(sysdep-CPPFLAGS) \
|
||||
$(CPPFLAGS-$(suffix $@)) \
|
||||
$(foreach lib,$(libof-$(basename $(@F))) \
|
||||
|
@ -1233,7 +1233,7 @@ $(stdio_lim:h=st): $(..)stdio-common/stdio_lim.h.in $(..)Rules \
|
||||
echo '#define _LIBC 1'; \
|
||||
echo '#include "$(..)misc/sys/uio.h"'; } | \
|
||||
$(CC) -E -dM -MD -MP -MF $(@:st=dT) -MT '$(@:st=h) $(@:st=d)' \
|
||||
$(+includes) -xc - -o $(@:st=hT)
|
||||
$(CPPUNDEFS) $(+includes) -xc - -o $(@:st=hT)
|
||||
sed $(sed-remove-objpfx) $(sed-remove-dotdot) \
|
||||
$(@:st=dT) > $(@:st=dt)
|
||||
mv -f $(@:st=dt) $(@:st=d)
|
||||
|
@ -104,6 +104,7 @@ CXX = @CXX@
|
||||
BUILD_CC = @BUILD_CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS-config = @CPPFLAGS@
|
||||
CPPUNDEFS = @CPPUNDEFS@
|
||||
ASFLAGS-config = @ASFLAGS_config@
|
||||
AR = @AR@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
|
35
configure
vendored
35
configure
vendored
@ -632,6 +632,7 @@ libc_cv_localedir
|
||||
libc_cv_slibdir
|
||||
old_glibc_headers
|
||||
libc_cv_gcc_unwind_find_fde
|
||||
CPPUNDEFS
|
||||
sizeof_long_double
|
||||
EGREP
|
||||
GREP
|
||||
@ -7542,6 +7543,40 @@ _ACEOF
|
||||
sizeof_long_double=$ac_cv_sizeof_long_double
|
||||
|
||||
|
||||
CPPUNDEFS=
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FORTIFY_SOURCE predefine" >&5
|
||||
$as_echo_n "checking for _FORTIFY_SOURCE predefine... " >&6; }
|
||||
if ${libc_cv_predef_fortify_source+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
#ifdef _FORTIFY_SOURCE
|
||||
# error bogon
|
||||
#endif
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
libc_cv_predef_fortify_source=no
|
||||
else
|
||||
libc_cv_predef_fortify_source=yes
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_predef_fortify_source" >&5
|
||||
$as_echo "$libc_cv_predef_fortify_source" >&6; }
|
||||
if test $libc_cv_predef_fortify_source = yes; then
|
||||
CPPUNDEFS="${CPPUNDEFS:+$CPPUNDEFS }-U_FORTIFY_SOURCE"
|
||||
fi
|
||||
|
||||
|
||||
### End of automated tests.
|
||||
### Now run sysdeps configure fragments.
|
||||
|
||||
|
16
configure.in
16
configure.in
@ -2036,6 +2036,22 @@ AC_CHECK_SIZEOF(long double, 0)
|
||||
sizeof_long_double=$ac_cv_sizeof_long_double
|
||||
AC_SUBST(sizeof_long_double)
|
||||
|
||||
CPPUNDEFS=
|
||||
dnl Check for silly hacked compilers predefining _FORTIFY_SOURCE.
|
||||
dnl Since we are building the implementations of the fortified functions here,
|
||||
dnl having the macro defined interacts very badly.
|
||||
AC_CACHE_CHECK([for _FORTIFY_SOURCE predefine], libc_cv_predef_fortify_source,
|
||||
[AC_TRY_COMPILE([], [
|
||||
#ifdef _FORTIFY_SOURCE
|
||||
# error bogon
|
||||
#endif],
|
||||
[libc_cv_predef_fortify_source=no],
|
||||
[libc_cv_predef_fortify_source=yes])])
|
||||
if test $libc_cv_predef_fortify_source = yes; then
|
||||
CPPUNDEFS="${CPPUNDEFS:+$CPPUNDEFS }-U_FORTIFY_SOURCE"
|
||||
fi
|
||||
AC_SUBST(CPPUNDEFS)
|
||||
|
||||
### End of automated tests.
|
||||
### Now run sysdeps configure fragments.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 1996 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
|
||||
@ -15,12 +15,8 @@
|
||||
License along with the GNU C Library; if not, see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#undef __OPTIMIZE__ /* Avoid inline `ctime' function. */
|
||||
#include <time.h>
|
||||
|
||||
#undef ctime
|
||||
|
||||
|
||||
/* Return a string as returned by asctime which
|
||||
is the representation of *T in that form. */
|
||||
char *
|
||||
|
Loading…
Reference in New Issue
Block a user