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]

[PATCH] Fix PR41529


This adds non-ELF target detection to the toplevel configure
and disables LTO appropriately.

Tested by configuring for i686-darwin with and without --enable-lto
and on x86_64-linux with and without --enable-lto.

I only went through the list of primary and secondary targets to
identify non-ELF targets.  Others can be added on-the-fly when needed.

Ok for trunk?

Thanks,
Richard.

2010-01-02  Richard Guenther  <rguenther@suse.de>

	PR lto/41529
	* configure.ac: Include config/elf.m4.  Disable LTO if not
	builting for an elf target.
	* configure: Regenerate.

	config/
	* elf.m4: New file.

Index: configure.ac
===================================================================
*** configure.ac	(revision 155564)
--- configure.ac	(working copy)
***************
*** 22,27 ****
--- 22,28 ----
  m4_include(config/acx.m4)
  m4_include(config/override.m4)
  m4_include(config/proginstall.m4)
+ m4_include(config/elf.m4)
  
  AC_INIT(move-if-change)
  AC_PREREQ(2.64)
*************** AC_ARG_ENABLE(lto,
*** 1601,1606 ****
--- 1602,1617 ----
  enable_lto=$enableval,
  enable_lto=yes; default_enable_lto=yes)
  
+ ACX_ELF_TARGET_IFELSE([],
+ if test x"$default_enable_lto" = x"yes" ; then
+   enable_lto=no
+ else
+   if test x"$enable_lto" = x"yes"; then
+     AC_MSG_ERROR([LTO support requires an ELF target.])
+   fi
+ fi
+ default_enable_lto=no)
+ 
  if test x"$enable_lto" = x"yes" ; then
    # Make sure that libelf.h and gelf.h are available.
    AC_ARG_WITH(libelf, [  --with-libelf=PATH       Specify prefix directory for the installed libelf package
Index: config/elf.m4
===================================================================
*** config/elf.m4	(revision 0)
--- config/elf.m4	(revision 0)
***************
*** 0 ****
--- 1,25 ----
+ dnl Copyright (C) 2010 Free Software Foundation, Inc.
+ dnl This file is free software, distributed under the terms of the GNU
+ dnl General Public License.  As a special exception to the GNU General
+ dnl Public License, this file may be distributed as part of a program
+ dnl that contains a configuration script generated by Autoconf, under
+ dnl the same distribution terms as the rest of that program.
+ 
+ dnl From Paolo Bonzini.
+ 
+ dnl usage: ACX_ELF_TARGET_IFELSE([if-elf], [if-not-elf])
+ AC_DEFUN([ACX_ELF_TARGET_IFELSE], [
+ AC_REQUIRE([AC_CANONICAL_TARGET])
+ 
+ target_elf=no
+ case $target in
+   *-darwin* | *-aix* | *-cygwin* | *-mingw*)
+     target_elf=no
+     ;;
+   *)
+     target_elf=yes
+     ;;
+ esac
+ 
+ AS_IF([test $target_elf = yes], [$1], [$2])
+ ])
Index: configure
===================================================================
*** configure	(revision 155564)
--- configure	(working copy)
*************** else
*** 5889,5894 ****
--- 5889,5921 ----
  fi
  
  
+ 
+ 
+ 
+ target_elf=no
+ case $target in
+   *-darwin* | *-aix* | *-cygwin* | *-mingw*)
+     target_elf=no
+     ;;
+   *)
+     target_elf=yes
+     ;;
+ esac
+ 
+ if test $target_elf = yes; then :
+ 
+ else
+   if test x"$default_enable_lto" = x"yes" ; then
+   enable_lto=no
+ else
+   if test x"$enable_lto" = x"yes"; then
+     as_fn_error "LTO support requires an ELF target." "$LINENO" 5
+   fi
+ fi
+ default_enable_lto=no
+ fi
+ 
+ 
  if test x"$enable_lto" = x"yes" ; then
    # Make sure that libelf.h and gelf.h are available.
  


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