diff options
author | Bernd Schmidt <bernds@codesourcery.com> | 2014-11-13 13:28:56 +0000 |
---|---|---|
committer | Kirill Yukhin <kyukhin@gcc.gnu.org> | 2014-11-13 13:28:56 +0000 |
commit | 85c64bbee96e9a877a0138a509c42ad6feb4d189 (patch) | |
tree | 9e4005cf276444e5ba35ec3bd2b90e585f503eab /libgcc | |
parent | e8864c8522f08528685762e6e3611da1354c31c2 (diff) | |
download | gcc-85c64bbee96e9a877a0138a509c42ad6feb4d189.zip gcc-85c64bbee96e9a877a0138a509c42ad6feb4d189.tar.gz gcc-85c64bbee96e9a877a0138a509c42ad6feb4d189.tar.bz2 |
[PATCH 1/7] OpenMP 4.0 offloading infrastructure: configure and make
* 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
Diffstat (limited to 'libgcc')
-rw-r--r-- | libgcc/ChangeLog | 13 | ||||
-rw-r--r-- | libgcc/Makefile.in | 10 | ||||
-rw-r--r-- | libgcc/configure | 18 | ||||
-rw-r--r-- | libgcc/configure.ac | 17 | ||||
-rw-r--r-- | libgcc/offloadstuff.c | 80 |
5 files changed, 137 insertions, 1 deletions
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 6bbea5e..296a9e4 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -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. diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in index 357e15c..f0506f2 100644 --- a/libgcc/Makefile.in +++ b/libgcc/Makefile.in @@ -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. diff --git a/libgcc/configure b/libgcc/configure index 3f53aaf..8792465 100644 --- a/libgcc/configure +++ b/libgcc/configure @@ -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 diff --git a/libgcc/configure.ac b/libgcc/configure.ac index 79d0ea4..ab9c556 100644 --- a/libgcc/configure.ac +++ b/libgcc/configure.ac @@ -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 index 0000000..273189d --- /dev/null +++ b/libgcc/offloadstuff.c @@ -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 |