summaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/Makefile.in2
-rw-r--r--libgomp/config.h.in3
-rwxr-xr-xlibgomp/configure6
-rw-r--r--libgomp/configure.ac5
-rw-r--r--libgomp/target.c4
5 files changed, 19 insertions, 1 deletions
diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in
index eb868b36704..9685704c355 100644
--- a/libgomp/Makefile.in
+++ b/libgomp/Makefile.in
@@ -16,7 +16,7 @@
# Plugins for offload execution, Makefile.am fragment.
#
-# Copyright (C) 2014-2020 Free Software Foundation, Inc.
+# Copyright (C) 2014-2021 Free Software Foundation, Inc.
#
# Contributed by Mentor Embedded.
#
diff --git a/libgomp/config.h.in b/libgomp/config.h.in
index 03123dc1e60..e702625ab6e 100644
--- a/libgomp/config.h.in
+++ b/libgomp/config.h.in
@@ -143,6 +143,9 @@
*/
#undef LT_OBJDIR
+/* Define to 1 to if -foffload is defaulted */
+#undef OFFLOAD_DEFAULTED
+
/* Define to offload plugins, separated by commas. */
#undef OFFLOAD_PLUGINS
diff --git a/libgomp/configure b/libgomp/configure
index 1917d7e273b..6161da579c0 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -14995,6 +14995,12 @@ $as_echo "#define LIBGOMP_OFFLOADED_ONLY 1" >>confdefs.h
fi
+if test "x$enable_offload_defaulted" = xyes; then
+
+$as_echo "#define OFFLOAD_DEFAULTED 1" >>confdefs.h
+
+fi
+
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index c23fe004f1d..7df80a32765 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -221,6 +221,11 @@ if test x$libgomp_offloaded_only = xyes; then
[Define to 1 if building libgomp for an accelerator-only target.])
fi
+if test "x$enable_offload_defaulted" = xyes; then
+ AC_DEFINE(OFFLOAD_DEFAULTED, 1,
+ [Define to 1 to if -foffload is defaulted])
+fi
+
AC_CHECK_SIZEOF([void *])
m4_include([plugin/configfrag.ac])
diff --git a/libgomp/target.c b/libgomp/target.c
index 4a4e1f80745..2150e5d79b2 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -3173,7 +3173,11 @@ gomp_load_plugin_for_device (struct gomp_device_descr *device,
void *plugin_handle = dlopen (plugin_name, RTLD_LAZY);
if (!plugin_handle)
+#if OFFLOAD_DEFAULTED
+ return 0;
+#else
goto dl_fail;
+#endif
/* Check if all required functions are available in the plugin and store
their handlers. None of the symbols can legitimately be NULL,