Hi!

On Wed, 18 Feb 2015 13:35:18 +0100, Jakub Jelinek <ja...@redhat.com> wrote:
> On Wed, Feb 18, 2015 at 01:09:53PM +0100, Thomas Schwinge wrote:
> > On Wed, 18 Feb 2015 12:34:38 +0100, Jakub Jelinek <ja...@redhat.com> wrote:
> > > offloading fails:
> > > 
> > > /usr/src/gcc/objnvptxinst/usr/local/bin/../libexec/gcc/x86_64-pc-linux-gnu/5.0.0//accel/nvptx-none/mkoffload
> > >  @/tmp/cce9PdmR
> > > x86_64-pc-linux-gnu-accel-nvptx-none-gcc: error: language lto not 
> > > recognized
> > > x86_64-pc-linux-gnu-accel-nvptx-none-gcc: error: language lto not 
> > > recognized
> > > mkoffload: fatal error: 
> > > /usr/src/gcc/objnvptxinst/usr/local/bin/x86_64-pc-linux-gnu-accel-nvptx-none-gcc
> > >  returned 1 exit status
> > > compilation terminated.
> > > lto-wrapper: fatal error: 
> > > /usr/src/gcc/objnvptxinst/usr/local/bin/../libexec/gcc/x86_64-pc-linux-gnu/5.0.0//accel/nvptx-none/mkoffload
> > >  returned 1 exit status
> > > compilation terminated.
> > > /usr/bin/ld: lto-wrapper failed
> > > collect2: error: ld returned 1 exit status
> > > 
> > > Is --enable-languages=c,c++,fortran,lto required when configuring the
> > > offload compiler?  It isn't required for intelmic.
> > 
> > Yes, exactly.  I assume the reason is that x86_64-intelmicemul-linux-gnu
> > defaults to supporting LTO, and due to this also defaults to building the
> > LTO front end.  I'll enhance the nvptx offloading documentation
> > accordingly.  Maybe we should add some "magic" to build the LTO front end
> > if --enable-as-accelerator-for=[...] has been specified?
> 
> Toplevel configure.ac has:
>   # If LTO is enabled, add the LTO front end.
>   if test "$enable_lto" = "yes" ; then
>     case ,${enable_languages}, in
>       *,lto,*) ;;
>       *) enable_languages="${enable_languages},lto" ;;
>     esac
>     if test "${build_lto_plugin}" = "yes" ; then
>       configdirs="$configdirs lto-plugin"
>     fi
>   fi
> so IMHO we want similar snippet for the --enable-as-accelerator-for= case,
> perhaps right below this one.  Not building lto FE for the accelerator
> compilers make them completely useless, thus I think we really want to do
> that automatically.

Like this?

commit 56c0312469f583ba3fa9fa2777981742ab6d6c75
Author: Thomas Schwinge <tho...@codesourcery.com>
Date:   Thu Feb 19 11:41:23 2015 +0100

    If we're building an offloading compiler, always enable the LTO front end.
    
        * configure.ac [--enable-as-accelerator-for] (enable_languages):
        Make sure it contains lto.
        * configure: Regenerate.
---
 configure    |    8 ++++++++
 configure.ac |    8 ++++++++
 2 files changed, 16 insertions(+)

diff --git configure configure
index dd794db..2afc52b 100755
--- configure
+++ configure
@@ -6217,6 +6217,14 @@ if test -d ${srcdir}/gcc; then
     fi
   fi
 
+  # If we're building an offloading compiler, add the LTO front end.
+  if test x"$enable_as_accelerator_for" != x ; then
+    case ,${enable_languages}, in
+      *,lto,*) ;;
+      *) enable_languages="${enable_languages},lto" ;;
+    esac
+  fi
+
   missing_languages=`echo ",$enable_languages," | sed -e s/,all,/,/ -e 
s/,c,/,/ `
   potential_languages=,c,
 
diff --git configure.ac configure.ac
index 4ea5e00..08a6fbf 100644
--- configure.ac
+++ configure.ac
@@ -1918,6 +1918,14 @@ if test -d ${srcdir}/gcc; then
     fi
   fi
 
+  # If we're building an offloading compiler, add the LTO front end.
+  if test x"$enable_as_accelerator_for" != x ; then
+    case ,${enable_languages}, in
+      *,lto,*) ;;
+      *) enable_languages="${enable_languages},lto" ;;
+    esac
+  fi
+
   missing_languages=`echo ",$enable_languages," | sed -e s/,all,/,/ -e 
s/,c,/,/ `
   potential_languages=,c,
 


Grüße,
 Thomas

Attachment: pgpnYFvMGYhBl.pgp
Description: PGP signature

Reply via email to