[PATCH 1/7] OpenMP 4.0 offloading infrastructure: configure and make
authorBernd Schmidt <bernds@codesourcery.com>
Thu, 13 Nov 2014 13:28:56 +0000 (13:28 +0000)
committerKirill Yukhin <kyukhin@gcc.gnu.org>
Thu, 13 Nov 2014 13:28:56 +0000 (13:28 +0000)
* configure: Regenerate.
* configure.ac (--enable-as-accelerator-for)
(--enable-offload-targets): New configure options.
gcc/
* Makefile.in (real_target_noncanonical, accel_dir_suffix)
(enable_as_accelerator): New variables substituted by configure.
(libsubdir, libexecsubdir, unlibsubdir): Tweak for the possibility of
being configured as an offload compiler.
(DRIVER_DEFINES): Pass new defines DEFAULT_REAL_TARGET_MACHINE and
ACCEL_DIR_SUFFIX.
(install-cpp, install-common, install_driver, install-gcc-ar): Do not
install for the offload compiler.
* config.in: Regenerate.
* configure: Regenerate.
* configure.ac (real_target_noncanonical, accel_dir_suffix)
(enable_as_accelerator): Compute new variables.
(ACCEL_COMPILER): Define if the compiler is built as the accel compiler.
(OFFLOAD_TARGETS): List of target names suitable for offloading.
(ENABLE_OFFLOADING): Define if list of offload targets is not empty.
gcc/cp/
* Make-lang.in (c++.install-common): Do not install for the offload
compiler.
gcc/doc/
* install.texi (Options specification): Document
--enable-as-accelerator-for and --enable-offload-targets.
gcc/fortran/
* Make-lang.in (fortran.install-common): Do not install for the offload
compiler.
libgcc/
* Makefile.in (crtoffloadbegin$(objext)): New rule.
(crtoffloadend$(objext)): Likewise.
* configure: Regenerate.
* configure.ac (accel_dir_suffix): Compute new variable.
(extra_parts): Add crtoffloadbegin.o and crtoffloadend.o
if enable_offload_targets is not empty.
* offloadstuff.c: New file.
libgomp/
* config.h.in: Regenerate.
* configure: Regenerate.
* configure.ac: Check for libdl, required for plugin support.
(PLUGIN_SUPPORT): Define if plugins are supported.
(enable_offload_targets): Support Intel MIC targets.
(OFFLOAD_TARGETS): List of target names suitable for offloading.
lto-plugin/
* Makefile.am (libexecsubdir): Tweak for the possibility of being
configured for offload compiler.
(accel_dir_suffix, real_target_noncanonical): New variables substituted
by configure.
* Makefile.in: Regenerate.
* configure: Regenerate.
* configure.ac (accel_dir_suffix, real_target_noncanonical): Compute new
variables.

Co-Authored-By: Andrey Turetskiy <andrey.turetskiy@intel.com>
Co-Authored-By: Ilya Verbin <ilya.verbin@intel.com>
Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
From-SVN: r217485

27 files changed:
ChangeLog
configure
configure.ac
gcc/ChangeLog
gcc/Makefile.in
gcc/config.in
gcc/configure
gcc/configure.ac
gcc/cp/ChangeLog
gcc/cp/Make-lang.in
gcc/doc/install.texi
gcc/fortran/ChangeLog
gcc/fortran/Make-lang.in
libgcc/ChangeLog
libgcc/Makefile.in
libgcc/configure
libgcc/configure.ac
libgcc/offloadstuff.c [new file with mode: 0644]
libgomp/ChangeLog
libgomp/config.h.in
libgomp/configure
libgomp/configure.ac
lto-plugin/ChangeLog
lto-plugin/Makefile.am
lto-plugin/Makefile.in
lto-plugin/configure
lto-plugin/configure.ac

index bc99f9b60b51be3dce46ebea54412fdfbe6b0839..e1db052d1509d89ad3477a5e05604038d6c0a20c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2014-11-13  Bernd Schmidt  <bernds@codesourcery.com>
+           Thomas Schwinge  <thomas@codesourcery.com>
+           Ilya Verbin  <ilya.verbin@intel.com>
+           Andrey Turetskiy  <andrey.turetskiy@intel.com>
+
+       * configure: Regenerate.
+       * configure.ac (--enable-as-accelerator-for)
+       (--enable-offload-targets): New configure options.
+
 2014-11-11  Tobias Burnus  <burnus@net-b.de>
 
        * Makefile.def: Make all-gcc depend on all-isl.
index 7213c1b8f136b566083e935128fa62038ec3d44e..69d968bc583f37b57e6c88b1107a5b1ff31f3a15 100755 (executable)
--- a/configure
+++ b/configure
@@ -745,6 +745,8 @@ ospace_frag'
 ac_user_opts='
 enable_option_checking
 with_build_libsubdir
+enable_as_accelerator_for
+enable_offload_targets
 enable_gold
 enable_ld
 enable_libquadmath
@@ -1460,6 +1462,13 @@ Optional Features:
   --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-as-accelerator-for=ARG
+                          build as offload target compiler. Specify offload
+                          host triple by ARG
+  --enable-offload-targets=LIST
+                          enable offloading to devices from comma-separated
+                          LIST of TARGET[=DIR]. Use optional path to find
+                          offload target compiler during the build
   --enable-gold[=ARG]     build gold [ARG={default,yes,no}]
   --enable-ld[=ARG]       build ld [ARG={default,yes,no}]
   --disable-libquadmath   do not build libquadmath directory
@@ -2877,6 +2886,26 @@ case ${with_newlib} in
   yes) skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` ;;
 esac
 
+# Check whether --enable-as-accelerator-for was given.
+if test "${enable_as_accelerator_for+set}" = set; then :
+  enableval=$enable_as_accelerator_for; ENABLE_AS_ACCELERATOR_FOR=$enableval
+else
+  ENABLE_AS_ACCELERATOR_FOR=no
+fi
+
+
+# Check whether --enable-offload-targets was given.
+if test "${enable_offload_targets+set}" = set; then :
+  enableval=$enable_offload_targets;
+  if test x"$enable_offload_targets" = x; then
+    as_fn_error "no offload targets specified" "$LINENO" 5
+  fi
+
+else
+  enable_offload_targets=
+fi
+
+
 # Handle --enable-gold, --enable-ld.
 # --disable-gold [--enable-ld]
 #     Build only ld.  Default option.
index 2c958a2e729f2feeb3b2786c935a0cc1765374ad..6c4c954bdf62604f0535240c4ae5bac2692de0f0 100644 (file)
@@ -285,6 +285,24 @@ case ${with_newlib} in
   yes) skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` ;;
 esac
 
+AC_ARG_ENABLE(as-accelerator-for,
+[AS_HELP_STRING([--enable-as-accelerator-for=ARG],
+               [build as offload target compiler.
+               Specify offload host triple by ARG])],
+ENABLE_AS_ACCELERATOR_FOR=$enableval,
+ENABLE_AS_ACCELERATOR_FOR=no)
+
+AC_ARG_ENABLE(offload-targets,
+[AS_HELP_STRING([--enable-offload-targets=LIST],
+               [enable offloading to devices from comma-separated LIST of
+               TARGET[=DIR]. Use optional path to find offload target compiler
+               during the build])],
+[
+  if test x"$enable_offload_targets" = x; then
+    AC_MSG_ERROR([no offload targets specified])
+  fi
+], [enable_offload_targets=])
+
 # Handle --enable-gold, --enable-ld.
 # --disable-gold [--enable-ld]
 #     Build only ld.  Default option.
index d909f67067cff512f28fb972a955715d4cf3e76e..80df1888a3b7717a8bcb00884dbeca31fd83f1ea 100644 (file)
@@ -1,3 +1,26 @@
+2014-11-13  Bernd Schmidt  <bernds@codesourcery.com>
+           Thomas Schwinge  <thomas@codesourcery.com>
+           Ilya Verbin  <ilya.verbin@intel.com>
+           Andrey Turetskiy  <andrey.turetskiy@intel.com>
+
+       * Makefile.in (real_target_noncanonical, accel_dir_suffix)
+       (enable_as_accelerator): New variables substituted by configure.
+       (libsubdir, libexecsubdir, unlibsubdir): Tweak for the possibility of
+       being configured as an offload compiler.
+       (DRIVER_DEFINES): Pass new defines DEFAULT_REAL_TARGET_MACHINE and
+       ACCEL_DIR_SUFFIX.
+       (install-cpp, install-common, install_driver, install-gcc-ar): Do not
+       install for the offload compiler.
+       * config.in: Regenerate.
+       * configure: Regenerate.
+       * configure.ac (real_target_noncanonical, accel_dir_suffix)
+       (enable_as_accelerator): Compute new variables.
+       (ACCEL_COMPILER): Define if the compiler is built as the accel compiler.
+       (OFFLOAD_TARGETS): List of target names suitable for offloading.
+       (ENABLE_OFFLOADING): Define if list of offload targets is not empty.
+       * doc/install.texi (Options specification): Document
+       --enable-as-accelerator-for and --enable-offload-targets.
+
 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR tree-optimization/63828
index 88c3f8975ff7390d1601b12c88a64cc90c82ec96..7c546832c0ff28bb3983d761ba96ff41c18ca994 100644 (file)
@@ -59,6 +59,11 @@ host=@host@
 target=@target@
 target_noncanonical:=@target_noncanonical@
 
+# Normally identical to target_noncanonical, except for compilers built
+# as accelerator targets.
+real_target_noncanonical:=@real_target_noncanonical@
+accel_dir_suffix = @accel_dir_suffix@
+
 # Sed command to transform gcc to installed name.
 program_transform_name := @program_transform_name@
 
@@ -363,6 +368,8 @@ enable_plugin = @enable_plugin@
 
 enable_host_shared = @enable_host_shared@
 
+enable_as_accelerator = @enable_as_accelerator@
+
 CPPLIB = ../libcpp/libcpp.a
 CPPINC = -I$(srcdir)/../libcpp/include
 
@@ -574,9 +581,9 @@ libexecdir = @libexecdir@
 # --------
 
 # Directory in which the compiler finds libraries etc.
-libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(version)
+libsubdir = $(libdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
 # Directory in which the compiler finds executables
-libexecsubdir = $(libexecdir)/gcc/$(target_noncanonical)/$(version)
+libexecsubdir = $(libexecdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
 # Directory in which all plugin resources are installed
 plugin_resourcesdir = $(libsubdir)/plugin
  # Directory in which plugin headers are installed
@@ -584,7 +591,11 @@ plugin_includedir = $(plugin_resourcesdir)/include
 # Directory in which plugin specific executables are installed
 plugin_bindir = $(libexecsubdir)/plugin
 # Used to produce a relative $(gcc_tooldir) in gcc.o
+ifeq ($(enable_as_accelerator),yes)
+unlibsubdir = ../../../../..
+else
 unlibsubdir = ../../..
+endif
 # $(prefix), expressed as a path relative to $(libsubdir).
 #
 # An explanation of the sed strings:
@@ -1957,9 +1968,11 @@ DRIVER_DEFINES = \
   -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc/\" \
   -DSTANDARD_LIBEXEC_PREFIX=\"$(libexecdir)/gcc/\" \
   -DDEFAULT_TARGET_VERSION=\"$(version)\" \
+  -DDEFAULT_REAL_TARGET_MACHINE=\"$(real_target_noncanonical)\" \
   -DDEFAULT_TARGET_MACHINE=\"$(target_noncanonical)\" \
   -DSTANDARD_BINDIR_PREFIX=\"$(bindir)/\" \
   -DTOOLDIR_BASE_PREFIX=\"$(libsubdir_to_prefix)$(prefix_to_exec_prefix)\" \
+  -DACCEL_DIR_SUFFIX=\"$(accel_dir_suffix)\" \
   @TARGET_SYSTEM_ROOT_DEFINE@ \
   $(VALGRIND_DRIVER_DEFINES) \
   $(if $(SHLIB),$(if $(filter yes,@enable_shared@),-DENABLE_SHARED_LIBGCC)) \
@@ -3164,12 +3177,14 @@ install-strip: install
 
 # Handle cpp installation.
 install-cpp: installdirs cpp$(exeext)
-       -rm -f $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext)
-       -$(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext)
-       -if [ x$(cpp_install_dir) != x ]; then \
-         rm -f $(DESTDIR)$(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \
-         $(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(DESTDIR)$(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \
-       else true; fi
+       -if test "$(enable_as_accelerator)" != "yes" ; then \
+         rm -f $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext); \
+         $(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext); \
+         if [ x$(cpp_install_dir) != x ]; then \
+           rm -f $(DESTDIR)$(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \
+           $(INSTALL_PROGRAM) -m 755 cpp$(exeext) $(DESTDIR)$(prefix)/$(cpp_install_dir)/$(CPP_INSTALL_NAME)$(exeext); \
+         else true; fi; \
+       fi
 
 # Create the installation directories.
 # $(libdir)/gcc/include isn't currently searched by cpp.
@@ -3277,17 +3292,21 @@ install-common: native lang.install-common installdirs
 # otherwise override the specs built into the driver.
        rm -f $(DESTDIR)$(libsubdir)/specs
 # Install gcov if it was compiled.
-       -if [ -f gcov$(exeext) ]; \
-       then \
+       -if test "$(enable_as_accelerator)" != "yes" ; then \
+         if [ -f gcov$(exeext) ]; \
+         then \
            rm -f $(DESTDIR)$(bindir)/$(GCOV_INSTALL_NAME)$(exeext); \
            $(INSTALL_PROGRAM) gcov$(exeext) $(DESTDIR)$(bindir)/$(GCOV_INSTALL_NAME)$(exeext); \
+         fi; \
        fi
 # Install gcov-tool if it was compiled.
-       -if [ -f gcov-tool$(exeext) ]; \
-       then \
+       -if test "$(enable_as_accelerator)" != "yes" ; then \
+         if [ -f gcov-tool$(exeext) ]; \
+         then \
            rm -f $(DESTDIR)$(bindir)/$(GCOV_TOOL_INSTALL_NAME)$(exeext); \
            $(INSTALL_PROGRAM) \
            gcov-tool$(exeext) $(DESTDIR)$(bindir)/$(GCOV_TOOL_INSTALL_NAME)$(exeext); \
+         fi; \
        fi
 
 # Install the driver program as $(target_noncanonical)-gcc,
@@ -3295,17 +3314,19 @@ install-common: native lang.install-common installdirs
 install-driver: installdirs xgcc$(exeext)
        -rm -f $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext)
        -$(INSTALL_PROGRAM) xgcc$(exeext) $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext)
-       -if [ "$(GCC_INSTALL_NAME)" != "$(target_noncanonical)-gcc-$(version)" ]; then \
-         rm -f $(DESTDIR)$(bindir)/$(FULL_DRIVER_NAME); \
-         ( cd $(DESTDIR)$(bindir) && \
-           $(LN) $(GCC_INSTALL_NAME)$(exeext) $(FULL_DRIVER_NAME) ); \
-       fi
-       -if [ ! -f gcc-cross$(exeext) ] \
-           && [ "$(GCC_INSTALL_NAME)" != "$(GCC_TARGET_INSTALL_NAME)" ]; then \
-         rm -f $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-tmp$(exeext); \
-         ( cd $(DESTDIR)$(bindir) && \
-           $(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_noncanonical)-gcc-tmp$(exeext) && \
-           mv -f $(target_noncanonical)-gcc-tmp$(exeext) $(GCC_TARGET_INSTALL_NAME)$(exeext) ); \
+       -if test "$(enable_as_accelerator)" != "yes" ; then \
+         if [ "$(GCC_INSTALL_NAME)" != "$(target_noncanonical)-gcc-$(version)" ]; then \
+           rm -f $(DESTDIR)$(bindir)/$(FULL_DRIVER_NAME); \
+           ( cd $(DESTDIR)$(bindir) && \
+             $(LN) $(GCC_INSTALL_NAME)$(exeext) $(FULL_DRIVER_NAME) ); \
+         fi; \
+         if [ ! -f gcc-cross$(exeext) ] \
+             && [ "$(GCC_INSTALL_NAME)" != "$(GCC_TARGET_INSTALL_NAME)" ]; then \
+           rm -f $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-tmp$(exeext); \
+           ( cd $(DESTDIR)$(bindir) && \
+             $(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_noncanonical)-gcc-tmp$(exeext) && \
+             mv -f $(target_noncanonical)-gcc-tmp$(exeext) $(GCC_TARGET_INSTALL_NAME)$(exeext) ); \
+         fi; \
        fi
 
 # Install the info files.
@@ -3502,19 +3523,21 @@ install-lto-wrapper: lto-wrapper$(exeext)
        $(INSTALL_PROGRAM) lto-wrapper$(exeext) $(DESTDIR)$(libexecsubdir)/lto-wrapper$(exeext)
 
 install-gcc-ar: installdirs gcc-ar$(exeext) gcc-nm$(exeext) gcc-ranlib$(exeext)
-       for i in gcc-ar gcc-nm gcc-ranlib; do \
-         install_name=`echo $$i|sed '$(program_transform_name)'` ;\
-         target_install_name=$(target_noncanonical)-`echo $$i|sed '$(program_transform_name)'` ; \
-         rm -f $(DESTDIR)$(bindir)/$$install_name$(exeext) ; \
-         $(INSTALL_PROGRAM) $$i$(exeext) $(DESTDIR)$(bindir)/$$install_name$(exeext) ;\
-         if test -f gcc-cross$(exeext); then \
-           :; \
-         else \
-           rm -f $(DESTDIR)$(bindir)/$$target_install_name$(exeext); \
-           ( cd $(DESTDIR)$(bindir) && \
-             $(LN) $$install_name$(exeext) $$target_install_name$(exeext) ) ; \
-         fi ; \
-       done
+       if test "$(enable_as_accelerator)" != "yes" ; then \
+         for i in gcc-ar gcc-nm gcc-ranlib; do \
+           install_name=`echo $$i|sed '$(program_transform_name)'` ;\
+           target_install_name=$(target_noncanonical)-`echo $$i|sed '$(program_transform_name)'` ; \
+           rm -f $(DESTDIR)$(bindir)/$$install_name$(exeext) ; \
+           $(INSTALL_PROGRAM) $$i$(exeext) $(DESTDIR)$(bindir)/$$install_name$(exeext) ;\
+           if test -f gcc-cross$(exeext); then \
+             :; \
+           else \
+             rm -f $(DESTDIR)$(bindir)/$$target_install_name$(exeext); \
+             ( cd $(DESTDIR)$(bindir) && \
+               $(LN) $$install_name$(exeext) $$target_install_name$(exeext) ) ; \
+           fi ; \
+         done; \
+       fi
 
 # Cancel installation by deleting the installed files.
 uninstall: lang.uninstall
index 520b5f71fafad9db5863feb9612243b68329d11a..9d1ad863b5fd825a92b812f7c46a4ae8850d709c 100644 (file)
@@ -1,5 +1,11 @@
 /* config.in.  Generated from configure.ac by autoheader.  */
 
+/* Define if this compiler should be built as the offload target compiler. */
+#ifndef USED_FOR_TARGET
+#undef ACCEL_COMPILER
+#endif
+
+
 /* Define if building universal (internal helper macro) */
 #ifndef USED_FOR_TARGET
 #undef AC_APPLE_UNIVERSAL_BUILD
 #endif
 
 
+/* Define this to enable support for offloading. */
+#ifndef USED_FOR_TARGET
+#undef ENABLE_OFFLOADING
+#endif
+
+
 /* Define to enable plugin support. */
 #ifndef USED_FOR_TARGET
 #undef ENABLE_PLUGIN
 #endif
 
 
+/* Define to hold the list of target names suitable for offloading. */
+#ifndef USED_FOR_TARGET
+#undef OFFLOAD_TARGETS
+#endif
+
+
 /* Define to the address where bug reports for this package should be sent. */
 #ifndef USED_FOR_TARGET
 #undef PACKAGE_BUGREPORT
index 064b438304a0aea735aa6ddd8eef49be48299b2f..ebc314965a7eb938bafbe9b1d362f2d7a126b395 100755 (executable)
@@ -760,6 +760,9 @@ LN
 LN_S
 AWK
 SET_MAKE
+accel_dir_suffix
+real_target_noncanonical
+enable_as_accelerator
 REPORT_BUGS_TEXI
 REPORT_BUGS_TO
 PKGVERSION
@@ -3198,6 +3201,10 @@ esac
 
 
 
+# Used for constructing correct paths for offload compilers.
+real_target_noncanonical=${target_noncanonical}
+accel_dir_suffix=
+
 # Determine the target- and build-specific subdirectories
 
 # post-stage1 host modules use a different CC_FOR_BUILD so, in order to
@@ -7395,6 +7402,45 @@ else
 fi
 
 
+if test x"$enable_as_accelerator_for" != x; then
+
+$as_echo "#define ACCEL_COMPILER 1" >>confdefs.h
+
+  enable_as_accelerator=yes
+  case "${target}" in
+    *-intelmicemul-*)
+      # In this case we expect offload compiler to be built as native, so we
+      # need to rename the driver to avoid clashes with host's drivers.
+      program_transform_name="s&^&${target}-&" ;;
+  esac
+  sedscript="s#${target_noncanonical}#${enable_as_accelerator_for}-accel-${target_noncanonical}#"
+  program_transform_name=`echo $program_transform_name | sed $sedscript`
+  accel_dir_suffix=/accel/${target_noncanonical}
+  real_target_noncanonical=${enable_as_accelerator_for}
+fi
+
+
+
+
+for tgt in `echo $enable_offload_targets | sed 's/,/ /g'`; do
+  tgt=`echo $tgt | sed 's/=.*//'`
+  if test x"$offload_targets" = x; then
+    offload_targets=$tgt
+  else
+    offload_targets="$offload_targets:$tgt"
+  fi
+done
+
+cat >>confdefs.h <<_ACEOF
+#define OFFLOAD_TARGETS "$offload_targets"
+_ACEOF
+
+if test x"$offload_targets" != x; then
+
+$as_echo "#define ENABLE_OFFLOADING 1" >>confdefs.h
+
+fi
+
 
 # Check whether --with-multilib-list was given.
 if test "${with_multilib_list+set}" = set; then :
@@ -18094,7 +18140,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18097 "configure"
+#line 18143 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18200,7 +18246,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18203 "configure"
+#line 18249 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
index 8be5479591e87cb5fc9036e36c0b6890714862ac..0f7ab894ec55179d9bdbb438a4200927ed059595 100644 (file)
@@ -38,6 +38,10 @@ AC_CANONICAL_TARGET
 # Determine the noncanonical target name, for directory use.
 ACX_NONCANONICAL_TARGET
 
+# Used for constructing correct paths for offload compilers.
+real_target_noncanonical=${target_noncanonical}
+accel_dir_suffix=
+
 # Determine the target- and build-specific subdirectories
 GCC_TOPLEV_SUBDIRS
 
@@ -883,6 +887,40 @@ AC_ARG_ENABLE(languages,
 esac],
 [enable_languages=c])
 
+if test x"$enable_as_accelerator_for" != x; then
+  AC_DEFINE(ACCEL_COMPILER, 1,
+    [Define if this compiler should be built as the offload target compiler.])
+  enable_as_accelerator=yes
+  case "${target}" in
+    *-intelmicemul-*)
+      # In this case we expect offload compiler to be built as native, so we
+      # need to rename the driver to avoid clashes with host's drivers.
+      program_transform_name="s&^&${target}-&" ;;
+  esac
+  sedscript="s#${target_noncanonical}#${enable_as_accelerator_for}-accel-${target_noncanonical}#"
+  program_transform_name=`echo $program_transform_name | sed $sedscript`
+  accel_dir_suffix=/accel/${target_noncanonical}
+  real_target_noncanonical=${enable_as_accelerator_for}
+fi
+AC_SUBST(enable_as_accelerator)
+AC_SUBST(real_target_noncanonical)
+AC_SUBST(accel_dir_suffix)
+
+for tgt in `echo $enable_offload_targets | sed 's/,/ /g'`; do
+  tgt=`echo $tgt | sed 's/=.*//'`
+  if test x"$offload_targets" = x; then
+    offload_targets=$tgt
+  else
+    offload_targets="$offload_targets:$tgt"
+  fi
+done
+AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets",
+  [Define to hold the list of target names suitable for offloading.])
+if test x"$offload_targets" != x; then
+  AC_DEFINE(ENABLE_OFFLOADING, 1,
+    [Define this to enable support for offloading.])
+fi
+
 AC_ARG_WITH(multilib-list,
 [AS_HELP_STRING([--with-multilib-list], [select multilibs (AArch64, SH and x86-64 only)])],
 :,
index d4351e7b87c59dcbd1800bce7789c256de3fa3a7..26aa986a2f389b16031c59a47e7c07047b69334c 100644 (file)
@@ -1,3 +1,11 @@
+2014-11-13  Bernd Schmidt  <bernds@codesourcery.com>
+           Thomas Schwinge  <thomas@codesourcery.com>
+           Ilya Verbin  <ilya.verbin@intel.com>
+           Andrey Turetskiy  <andrey.turetskiy@intel.com>
+
+       * Make-lang.in (c++.install-common): Do not install for the offload
+       compiler.
+
 2014-11-13  Kai Tietz  <ktietz@redhat.com>
 
        * cp-tree.h (cp_build_function_call): Remove prototype.
index 1c8fa6680960b51476c9c0dc7234c06e8cfc460c..a58819a6e328fc09fb78edfaf707c8dd2bd74ac9 100644 (file)
@@ -164,21 +164,23 @@ check_g++_parallelize = 10000
 # Install the driver program as $(target)-g++ and $(target)-c++, and
 # also as g++ and c++ if native.
 c++.install-common: installdirs
-       -rm -f $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext)
-       -$(INSTALL_PROGRAM) xg++$(exeext) $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext)
-       -chmod a+x $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext)
-       -rm -f $(DESTDIR)$(bindir)/$(CXX_INSTALL_NAME)$(exeext)
-       -( cd $(DESTDIR)$(bindir) && \
-             $(LN) $(GXX_INSTALL_NAME)$(exeext) $(CXX_INSTALL_NAME)$(exeext) )
-       -if [ -f cc1plus$(exeext) ] ; then \
-         if [ ! -f g++-cross$(exeext) ] ; then \
-           rm -f $(DESTDIR)$(bindir)/$(GXX_TARGET_INSTALL_NAME)$(exeext); \
-           ( cd $(DESTDIR)$(bindir) && \
-             $(LN) $(GXX_INSTALL_NAME)$(exeext) $(GXX_TARGET_INSTALL_NAME)$(exeext) ); \
-           rm -f $(DESTDIR)$(bindir)/$(CXX_TARGET_INSTALL_NAME)$(exeext); \
-           ( cd $(DESTDIR)$(bindir) && \
-             $(LN) $(CXX_INSTALL_NAME)$(exeext) $(CXX_TARGET_INSTALL_NAME)$(exeext) ); \
-         fi ; \
+       -if test "$(enable_as_accelerator)" != "yes" ; then \
+         rm -f $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
+         $(INSTALL_PROGRAM) xg++$(exeext) $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
+         chmod a+x $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext); \
+         rm -f $(DESTDIR)$(bindir)/$(CXX_INSTALL_NAME)$(exeext); \
+         ( cd $(DESTDIR)$(bindir) && \
+           $(LN) $(GXX_INSTALL_NAME)$(exeext) $(CXX_INSTALL_NAME)$(exeext) ); \
+         if [ -f cc1plus$(exeext) ] ; then \
+           if [ ! -f g++-cross$(exeext) ] ; then \
+             rm -f $(DESTDIR)$(bindir)/$(GXX_TARGET_INSTALL_NAME)$(exeext); \
+             ( cd $(DESTDIR)$(bindir) && \
+               $(LN) $(GXX_INSTALL_NAME)$(exeext) $(GXX_TARGET_INSTALL_NAME)$(exeext) ); \
+             rm -f $(DESTDIR)$(bindir)/$(CXX_TARGET_INSTALL_NAME)$(exeext); \
+             ( cd $(DESTDIR)$(bindir) && \
+               $(LN) $(CXX_INSTALL_NAME)$(exeext) $(CXX_TARGET_INSTALL_NAME)$(exeext) ); \
+           fi ; \
+         fi; \
        fi
 
 # We can't use links because not everyone supports them.  So just copy the
index f314cf20978ed91bc60ef5254d57983d96acdbf9..64c66f9d5e4c34dc4faf52f7a923bcb9c7002f4a 100644 (file)
@@ -1845,6 +1845,20 @@ If GCC is configured with some multilibs that use glibc and some that
 do not, this option applies only to the multilibs that use glibc.
 However, such configurations may not work well as not all the relevant
 configuration in GCC is on a per-multilib basis.
+
+@item --enable-as-accelerator-for=@var{target}
+Build as offload target compiler. Specify offload host triple by @var{target}.
+
+@item --enable-offload-targets=@var{target1}[=@var{path1}],@dots{},@var{targetN}[=@var{pathN}]
+Enable offloading to targets @var{target1}, @dots{}, @var{targetN}.
+Offload compilers are expected to be already installed.  Default search
+path for them is @file{@var{exec-prefix}}, but it can be changed by
+specifying paths @var{path1}, @dots{}, @var{pathN}.
+
+@smallexample
+% @var{srcdir}/configure \
+    --enable-offload-target=i686-unknown-linux-gnu=/path/to/i686/compiler,x86_64-pc-linux-gnu
+@end smallexample
 @end table
 
 @subheading Cross-Compiler-Specific Options
index 7fd573cd39c36eecb97cb6ff31e0cc8a463d7e90..ec1b7b5b6cf855ecd80238cedcdb79113fbb6bad 100644 (file)
@@ -1,3 +1,11 @@
+2014-11-13  Bernd Schmidt  <bernds@codesourcery.com>
+           Thomas Schwinge  <thomas@codesourcery.com>
+           Ilya Verbin  <ilya.verbin@intel.com>
+           Andrey Turetskiy  <andrey.turetskiy@intel.com>
+
+       * Make-lang.in (fortran.install-common): Do not install for the offload
+       compiler.
+
 2014-11-11  Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
        PR fortran/44054
index ca0a4e603af3562e57c409fc2b00b0c6ce8307d7..3621b4f1202ee34313a55a60b7b8f44114c2f0df 100644 (file)
@@ -235,14 +235,16 @@ install-finclude-dir: installdirs
 # Install the driver program as $(target)-gfortran, and also as gfortran
 # if native.
 fortran.install-common: install-finclude-dir installdirs
-       -if [ -f f951$(exeext) ] ; then \
-         rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
-         $(INSTALL_PROGRAM) gfortran$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
-         chmod a+x $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
-         if [ ! -f gfortran-cross$(exeext) ] ; then \
-           rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
-           $(LN) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
-         fi ; \
+       -if test "$(enable_as_accelerator)" != "yes" ; then \
+         if [ -f f951$(exeext) ] ; then \
+           rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
+           $(INSTALL_PROGRAM) gfortran$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
+           chmod a+x $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
+           if [ ! -f gfortran-cross$(exeext) ] ; then \
+             rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
+             $(LN) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
+           fi ; \
+         fi; \
        fi
 
 fortran.install-plugin:
index 6bbea5ebc968b40a27d6ff41014bd6bcb13e141f..296a9e4792dbc293c96025b3df3c7c909995d62f 100644 (file)
@@ -1,3 +1,16 @@
+2014-11-13  Bernd Schmidt  <bernds@codesourcery.com>
+           Thomas Schwinge  <thomas@codesourcery.com>
+           Ilya Verbin  <ilya.verbin@intel.com>
+           Andrey Turetskiy  <andrey.turetskiy@intel.com>
+
+       * Makefile.in (crtoffloadbegin$(objext)): New rule.
+       (crtoffloadend$(objext)): Likewise.
+       * configure: Regenerate.
+       * configure.ac (accel_dir_suffix): Compute new variable.
+       (extra_parts): Add crtoffloadbegin.o and crtoffloadend.o
+       if enable_offload_targets is not empty.
+       * offloadstuff.c: New file.
+
 2014-11-13  Nick Clifton  <nickc@redhat.com>
 
        * config/rl78/divmodhi.S: Add support for the G10 architecture.
index 357e15c37614ce7a5dad44aaaeba9fc652314320..f0506f26620c0bae024038d9c667a82ae527f43d 100644 (file)
@@ -184,7 +184,7 @@ STRIP = @STRIP@
 STRIP_FOR_TARGET = $(STRIP)
 
 # Directory in which the compiler finds libraries etc.
-libsubdir = $(libdir)/gcc/$(host_noncanonical)/$(version)
+libsubdir = $(libdir)/gcc/$(host_noncanonical)/$(version)@accel_dir_suffix@
 # Used to install the shared libgcc.
 slibdir = @slibdir@
 # Maybe used for DLLs on Windows targets.
@@ -995,6 +995,14 @@ crtendS$(objext): $(srcdir)/crtstuff.c
 crtbeginT$(objext): $(srcdir)/crtstuff.c
        $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN -DCRTSTUFFT_O
 
+# crtoffloadbegin and crtoffloadend contain symbols, that mark the begin and
+# the end of tables with addresses, required for offloading.
+crtoffloadbegin$(objext): $(srcdir)/offloadstuff.c
+       $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN
+
+crtoffloadend$(objext): $(srcdir)/offloadstuff.c
+       $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_END
+
 ifeq ($(enable_vtable_verify),yes)
 # These are used in vtable verification; see comments in source files for
 # more details.
index 3f53aafacaa574dfe0eb43a19b9ed58101c7edea..87924653210b506dccc6a2e0039e6f15697c0048 100644 (file)
@@ -566,6 +566,7 @@ sfp_machine_header
 set_use_emutls
 set_have_cc_tls
 vis_hide
+accel_dir_suffix
 force_explicit_eh_registry
 fixed_point
 enable_decimal_float
@@ -4451,6 +4452,23 @@ esac
 # Collect host-machine-specific information.
 . ${srcdir}/config.host
 
+# Used for constructing correct paths for offload compilers.
+accel_dir_suffix=
+if test x"$enable_as_accelerator_for" != x; then
+  accel_dir_suffix=/accel/${target_noncanonical}
+  case "${target_noncanonical}" in
+    *-intelmicemul-*)
+      # In this case we expect offload compiler to be built as native, so we
+      # need to change install directory for driver to be able to find libgcc.
+      host_noncanonical=${enable_as_accelerator_for} ;;
+  esac
+fi
+
+
+if test x"$enable_offload_targets" != x; then
+  extra_parts="${extra_parts} crtoffloadbegin.o crtoffloadend.o"
+fi
+
 # Check if Solaris/x86 linker supports ZERO terminator unwind entries.
 # This is after config.host so we can augment tmake_file.
 # Link with -nostartfiles -nodefaultlibs since neither are present while
index 79d0ea43493edc612bfb3eaebab2da52e2623cf4..ab9c5562e288a8bb87779fa4b8c2e3a9f18d4260 100644 (file)
@@ -379,6 +379,23 @@ esac
 # Collect host-machine-specific information.
 . ${srcdir}/config.host
 
+# Used for constructing correct paths for offload compilers.
+accel_dir_suffix=
+if test x"$enable_as_accelerator_for" != x; then
+  accel_dir_suffix=/accel/${target_noncanonical}
+  case "${target_noncanonical}" in
+    *-intelmicemul-*)
+      # In this case we expect offload compiler to be built as native, so we
+      # need to change install directory for driver to be able to find libgcc.
+      host_noncanonical=${enable_as_accelerator_for} ;;
+  esac
+fi
+AC_SUBST(accel_dir_suffix)
+
+if test x"$enable_offload_targets" != x; then
+  extra_parts="${extra_parts} crtoffloadbegin.o crtoffloadend.o"
+fi
+
 # Check if Solaris/x86 linker supports ZERO terminator unwind entries.
 # This is after config.host so we can augment tmake_file.
 # Link with -nostartfiles -nodefaultlibs since neither are present while
diff --git a/libgcc/offloadstuff.c b/libgcc/offloadstuff.c
new file mode 100644 (file)
index 0000000..273189d
--- /dev/null
@@ -0,0 +1,80 @@
+/* Specialized bits of code needed for the offloading tables.
+   Copyright (C) 2014 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+/* Target machine header files require this define. */
+#define IN_LIBGCC2
+
+/* FIXME: Including auto-host is incorrect, but until we have
+   identified the set of defines that need to go into auto-target.h,
+   this will have to do.  */
+#include "auto-host.h"
+#undef caddr_t
+#undef pid_t
+#undef rlim_t
+#undef ssize_t
+#undef vfork
+#include "tconfig.h"
+#include "tsystem.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "libgcc_tm.h"
+
+#define OFFLOAD_FUNC_TABLE_SECTION_NAME ".gnu.offload_funcs"
+#define OFFLOAD_VAR_TABLE_SECTION_NAME ".gnu.offload_vars"
+
+#ifdef CRT_BEGIN
+
+#if defined(HAVE_GAS_HIDDEN) && defined(ENABLE_OFFLOADING)
+void *__offload_func_table[0]
+  __attribute__ ((__used__, visibility ("hidden"),
+                 section (OFFLOAD_FUNC_TABLE_SECTION_NAME))) = { };
+void *__offload_var_table[0]
+  __attribute__ ((__used__, visibility ("hidden"),
+                 section (OFFLOAD_VAR_TABLE_SECTION_NAME))) = { };
+#endif
+
+#elif defined CRT_END
+
+#if defined(HAVE_GAS_HIDDEN) && defined(ENABLE_OFFLOADING)
+void *__offload_funcs_end[0]
+  __attribute__ ((__used__, visibility ("hidden"),
+                 section (OFFLOAD_FUNC_TABLE_SECTION_NAME))) = { };
+void *__offload_vars_end[0]
+  __attribute__ ((__used__, visibility ("hidden"),
+                 section (OFFLOAD_VAR_TABLE_SECTION_NAME))) = { };
+
+extern void *__offload_func_table[];
+extern void *__offload_var_table[];
+
+void *__OFFLOAD_TABLE__[]
+  __attribute__ ((__visibility__ ("hidden"))) =
+{
+  &__offload_func_table, &__offload_funcs_end,
+  &__offload_var_table, &__offload_vars_end
+};
+#endif
+
+#else /* ! CRT_BEGIN && ! CRT_END */
+#error "One of CRT_BEGIN or CRT_END must be defined."
+#endif
index 53a9e68b7e562ddc7db86c3ad1a5ebef4ec3f4bb..df1d820f8d8bd268bee0aa9be5f1558ff88d1747 100644 (file)
@@ -1,3 +1,15 @@
+2014-11-13  Bernd Schmidt  <bernds@codesourcery.com>
+           Thomas Schwinge  <thomas@codesourcery.com>
+           Ilya Verbin  <ilya.verbin@intel.com>
+           Andrey Turetskiy  <andrey.turetskiy@intel.com>
+
+       * config.h.in: Regenerate.
+       * configure: Regenerate.
+       * configure.ac: Check for libdl, required for plugin support.
+       (PLUGIN_SUPPORT): Define if plugins are supported.
+       (enable_offload_targets): Support Intel MIC targets.
+       (OFFLOAD_TARGETS): List of target names suitable for offloading.
+
 2014-11-11  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
        PR target/63610
index 14c7e2a9a1bda2a0223106cb3688f4975f4148b5..94a2b3b3b32490d29ea2faa5a14471dba7cb68e1 100644 (file)
@@ -30,6 +30,9 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the `dl' library (-ldl). */
+#undef HAVE_LIBDL
+
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
@@ -86,6 +89,9 @@
    */
 #undef LT_OBJDIR
 
+/* Define to hold the list of target names suitable for offloading. */
+#undef OFFLOAD_TARGETS
+
 /* Name of package */
 #undef PACKAGE
 
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
+/* Define if all infrastructure, needed for plugins, is supported. */
+#undef PLUGIN_SUPPORT
+
 /* The size of `char', as computed by sizeof. */
 #undef SIZEOF_CHAR
 
index 0f553aa80a3cd67ef9aeb466896ebe4b42fe94e2..7cd20b1bca1324a2c653b6eb7b50a29b8948b2ac 100755 (executable)
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 
+plugin_support=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlsym in -ldl" >&5
+$as_echo_n "checking for dlsym in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlsym+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlsym ();
+int
+main ()
+{
+return dlsym ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dl_dlsym=yes
+else
+  ac_cv_lib_dl_dlsym=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlsym" >&5
+$as_echo "$ac_cv_lib_dl_dlsym" >&6; }
+if test "x$ac_cv_lib_dl_dlsym" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBDL 1
+_ACEOF
+
+  LIBS="-ldl $LIBS"
+
+else
+  plugin_support=no
+fi
+
+if test x"$plugin_support" = xyes; then
+
+$as_echo "#define PLUGIN_SUPPORT 1" >>confdefs.h
+
+fi
+
 # Check for functions needed.
 for ac_func in getloadavg clock_gettime strtoull
 do :
@@ -16153,6 +16207,29 @@ else
   multilib_arg=
 fi
 
+offload_targets=
+if test x"$enable_offload_targets" != x; then
+  for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do
+    tgt=`echo $tgt | sed 's/=.*//'`
+    case $tgt in
+      *-intelmic-* | *-intelmicemul-*)
+       tgt_name="intelmic" ;;
+      *)
+       as_fn_error "unknown offload target specified" "$LINENO" 5 ;;
+    esac
+    if test x"$offload_targets" = x; then
+      offload_targets=$tgt_name
+    else
+      offload_targets=$offload_targets,$tgt_name
+    fi
+  done
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define OFFLOAD_TARGETS "$offload_targets"
+_ACEOF
+
+
 # Set up the set of libraries that we need to link against for libgomp.
 # Note that the GOMP_SELF_SPEC in gcc.c may force -pthread,
 # which will force linkage against -lpthread (or equivalent for the system).
index 84d250f0b19a237538ff2be3d9810a3c32e99adf..3f34ff8ee5fd68e7e9e2ce993231218c73e342be 100644 (file)
@@ -193,6 +193,13 @@ AC_LINK_IFELSE(
    [],
    [AC_MSG_ERROR([Pthreads are required to build libgomp])])])
 
+plugin_support=yes
+AC_CHECK_LIB(dl, dlsym, , [plugin_support=no])
+if test x"$plugin_support" = xyes; then
+  AC_DEFINE(PLUGIN_SUPPORT, 1,
+    [Define if all infrastructure, needed for plugins, is supported.])
+fi
+
 # Check for functions needed.
 AC_CHECK_FUNCS(getloadavg clock_gettime strtoull)
 
@@ -273,6 +280,26 @@ else
   multilib_arg=
 fi
 
+offload_targets=
+if test x"$enable_offload_targets" != x; then
+  for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do
+    tgt=`echo $tgt | sed 's/=.*//'`
+    case $tgt in
+      *-intelmic-* | *-intelmicemul-*)
+       tgt_name="intelmic" ;;
+      *)
+       AC_MSG_ERROR([unknown offload target specified]) ;;
+    esac
+    if test x"$offload_targets" = x; then
+      offload_targets=$tgt_name
+    else
+      offload_targets=$offload_targets,$tgt_name
+    fi
+  done
+fi
+AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets",
+  [Define to hold the list of target names suitable for offloading.])
+
 # Set up the set of libraries that we need to link against for libgomp.
 # Note that the GOMP_SELF_SPEC in gcc.c may force -pthread,
 # which will force linkage against -lpthread (or equivalent for the system).
index 0bb13540db0d6fb1db3fda4ceff062df4bbb5854..195ab453a4a298bda7d134cd3feae8e489c4f633 100644 (file)
@@ -1,3 +1,17 @@
+2014-11-13  Bernd Schmidt  <bernds@codesourcery.com>
+           Thomas Schwinge  <thomas@codesourcery.com>
+           Ilya Verbin  <ilya.verbin@intel.com>
+           Andrey Turetskiy  <andrey.turetskiy@intel.com>
+
+       * Makefile.am (libexecsubdir): Tweak for the possibility of being
+       configured for offload compiler.
+       (accel_dir_suffix, real_target_noncanonical): New variables substituted
+       by configure.
+       * Makefile.in: Regenerate.
+       * configure: Regenerate.
+       * configure.ac (accel_dir_suffix, real_target_noncanonical): Compute new
+       variables.
+
 2014-11-11  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
        PR target/63610
index 93ea6498c552ed6105e9baa6d290c72652704550..c637ecb5743fbb5ff3f6d376af76cb22be343c83 100644 (file)
@@ -5,7 +5,7 @@ AUTOMAKE_OPTIONS = no-dependencies
 
 gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
 target_noncanonical := @target_noncanonical@
-libexecsubdir := $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version)
+libexecsubdir := $(libexecdir)/gcc/$(real_target_noncanonical)/$(gcc_version)$(accel_dir_suffix)
 
 AM_CPPFLAGS = -I$(top_srcdir)/../include $(DEFS)
 AM_CFLAGS = @ac_lto_plugin_warn_cflags@
index b15d90197dc63cb682a57bd5154ca4ec9d96e7b6..4bd943bdb013d05f0aa3ee4e6315f962f3c528ae 100644 (file)
@@ -167,6 +167,7 @@ ac_ct_CC = @ac_ct_CC@
 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 ac_lto_plugin_ldflags = @ac_lto_plugin_ldflags@
 ac_lto_plugin_warn_cflags = @ac_lto_plugin_warn_cflags@
+accel_dir_suffix = @accel_dir_suffix@
 am__include = @am__include@
 am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
@@ -209,6 +210,7 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+real_target_noncanonical = @real_target_noncanonical@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -227,7 +229,7 @@ with_libiberty = @with_libiberty@
 ACLOCAL_AMFLAGS = -I .. -I ../config
 AUTOMAKE_OPTIONS = no-dependencies
 gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
-libexecsubdir := $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version)
+libexecsubdir := $(libexecdir)/gcc/$(real_target_noncanonical)/$(gcc_version)$(accel_dir_suffix)
 AM_CPPFLAGS = -I$(top_srcdir)/../include $(DEFS)
 AM_CFLAGS = @ac_lto_plugin_warn_cflags@
 AM_LDFLAGS = @ac_lto_plugin_ldflags@
index 5f3dd2220201f13e77dbdf1e3a31d08281a7acb9..9d1b09440d71bdc8f86de319a12719a4b832716a 100755 (executable)
@@ -622,6 +622,8 @@ EGREP
 GREP
 SED
 LIBTOOL
+real_target_noncanonical
+accel_dir_suffix
 gcc_build_dir
 ac_lto_plugin_ldflags
 ac_lto_plugin_warn_cflags
@@ -4135,6 +4137,16 @@ else
 fi
 
 
+# Used for constructing correct paths for offload compilers.
+accel_dir_suffix=
+real_target_noncanonical=${target_noncanonical}
+if test x"$enable_as_accelerator_for" != x; then
+  accel_dir_suffix=/accel/${target_noncanonical}
+  real_target_noncanonical=${enable_as_accelerator_for}
+fi
+
+
+
 case `pwd` in
   *\ * | *\    *)
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
@@ -10607,7 +10619,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10610 "configure"
+#line 10622 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10713,7 +10725,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10716 "configure"
+#line 10728 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
index c3ae93e12a7e8bbd2dd31bbe791a8312c6ab725a..db5b6cd64c8f5b3b7ce209533308f2a49cdc3893 100644 (file)
@@ -34,6 +34,16 @@ else
 fi
 AC_SUBST(gcc_build_dir)
 
+# Used for constructing correct paths for offload compilers.
+accel_dir_suffix=
+real_target_noncanonical=${target_noncanonical}
+if test x"$enable_as_accelerator_for" != x; then
+  accel_dir_suffix=/accel/${target_noncanonical}
+  real_target_noncanonical=${enable_as_accelerator_for}
+fi
+AC_SUBST(accel_dir_suffix)
+AC_SUBST(real_target_noncanonical)
+
 AM_PROG_LIBTOOL
 ACX_LT_HOST_FLAGS
 AC_SUBST(target_noncanonical)