This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [lto] add a --with-libelf configure option


2009/5/25 Andrew Pinski <pinskia@gmail.com>:
> Maybe it is better to have the toplevel configure or config.gcc
> disable LTO if it is not elf rather than checking if it is an elf
> target. ?Most targets are elf, only a few are not and I think it is
> easier to disable if they are not many rather than enable for the ones
> that are elf.

IMO, it's better to check target in toplevel configure and stop the configure
immediately when the target doesn't support LTO.

To assume the target doesn't support LTO by default may avoid mistakes
for the targets that they don't support LTO but we forget to disable them.

But, I also have a question. What if target=local ?

* configure.ac: Check whether the target support LTO.
* configure: Regenerate.

Index: configure.ac
===================================================================
--- configure.ac        (revision 147859)
+++ configure.ac        (working copy)
@@ -1450,6 +1450,32 @@ fi
 AC_SUBST(clooglibs)
 AC_SUBST(clooginc)

+# Set whether the target support LTO. Default value is no.
+target_support_lto=no
+case $target in
+  # place holder
+  *-*-freebsd[[12]] | *-*-freebsd[[12]].* | *-*-freebsd*aout*)
+  ;;
+  # Though these will be detected in config.gcc as unsupported,
+  # there're listed here for right logic.
+  *-*-linux*aout* | *-*-linux*oldld*)
+  ;;
+  # common targets
+  *-*-eabi* | *-*-elf | *-*-freebsd* | *-*-gnu* | *-*-irix[[56]]* | \
+  *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-kopensolaris*-gnu | \
+  *-*-linux* | *-*-lynxos* | *-*-netbsd* | *-*-netware* | *-*-openbsd* | \
+  *-*-rtems* | *-*-solaris2* | *-*-symbianelf* | *-*-uclinux* | \
+  *-*-vxworks* | *-linux* | *-rtems*)
+  target_support_lto=yes
+  ;;
+  # specific targets
+  bfin*-* | crisv32-*-none | cris-*-none | hppa*64*-*-hpux11* | \
+  i[[34567]]86-*-nto-qnx* | ia64*-*-hpux* | m68*-*-* | mn10300-*-* | \
+  s390x-*-tpf* | v850*-*-*)
+  target_support_lto=yes
+  ;;
+esac
+
 # Check for LTO support.
 AC_ARG_ENABLE(lto,
 [  --enable-lto            enable link time optimization support],
@@ -1521,8 +1547,15 @@ if test x"$enable_lto" = x"yes" ; then
       enable_lto=no
     fi
   fi
-fi

+  if test x"$target_support_lto" != x"yes"; then
+    if test x"$default_enable_lto" != x"yes" ; then
+      AC_MSG_ERROR([Target doesn't support LTO.])
+    else
+      enable_lto=no
+    fi
+  fi
+fi

 # By default, C is the only stage 1 language.
 stage1_languages=,c,

Thanks
Eric Fisher


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]