Hi! On Fri, 26 Dec 2014 16:22:43 +0300, Ilya Verbin wrote: > On 22 Dec 12:26, Jakub Jelinek wrote: > > On Mon, Dec 22, 2014 at 12:20:58PM +0100, Thomas Schwinge wrote: > > > What is the reason that you're adding -fopenmp here? I assume it is that > > > otherwise you'd get tree streaming errors because of different builtins > > > configurations, like this? > > > > > > If that is the "only" reason to add -fopenmp there, can we then instead > > > do the following? > > > > > > gcc/builtins.def | 8 ++++++-- > > > gcc/config/i386/intelmic-mkoffload.c | 1 - > > > 2 files changed, 6 insertions(+), 3 deletions(-) > > > > If Ilya confirms that is the sole reason, I'm fine with this change. > > Please write ChangeLog entry for it. > > Ok to me. Committed to trunk in r219346: commit 752cfdfdd758616a0fee3071d33e4add83f34a51 Author: tschwinge Date: Thu Jan 8 15:41:13 2015 +0000 Make sure that OMP builtins are available in offloading compilers. gcc/ * builtins.def (DEF_GOMP_BUILTIN): Also consider flag_offload_abi for registering builtins. * config/i386/intelmic-mkoffload.c (prepare_target_image): Don't add -fopenmp to the argv_obstack used when invoking compile_for_target. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219346 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/builtins.def | 5 ++++- gcc/config/i386/intelmic-mkoffload.c | 1 - 3 files changed, 10 insertions(+), 2 deletions(-) diff --git gcc/ChangeLog gcc/ChangeLog index 01b6cc6..5bc6591 100644 --- gcc/ChangeLog +++ gcc/ChangeLog @@ -1,5 +1,11 @@ 2015-01-08 Thomas Schwinge + * builtins.def (DEF_GOMP_BUILTIN): Also consider flag_offload_abi + for registering builtins. + * config/i386/intelmic-mkoffload.c (prepare_target_image): Don't + add -fopenmp to the argv_obstack used when invoking + compile_for_target. + * config/i386/intelmic-mkoffload.c (compile_for_target): Always add "-m32" or "-m64" to argv_obstack. (generate_host_descr_file): Likewise, when invoking host_compiler. diff --git gcc/builtins.def gcc/builtins.def index 28b1646..5a7ed10 100644 --- gcc/builtins.def +++ gcc/builtins.def @@ -148,11 +148,14 @@ along with GCC; see the file COPYING3. If not see /* Builtin used by the implementation of GNU OpenMP. None of these are actually implemented in the compiler; they're all in libgomp. */ +/* These builtins also need to be enabled in offloading compilers invoked from + mkoffload; for that purpose, we're checking the -foffload-abi flag here. */ #undef DEF_GOMP_BUILTIN #define DEF_GOMP_BUILTIN(ENUM, NAME, TYPE, ATTRS) \ DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \ false, true, true, ATTRS, false, \ - (flag_openmp || flag_tree_parallelize_loops)) + (flag_openmp || flag_tree_parallelize_loops \ + || flag_offload_abi != OFFLOAD_ABI_UNSET)) /* Builtin used by implementation of Cilk Plus. Most of these are decomposed by the compiler but a few are implemented in libcilkrts. */ diff --git gcc/config/i386/intelmic-mkoffload.c gcc/config/i386/intelmic-mkoffload.c index 23bc955..050f2e6 100644 --- gcc/config/i386/intelmic-mkoffload.c +++ gcc/config/i386/intelmic-mkoffload.c @@ -390,7 +390,6 @@ prepare_target_image (const char *target_compiler, int argc, char **argv) obstack_init (&argv_obstack); obstack_ptr_grow (&argv_obstack, target_compiler); obstack_ptr_grow (&argv_obstack, "-xlto"); - obstack_ptr_grow (&argv_obstack, "-fopenmp"); obstack_ptr_grow (&argv_obstack, "-shared"); obstack_ptr_grow (&argv_obstack, "-fPIC"); obstack_ptr_grow (&argv_obstack, opt1); Grüße, Thomas