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/21 Diego Novillo <dnovillo@google.com>:
>
> Thanks. ?I committed a similar patch recently. ?However, my patch is
> missing a part that you may be interested in addressing. ?The
> detection of libelf is only done for the host, but we should also
> detect that the target file format is also ELF.

I'm not sure whether LTO should support all of the ELF targets. So the
patch doesn't check for this.

Eric Fisher <joefoxreal@gmail.com>
  * configure.ac: Check for elf target. Issue an error if --enable-lto
is used and it's not an elf target.
  * configure: Regenerate.

Index: configure.ac
===================================================================
--- configure.ac        (revision 147794)
+++ configure.ac        (working copy)
@@ -1521,6 +1521,29 @@ if test x"$enable_lto" = x"yes" ; then
       enable_lto=no
     fi
   fi
+
+  # Check for ELF target.
+  is_elf=no
+  case "${target}" in
+    *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
+    | *-*-linux* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
+    | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-solaris2*)
+      case "${target}" in
+        *-*-linux*aout* | *-*-linux*oldld*)
+          ;;
+        *)
+          is_elf=yes
+          ;;
+      esac
+  esac
+
+  if test "$is_elf" != "yes"; then
+    if test x"$default_enable_lto" != x"yes" ; then
+      AC_MSG_ERROR([LTO support requires ELF target.])
+    else
+      enable_lto=no
+    fi
+  fi
 fi

Best wishes
Eric Fisher


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