Hello, This patch allows to run non-fallback 'make check-target-libgomp'. It passes to the host compiler additional -B options with the paths to the offload compilers, since non-installed host compiler doesn't know where to find mkoffload tools. Also in case of intelmic offload targets it appends paths to liboffloadmic lib. Is it ok for trunk?
Thanks, -- Ilya 2014-10-30 Andrey Turetskiy <andrey.turets...@intel.com> Ilya Verbin <ilya.ver...@intel.com> libgomp/ * Makefile.in: Regenerate. * configure: Regenerate. * configure.ac: Set up offload_additional_options, offload_additional_lib_paths and offload_targets. * testsuite/Makefile.am: Overrule site.exp. * testsuite/Makefile.in: Regenerate. * testsuite/lib/libgomp.exp (libgomp_init): Append offload_additional_lib_paths to LD_LIBRARY_PATH. Append offload_additional_options to ALWAYS_CFLAGS. Append liboffloadmic build directory to LD_LIBRARY_PATH for intelmic offload targets. --- diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in index 5cd666f..8e4774f 100644 --- a/libgomp/Makefile.in +++ b/libgomp/Makefile.in @@ -268,6 +268,9 @@ lt_host_flags = @lt_host_flags@ mandir = @mandir@ mkdir_p = @mkdir_p@ multi_basedir = @multi_basedir@ +offload_additional_lib_paths = @offload_additional_lib_paths@ +offload_additional_options = @offload_additional_options@ +offload_targets = @offload_targets@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ diff --git a/libgomp/configure b/libgomp/configure index 97c9be6..aabf25f 100755 --- a/libgomp/configure +++ b/libgomp/configure @@ -616,6 +616,9 @@ OMP_LOCK_SIZE USE_FORTRAN_FALSE USE_FORTRAN_TRUE link_gomp +offload_additional_lib_paths +offload_additional_options +offload_targets XLDFLAGS XCFLAGS config_path @@ -11094,7 +11097,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11097 "configure" +#line 11100 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11200,7 +11203,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11203 "configure" +#line 11206 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -16207,9 +16210,13 @@ else multilib_arg= fi +# Get accel target and path to install tree of accel compiler +offload_additional_options= +offload_additional_lib_paths= offload_targets= if test x"$enable_offload_targets" != x; then for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do + tgt_dir=`echo $tgt | grep '=' | sed 's/.*=//'` tgt=`echo $tgt | sed 's/=.*//'` case $tgt in *-intelmic-* | *-intelmicemul-*) @@ -16222,6 +16229,13 @@ if test x"$enable_offload_targets" != x; then else offload_targets=$offload_targets,$tgt_name fi + if test x"$tgt_dir" != x; then + offload_additional_options="$offload_additional_options -B$tgt_dir/libexec/gcc/\$(target_alias)/\$(gcc_version) -B$tgt_dir/bin" + offload_additional_lib_paths="$offload_additional_lib_paths:$tgt_dir/lib64:$tgt_dir/lib" + else + offload_additional_options="$offload_additional_options -B\$(libexecdir)/gcc/\$(target_alias)/\$(gcc_version) -B\$(bindir)" + offload_additional_lib_paths="$offload_additional_lib_paths:$toolexeclibdir" + fi done fi @@ -16230,6 +16244,9 @@ cat >>confdefs.h <<_ACEOF _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). diff --git a/libgomp/configure.ac b/libgomp/configure.ac index 3f34ff8..cea6366 100644 --- a/libgomp/configure.ac +++ b/libgomp/configure.ac @@ -280,9 +280,13 @@ else multilib_arg= fi +# Get accel target and path to install tree of accel compiler +offload_additional_options= +offload_additional_lib_paths= offload_targets= if test x"$enable_offload_targets" != x; then for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do + tgt_dir=`echo $tgt | grep '=' | sed 's/.*=//'` tgt=`echo $tgt | sed 's/=.*//'` case $tgt in *-intelmic-* | *-intelmicemul-*) @@ -295,10 +299,20 @@ if test x"$enable_offload_targets" != x; then else offload_targets=$offload_targets,$tgt_name fi + if test x"$tgt_dir" != x; then + offload_additional_options="$offload_additional_options -B$tgt_dir/libexec/gcc/\$(target_alias)/\$(gcc_version) -B$tgt_dir/bin" + offload_additional_lib_paths="$offload_additional_lib_paths:$tgt_dir/lib64:$tgt_dir/lib" + else + offload_additional_options="$offload_additional_options -B\$(libexecdir)/gcc/\$(target_alias)/\$(gcc_version) -B\$(bindir)" + offload_additional_lib_paths="$offload_additional_lib_paths:$toolexeclibdir" + fi done fi AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets", [Define to hold the list of target names suitable for offloading.]) +AC_SUBST(offload_targets) +AC_SUBST(offload_additional_options) +AC_SUBST(offload_additional_lib_paths) # 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, diff --git a/libgomp/testsuite/Makefile.am b/libgomp/testsuite/Makefile.am index 561b7e2..d2ff1ed 100644 --- a/libgomp/testsuite/Makefile.am +++ b/libgomp/testsuite/Makefile.am @@ -11,3 +11,30 @@ EXPECT = $(shell if test -f $(top_builddir)/../expect/expect; then \ _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \ echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi) RUNTEST = "$(_RUNTEST) $(AM_RUNTESTFLAGS)" + +# We need more things in site.exp, but automake completely controls the +# creation of that file; there's no way to append to it without messing up +# the dependancy chains. So we overrule automake. This rule is exactly +# what it would have generated, plus our own additions. +site.exp: Makefile + @echo 'Making a new site.exp file...' + @echo '## these variables are automatically generated by make ##' >site.tmp + @echo '# Do not edit here. If you wish to override these values' >>site.tmp + @echo '# edit the last section' >>site.tmp + @echo 'set srcdir $(srcdir)' >>site.tmp + @echo "set objdir `pwd`" >>site.tmp + @echo 'set build_alias "$(build_alias)"' >>site.tmp + @echo 'set build_triplet $(build_triplet)' >>site.tmp + @echo 'set host_alias "$(host_alias)"' >>site.tmp + @echo 'set host_triplet $(host_triplet)' >>site.tmp + @echo 'set target_alias "$(target_alias)"' >>site.tmp + @echo 'set target_triplet $(target_triplet)' >>site.tmp + @echo 'set offload_targets "$(offload_targets)"' >>site.tmp + @echo 'set offload_additional_options "$(offload_additional_options)"' >>site.tmp + @echo 'set offload_additional_lib_paths "$(offload_additional_lib_paths)"' >>site.tmp + @echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp + @test ! -f site.exp || \ + sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp + @-rm -f site.bak + @test ! -f site.exp || mv site.exp site.bak + @mv site.tmp site.exp diff --git a/libgomp/testsuite/Makefile.in b/libgomp/testsuite/Makefile.in index 5273eaa..ab326cf 100644 --- a/libgomp/testsuite/Makefile.in +++ b/libgomp/testsuite/Makefile.in @@ -184,6 +184,9 @@ lt_host_flags = @lt_host_flags@ mandir = @mandir@ mkdir_p = @mkdir_p@ multi_basedir = @multi_basedir@ +offload_additional_lib_paths = @offload_additional_lib_paths@ +offload_additional_options = @offload_additional_options@ +offload_targets = @offload_targets@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -272,25 +275,6 @@ check-DEJAGNU: site.exp else echo "WARNING: could not find \`runtest'" 1>&2; :;\ fi; \ exit $$exit_status -site.exp: Makefile - @echo 'Making a new site.exp file...' - @echo '## these variables are automatically generated by make ##' >site.tmp - @echo '# Do not edit here. If you wish to override these values' >>site.tmp - @echo '# edit the last section' >>site.tmp - @echo 'set srcdir $(srcdir)' >>site.tmp - @echo "set objdir `pwd`" >>site.tmp - @echo 'set build_alias "$(build_alias)"' >>site.tmp - @echo 'set build_triplet $(build_triplet)' >>site.tmp - @echo 'set host_alias "$(host_alias)"' >>site.tmp - @echo 'set host_triplet $(host_triplet)' >>site.tmp - @echo 'set target_alias "$(target_alias)"' >>site.tmp - @echo 'set target_triplet $(target_triplet)' >>site.tmp - @echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp - @test ! -f site.exp || \ - sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp - @-rm -f site.bak - @test ! -f site.exp || mv site.exp site.bak - @mv site.tmp site.exp distclean-DEJAGNU: -rm -f site.exp site.bak @@ -408,6 +392,33 @@ uninstall-am: uninstall uninstall-am +# We need more things in site.exp, but automake completely controls the +# creation of that file; there's no way to append to it without messing up +# the dependancy chains. So we overrule automake. This rule is exactly +# what it would have generated, plus our own additions. +site.exp: Makefile + @echo 'Making a new site.exp file...' + @echo '## these variables are automatically generated by make ##' >site.tmp + @echo '# Do not edit here. If you wish to override these values' >>site.tmp + @echo '# edit the last section' >>site.tmp + @echo 'set srcdir $(srcdir)' >>site.tmp + @echo "set objdir `pwd`" >>site.tmp + @echo 'set build_alias "$(build_alias)"' >>site.tmp + @echo 'set build_triplet $(build_triplet)' >>site.tmp + @echo 'set host_alias "$(host_alias)"' >>site.tmp + @echo 'set host_triplet $(host_triplet)' >>site.tmp + @echo 'set target_alias "$(target_alias)"' >>site.tmp + @echo 'set target_triplet $(target_triplet)' >>site.tmp + @echo 'set offload_targets "$(offload_targets)"' >>site.tmp + @echo 'set offload_additional_options "$(offload_additional_options)"' >>site.tmp + @echo 'set offload_additional_lib_paths "$(offload_additional_lib_paths)"' >>site.tmp + @echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp + @test ! -f site.exp || \ + sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp + @-rm -f site.bak + @test ! -f site.exp || mv site.exp site.bak + @mv site.tmp site.exp + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp index 071e22f..cea4520 100644 --- a/libgomp/testsuite/lib/libgomp.exp +++ b/libgomp/testsuite/lib/libgomp.exp @@ -62,6 +62,9 @@ proc libgomp_init { args } { global TESTING_IN_BUILD_TREE global target_triplet global always_ld_library_path + global offload_targets + global offload_additional_options + global offload_additional_lib_paths set blddir [lookfor_file [get_multilibs] libgomp] @@ -107,6 +110,20 @@ proc libgomp_init { args } { # Compute what needs to be put into LD_LIBRARY_PATH set always_ld_library_path ".:${blddir}/.libs" + # Add liboffloadmic build directory in LD_LIBRARY_PATH to support + # non-fallback testing for Intel MIC targets + if { [string match "*-intelmic-*" $offload_targets] + || [string match "*-intelmicemul-*" $offload_targets] } { + append always_ld_library_path ":${blddir}/../liboffloadmic/.libs" + append always_ld_library_path ":${blddir}/../liboffloadmic/plugin/.libs" + # libstdc++ is required by liboffloadmic + append always_ld_library_path ":${blddir}/../libstdc++-v3/src/.libs" + } + + if { $offload_additional_lib_paths != ""} { + append always_ld_library_path "${offload_additional_lib_paths}" + } + # Compute what needs to be added to the existing LD_LIBRARY_PATH. if {$gccdir != ""} { # Add AIX pthread directory first. @@ -169,6 +186,10 @@ proc libgomp_init { args } { # Disable color diagnostics lappend ALWAYS_CFLAGS "additional_flags=-fdiagnostics-color=never" + + # Required to support non-fallback testing of '#pragma omp target'. + # Help GCC to find target mkoffload. + lappend ALWAYS_CFLAGS "additional_flags=${offload_additional_options}" } # -- 1.7.1