This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Forwarding -foffload=[...] from the driver (compile-time) to libgomp (run-time)
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Thomas Schwinge <thomas at codesourcery dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Nathan Sidwell <nathan at codesourcery dot com>
- Date: Tue, 25 Aug 2015 14:58:28 +0000
- Subject: Re: Forwarding -foffload=[...] from the driver (compile-time) to libgomp (run-time)
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot LSU dot 2 dot 11 dot 1410151612470 dot 20733 at zhemvz dot fhfr dot qr> <20141020111935 dot GA9362 at msticlxl57 dot ims dot intel dot com> <20141024141601 dot GA62562 at msticlxl57 dot ims dot intel dot com> <20141024142028 dot GD10376 at tucnak dot redhat dot com> <20141028193047 dot GA17865 at msticlxl57 dot ims dot intel dot com> <20141103092447 dot GO5026 at tucnak dot redhat dot com> <20141105124655 dot GA42356 at msticlxl57 dot ims dot intel dot com> <87egjopgh0 dot fsf at kepler dot schwinge dot homeip dot net> <20150731142007 dot GA64740 at msticlxl57 dot ims dot intel dot com> <CAFiYyc3NJjund2BbEQ0HxtGiaM-Z9bmX4UPaQtYguYjHQs0-Gg at mail dot gmail dot com> <20150805150904 dot GA3211 at msticlxl57 dot ims dot intel dot com> <87bneatd5q dot fsf at schwinge dot name> <alpine dot DEB dot 2 dot 10 dot 1508141655200 dot 16651 at digraph dot polyomino dot org dot uk> <87lhddsfs4 dot fsf at schwinge dot name> <alpine dot DEB dot 2 dot 10 dot 1508142255410 dot 28860 at digraph dot polyomino dot org dot uk> <87oai4r2ok dot fsf at schwinge dot name> <alpine dot DEB dot 2 dot 10 dot 1508202251220 dot 2630 at digraph dot polyomino dot org dot uk>
On reviewing in more detail the changes to pass offloading targets
from the driver to libgomp at link time to identify the minimal
self-contained pieces that can go to trunk, I found that the use of
fnmatch to match against target names was completely unnecessary; the
ISO C90 functions strstr and strncmp could be used instead, so
avoiding the need to add configure tests for fnmatch. This patch duly
removes the use of and configure tests for fnmatch.
Will commit to gomp-4_0-branch subject to test results.
2015-08-25 Joseph Myers <joseph@codesourcery.com>
* plugin/configfrag.ac: Don't test for fnmatch.h or fnmatch.
* configure, config.h.in: Regenerate.
* target.c [PLUGIN_SUPPORT]: Don't include <fnmatch.h>.
(offload_target_to_plugin_name): Use strstr and strncmp instead of
fnmatch.
Index: libgomp/config.h.in
===================================================================
--- libgomp/config.h.in (revision 227169)
+++ libgomp/config.h.in (working copy)
@@ -24,12 +24,6 @@
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
-/* Define to 1 if you have the `fnmatch' function. */
-#undef HAVE_FNMATCH
-
-/* Define to 1 if you have the <fnmatch.h> header file. */
-#undef HAVE_FNMATCH_H
-
/* Define to 1 if you have the `getloadavg' function. */
#undef HAVE_GETLOADAVG
Index: libgomp/target.c
===================================================================
--- libgomp/target.c (revision 227169)
+++ libgomp/target.c (working copy)
@@ -41,7 +41,6 @@
#ifdef PLUGIN_SUPPORT
#include <dlfcn.h>
-#include <fnmatch.h>
#include "plugin-suffix.h"
#endif
@@ -1271,9 +1270,9 @@
static const char *
offload_target_to_plugin_name (const char *offload_target)
{
- if (fnmatch ("*-intelmic*", offload_target, 0) == 0)
+ if (strstr (offload_target, "-intelmic") != NULL)
return "intelmic";
- if (fnmatch ("nvptx*", offload_target, 0) == 0)
+ if (strncmp (offload_target, "nvptx", 5) == 0)
return "nvptx";
gomp_fatal ("Unknown offload target: %s", offload_target);
}
Index: libgomp/configure
===================================================================
--- libgomp/configure (revision 227169)
+++ libgomp/configure (working copy)
@@ -15119,33 +15119,6 @@
offload_targets=
plugin_support=yes
-for ac_header in fnmatch.h
-do :
- ac_fn_c_check_header_mongrel "$LINENO" "fnmatch.h" "ac_cv_header_fnmatch_h" "$ac_includes_default"
-if test "x$ac_cv_header_fnmatch_h" = x""yes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_FNMATCH_H 1
-_ACEOF
-
-else
- plugin_support=no
-fi
-
-done
-
-for ac_func in fnmatch
-do :
- ac_fn_c_check_func "$LINENO" "fnmatch" "ac_cv_func_fnmatch"
-if test "x$ac_cv_func_fnmatch" = x""yes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_FNMATCH 1
-_ACEOF
-
-else
- plugin_support=no
-fi
-done
-
{ $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 :
Index: libgomp/plugin/configfrag.ac
===================================================================
--- libgomp/plugin/configfrag.ac (revision 227169)
+++ libgomp/plugin/configfrag.ac (working copy)
@@ -29,8 +29,6 @@
offload_targets=
AC_SUBST(offload_targets)
plugin_support=yes
-AC_CHECK_HEADERS([fnmatch.h], , [plugin_support=no])
-AC_CHECK_FUNCS([fnmatch], , [plugin_support=no])
AC_CHECK_LIB(dl, dlsym, , [plugin_support=no])
if test x"$plugin_support" = xyes; then
AC_DEFINE(PLUGIN_SUPPORT, 1,
--
Joseph S. Myers
joseph@codesourcery.com