diff mbox

If we're building an offloading compiler, always enable the LTO front end (was: nvptx offloading patches [3/n], RFD)

Message ID 87bnkqdvny.fsf@schwinge.name
State New
Headers show

Commit Message

Thomas Schwinge Feb. 19, 2015, 10:48 a.m. UTC
Hi!

On Wed, 18 Feb 2015 13:35:18 +0100, Jakub Jelinek <jakub@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 <jakub@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 <thomas@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(+)



Grüße,
 Thomas

Comments

Jakub Jelinek Feb. 19, 2015, 10:51 a.m. UTC | #1
On Thu, Feb 19, 2015 at 11:48:17AM +0100, Thomas Schwinge wrote:
> Like this?

Yes.

> commit 56c0312469f583ba3fa9fa2777981742ab6d6c75
> Author: Thomas Schwinge <thomas@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.

Ok for trunk.

	Jakub
Thomas Schwinge Feb. 20, 2015, 9:41 a.m. UTC | #2
Hi!

On Thu, 19 Feb 2015 11:51:02 +0100, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Feb 19, 2015 at 11:48:17AM +0100, Thomas Schwinge wrote:
> > Like this?
> 
> Yes.
> 
> > commit 56c0312469f583ba3fa9fa2777981742ab6d6c75
> > Author: Thomas Schwinge <thomas@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.
> 
> Ok for trunk.

Committed in r220838.


Grüße,
 Thomas
diff mbox

Patch

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,