Hi! On Wed, 22 Oct 2014 22:57:01 +0400, Ilya Verbin <iver...@gmail.com> wrote: > --- /dev/null > +++ b/gcc/config/i386/intelmic-mkoffload.c > @@ -0,0 +1,541 @@ > +/* Offload image generation tool for Intel MIC devices.
> +static const char * > +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); 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? $ [...]/build-gcc/gcc/xgcc -B[...]/build-gcc/gcc/ [...]/source-gcc/libgomp/testsuite/libgomp.oacc-c/../libgomp.oacc-c-c++-common/collapse-1.c -B[...]/build-gcc/x86_64-unknown-linux-gnu/./libgomp/ -B[...]/build-gcc/x86_64-unknown-linux-gnu/./libgomp/.libs -I[...]/build-gcc/x86_64-unknown-linux-gnu/./libgomp -I[...]/source-gcc/libgomp/testsuite/../../include -I[...]/source-gcc/libgomp/testsuite/.. -fmessage-length=0 -fno-diagnostics-show-caret -fdiagnostics-color=never -B[...]/install/offload-x86_64-intelmicemul-linux-gnu/libexec/gcc/x86_64-unknown-linux-gnu/5.0.0 -B[...]/install/offload-x86_64-intelmicemul-linux-gnu/bin -fopenacc -DACC_DEVICE_TYPE_host_nonshm=1 -DACC_MEM_SHARED=0 -O2 -L[...]/build-gcc/x86_64-unknown-linux-gnu/./libgomp/.libs -lm -o ./collapse-1.exe lto1: internal compiler error: in streamer_get_builtin_tree, at tree-streamer-in.c:1136 0xc0b7ff streamer_get_builtin_tree(lto_input_block*, data_in*) [...]/source-gcc/gcc/tree-streamer-in.c:1136 0x8f7cc4 lto_input_tree_1(lto_input_block*, data_in*, LTO_tags, unsigned int) [...]/source-gcc/gcc/lto-streamer-in.c:1303 0x8f7ee0 lto_input_scc(lto_input_block*, data_in*, unsigned int*, unsigned int*) [...]/source-gcc/gcc/lto-streamer-in.c:1231 0x5e9bee lto_read_decls [...]/source-gcc/gcc/lto/lto.c:1889 0x5ebc5c lto_file_finalize [...]/source-gcc/gcc/lto/lto.c:2218 0x5ebc5c lto_create_files_from_ids [...]/source-gcc/gcc/lto/lto.c:2228 0x5ebc5c lto_file_read [...]/source-gcc/gcc/lto/lto.c:2269 0x5ebc5c read_cgraph_and_symbols [...]/source-gcc/gcc/lto/lto.c:2969 0x5ebc5c lto_main() [...]/source-gcc/gcc/lto/lto.c:3424 [...] mkoffload-intelmic: fatal error: [...]/install/offload-x86_64-intelmicemul-linux-gnu/bin//x86_64-unknown-linux-gnu-accel-x86_64-intelmicemul-linux-gnu-gcc returned 1 exit status compilation terminated. lto-wrapper: fatal error: [...]/install/offload-x86_64-intelmicemul-linux-gnu/libexec/gcc/x86_64-unknown-linux-gnu/5.0.0//accel/x86_64-intelmicemul-linux-gnu/mkoffload returned 1 exit status compilation terminated. [...]/ld: lto-wrapper failed collect2: error: ld returned 1 exit status 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(-) diff --git gcc/builtins.def gcc/builtins.def index b70e8e0..08bf62e 100644 --- gcc/builtins.def +++ gcc/builtins.def @@ -148,10 +148,13 @@ along with GCC; see the file COPYING3. If not see /* Builtin used by the implementation of OpenACC and OpenMP. Few of these are actually implemented in the compiler; most are 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_GOACC_BUILTIN #define DEF_GOACC_BUILTIN(ENUM, NAME, TYPE, ATTRS) \ DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \ - false, true, true, ATTRS, false, flag_openacc) + false, true, true, ATTRS, false, \ + (flag_openacc || flag_offload_abi != OFFLOAD_ABI_UNSET)) #undef DEF_GOACC_BUILTIN_COMPILER #define DEF_GOACC_BUILTIN_COMPILER(ENUM, NAME, TYPE, ATTRS) \ DEF_BUILTIN (ENUM, "__builtin_" NAME, BUILT_IN_NORMAL, TYPE, TYPE, \ @@ -160,7 +163,8 @@ along with GCC; see the file COPYING3. If not see #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 c972f56..caf58a1 100644 --- gcc/config/i386/intelmic-mkoffload.c +++ gcc/config/i386/intelmic-mkoffload.c @@ -386,7 +386,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
signature.asc
Description: PGP signature