On Fri, Jan 06, 2017 at 05:33:03PM +0100, Jakub Jelinek wrote:
> On Fri, Jan 06, 2017 at 05:12:54PM +0100, Christophe Lyon wrote:
> > This makes all my builds fail.
> > (The *linux* ones are broken after Alexandre's pragma, and
> > this commit breaks the remaining bare-metal configurations).
> > make[2]: Entering directory
> > `/tmp/3119026_6.tmpdir/aci-gcc-fsf/builds/gcc-fsf-gccsrc/obj-aarch64-none-linux-gnu/gcc1/libdecnumber'
> > source='/tmp/3119026_6.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/libdecnumber/decNumber.c'
> > object='decNumber.o' libtool=no gcc  -I/tmp/3
> > 119026_6.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/libdecnumber -I.
> > -fno-lto -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissi
> > ng-prototypes -Wold-style-definition -Wmissing-format-attribute
> > -Wcast-qual -pedantic -Wno-long-long
> > -I/tmp/3119026_6.tmpdir/aci-gcc-fs
> > f/sources/gcc-fsf/gccsrc/libdecnumber -I. -fno-lto  -c
> > /tmp/3119026_6.tmpdir/aci-gcc-fsf/sources/gcc-fsf/gccsrc/libdecnumber/decNumber.c
> > cc1: error: unrecognized command line option "-fno-lto"
> > cc1: error: unrecognized command line option "-fno-lto"
> > 
> > Still using gcc-4.4.7 on RHEL6....
> 
> Actually, I'm surprised it is doing anything, because the toplevel
> Makefile should be doing:
>         $(HOST_EXPORTS)  \
>         (cd $(HOST_SUBDIR)/libdecnumber && \
>           $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) 
> $(STAGE1_FLAGS_TO_PASS)  \
>                 $(TARGET-libdecnumber))
> and both HOST_EXPORTS and BASE_FLAGS_TO_PASS include
>         "CFLAGS=$(CFLAGS)" \
>         "CXXFLAGS=$(CXXFLAGS)" \
>         "LDFLAGS=$(LDFLAGS)" \
> so it should override the libdecnumber/Makefile vars that way.
> In any case, I think libdecnumber/configure* should check for whether
> -fno-lto works and if yes, should substitute it into some var that is then
> CFLAGS += $(NO_LTO)
> CXXFLAGS += $(NO_LTO)
> LDFLAGS += $(NO_LTO)

Trying now:

2017-01-06  Jakub Jelinek  <ja...@redhat.com>

        * Makefile.in (CFLAGS, CPPFLAGS, LDFLAGS): Remove -fno-lto.
        (NOLTO_FLAGS): New variable.
        (ALL_CFLAGS): Use it.
        * configure.ac (nolto_flags): New ACX_PROG_CC_WARNING_OPTS,
        check for whether -fno-lto works.
        * configure: Regenerated.

--- libdecnumber/Makefile.in.jj 2017-01-06 16:58:42.000000000 +0100
+++ libdecnumber/Makefile.in    2017-01-06 17:40:31.520582350 +0100
@@ -31,19 +31,20 @@ ACLOCAL = @ACLOCAL@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 CC = @CC@
-CFLAGS = @CFLAGS@ -fno-lto
+CFLAGS = @CFLAGS@
 WARN_CFLAGS = @WARN_CFLAGS@ @WARN_PEDANTIC@ @WERROR@
 CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@ -fno-lto
+CPPFLAGS = @CPPFLAGS@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
-LDFLAGS = @LDFLAGS@ -fno-lto
+LDFLAGS = @LDFLAGS@
 LIBICONV = @LIBICONV@
 PACKAGE = @PACKAGE@
 PICFLAG = @PICFLAG@
 RANLIB = @RANLIB@
 SHELL = @SHELL@
 objext = @OBJEXT@
+NOLTO_FLAGS = @nolto_flags@
 
 datarootdir = @datarootdir@
 datadir = @datadir@
@@ -58,7 +59,8 @@ enable_decimal_float= @enable_decimal_fl
 
 INCLUDES = -I$(srcdir) -I.
 
-ALL_CFLAGS = $(CFLAGS) $(WARN_CFLAGS) $(INCLUDES) $(CPPFLAGS) $(PICFLAG)
+ALL_CFLAGS = $(CFLAGS) $(WARN_CFLAGS) $(NOLTO_FLAGS) $(INCLUDES) $(CPPFLAGS) \
+            $(PICFLAG)
 
 bid_OBJS = bid2dpd_dpd2bid.$(objext) host-ieee32.$(objext) \
        host-ieee64.$(objext) host-ieee128.$(objext)
--- libdecnumber/configure.ac.jj        2017-01-02 18:15:32.000000000 +0100
+++ libdecnumber/configure.ac   2017-01-06 17:38:37.391078242 +0100
@@ -43,6 +43,8 @@ ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwri
                          -Wmissing-format-attribute -Wcast-qual])
 ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([-Wno-long-long])
 
+ACX_PROG_CC_WARNING_OPTS([-fno-lto], [nolto_flags])
+
 # Only enable with --enable-werror-always until existing warnings are
 # corrected.
 ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual])
--- libdecnumber/configure.jj   2016-11-16 16:38:07.000000000 +0100
+++ libdecnumber/configure      2017-01-06 17:41:44.430626719 +0100
@@ -613,6 +613,7 @@ EGREP
 GREP
 CPP
 WERROR
+nolto_flags
 WARN_PEDANTIC
 WARN_CFLAGS
 AUTOHEADER
@@ -3377,6 +3378,64 @@ fi
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext 
$LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext 
$LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+nolto_flags=
+save_CFLAGS="$CFLAGS"
+for real_option in -fno-lto; do
+  # Do the check with the no- prefix removed since gcc silently
+  # accepts any -Wno-* option on purpose
+  case $real_option in
+    -Wno-*) option=-W`expr x$real_option : 'x-Wno-\(.*\)'` ;;
+    *) option=$real_option ;;
+  esac
+  as_acx_Woption=`$as_echo "acx_cv_prog_cc_warning_$option" | $as_tr_sh`
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports 
$option" >&5
+$as_echo_n "checking whether $CC supports $option... " >&6; }
+if { as_var=$as_acx_Woption; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  CFLAGS="$option"
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$as_acx_Woption=yes"
+else
+  eval "$as_acx_Woption=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+eval ac_res=\$$as_acx_Woption
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  if test `eval 'as_val=${'$as_acx_Woption'};$as_echo "$as_val"'` = yes; then :
+  nolto_flags="$nolto_flags${nolto_flags:+ }$real_option"
+fi
+  done
+CFLAGS="$save_CFLAGS"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext 
$LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 


        Jakub

Reply via email to