[PATCH] Don't use -frandom-seed=$@ to build libbacktrace unconditionally (PR bootstrap/54926)
Jakub Jelinek
jakub@redhat.com
Tue Dec 11 18:37:00 GMT 2012
Hi!
Richard noticed that bootstrap with very old GCC as system compiler failed
(as one of the reasons) because -frandom-seed=dwarf.lo etc. was used to
compile the host libbacktrace in stage1. Non-GCC compilers presumably don't
support that option either.
The following patch fixes it by adding it unconditionally only for target
libbacktrace and otherwise testing, if the option is supported.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2012-12-11 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/54926
* Makefile.am (AM_CFLAGS): Remove -frandom-seed=$@.
* configure.ac: If --with-target-subdir, add -frandom-seed=$@
to EXTRA_FLAGS unconditionally, otherwise check whether the compiler
accepts it.
* Makefile.in: Regenerated.
* configure: Regenerated.
--- libbacktrace/Makefile.am.jj 2012-12-07 15:13:56.000000000 +0100
+++ libbacktrace/Makefile.am 2012-12-11 12:30:48.498852727 +0100
@@ -34,7 +34,7 @@ ACLOCAL_AMFLAGS = -I .. -I ../config
AM_CPPFLAGS = -I $(top_srcdir)/../include -I $(top_srcdir)/../libgcc \
-I ../libgcc -I ../gcc/include -I $(MULTIBUILDTOP)../../gcc/include
-AM_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) $(PIC_FLAG) -frandom-seed=$@
+AM_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) $(PIC_FLAG)
noinst_LTLIBRARIES = libbacktrace.la
--- libbacktrace/configure.ac.jj 2012-11-14 08:13:38.000000000 +0100
+++ libbacktrace/configure.ac 2012-12-11 12:30:29.466962449 +0100
@@ -98,7 +98,7 @@ AC_SUBST(BACKTRACE_FILE)
EXTRA_FLAGS=
if test -n "${with_target_subdir}"; then
- EXTRA_FLAGS=-funwind-tables
+ EXTRA_FLAGS="-funwind-tables -frandom-seed=\$@"
else
AC_CACHE_CHECK([for -funwind-tables option],
[libbacktrace_cv_c_unwind_tables],
@@ -109,9 +109,21 @@ else
[libbacktrace_cv_c_unwind_tables=yes],
[libbacktrace_cv_c_unwind_tables=no])
CFLAGS="$CFLAGS_hold"])
- if test "$libbacktrace_cv_c_unwind_tables" = "yes"; then
- EXTRA_FLAGS=-funwind-tables
- fi
+ if test "$libbacktrace_cv_c_unwind_tables" = "yes"; then
+ EXTRA_FLAGS=-funwind-tables
+ fi
+ AC_CACHE_CHECK([for -frandom-seed=string option],
+ [libbacktrace_cv_c_random_seed_string],
+ [CFLAGS_hold="$CFLAGS"
+ CFLAGS="$CFLAGS -frandom-seed=conftest.lo"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([], [return 0;])],
+ [libbacktrace_cv_c_random_seed_string=yes],
+ [libbacktrace_cv_c_random_seed_string=no])
+ CFLAGS="$CFLAGS_hold"])
+ if test "$libbacktrace_cv_c_random_seed_string" = "yes"; then
+ EXTRA_FLAGS="$EXTRA_FLAGS -frandom-seed=\$@"
+ fi
fi
AC_SUBST(EXTRA_FLAGS)
--- libbacktrace/Makefile.in.jj 2012-12-07 15:13:56.000000000 +0100
+++ libbacktrace/Makefile.in 2012-12-11 12:31:05.951752225 +0100
@@ -254,7 +254,7 @@ ACLOCAL_AMFLAGS = -I .. -I ../config
AM_CPPFLAGS = -I $(top_srcdir)/../include -I $(top_srcdir)/../libgcc \
-I ../libgcc -I ../gcc/include -I $(MULTIBUILDTOP)../../gcc/include
-AM_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) $(PIC_FLAG) -frandom-seed=$@
+AM_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) $(PIC_FLAG)
noinst_LTLIBRARIES = libbacktrace.la
libbacktrace_la_SOURCES = \
backtrace.h \
--- libbacktrace/configure.jj 2012-11-14 08:13:38.000000000 +0100
+++ libbacktrace/configure 2012-12-11 12:31:19.217675175 +0100
@@ -11491,7 +11491,7 @@ fi
EXTRA_FLAGS=
if test -n "${with_target_subdir}"; then
- EXTRA_FLAGS=-funwind-tables
+ EXTRA_FLAGS="-funwind-tables -frandom-seed=\$@"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -funwind-tables option" >&5
$as_echo_n "checking for -funwind-tables option... " >&6; }
@@ -11521,9 +11521,40 @@ rm -f core conftest.err conftest.$ac_obj
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libbacktrace_cv_c_unwind_tables" >&5
$as_echo "$libbacktrace_cv_c_unwind_tables" >&6; }
- if test "$libbacktrace_cv_c_unwind_tables" = "yes"; then
- EXTRA_FLAGS=-funwind-tables
- fi
+ if test "$libbacktrace_cv_c_unwind_tables" = "yes"; then
+ EXTRA_FLAGS=-funwind-tables
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -frandom-seed=string option" >&5
+$as_echo_n "checking for -frandom-seed=string option... " >&6; }
+if test "${libbacktrace_cv_c_random_seed_string+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ CFLAGS_hold="$CFLAGS"
+ CFLAGS="$CFLAGS -frandom-seed=conftest.lo"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ libbacktrace_cv_c_random_seed_string=yes
+else
+ libbacktrace_cv_c_random_seed_string=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CFLAGS="$CFLAGS_hold"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libbacktrace_cv_c_random_seed_string" >&5
+$as_echo "$libbacktrace_cv_c_random_seed_string" >&6; }
+ if test "$libbacktrace_cv_c_random_seed_string" = "yes"; then
+ EXTRA_FLAGS="$EXTRA_FLAGS -frandom-seed=\$@"
+ fi
fi
Jakub
More information about the Gcc-patches
mailing list