aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcc.c
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2021-04-28 18:46:47 +0200
committerTobias Burnus <tobias@codesourcery.com>2021-04-28 18:46:47 +0200
commitfe5bfa6704179f8db7d1ae0b485439e9896df8eb (patch)
tree7687db287a1ef04b1399cf8db2a06eb9398cc995 /gcc/gcc.c
parent3da80ed7efd582575e7850a403ce693ec882d087 (diff)
downloadgcc-fe5bfa6704179f8db7d1ae0b485439e9896df8eb.zip
gcc-fe5bfa6704179f8db7d1ae0b485439e9896df8eb.tar.gz
gcc-fe5bfa6704179f8db7d1ae0b485439e9896df8eb.tar.bz2
offload-defaulted: Config option to silently ignore uninstalled offload compilers
If configured with --enable-offload-defaulted, configured but not installed offload compilers and libgomp plugins are silently ignored. Useful for distribution compilers where those are in separate optional packages. 2021-04-28 Jakub Jelinek <jakub@redhat.com> Tobias Burnus <tobias@codesourcery.com> ChangeLog: * configure.ac (--enable-offload-defaulted): New. * configure: Regenerate. gcc/ChangeLog: * configure.ac (OFFLOAD_DEFAULTED): AC_DEFINE if offload-defaulted. * gcc.c (process_command): New variable. (driver::maybe_putenv_OFFLOAD_TARGETS): If OFFLOAD_DEFAULTED, set it if -foffload is defaulted. * lto-wrapper.c (OFFLOAD_TARGET_DEFAULT_ENV): Define. (compile_offload_image): If OFFLOAD_DEFAULTED and OFFLOAD_TARGET_DEFAULT is in the environment, don't fail if corresponding mkoffload can't be found. (compile_images_for_offload_targets): Likewise. Free and clear offload_names if no valid offload is found. * config.in: Regenerate. * configure: Regenerate. libgomp/ChangeLog: * configure.ac (OFFLOAD_DEFAULTED): AC_DEFINE if offload-defaulted. * target.c (gomp_load_plugin_for_device): If set and if a plugin can't be dlopened, silently assume it has no devices. * Makefile.in: Regenerate. * config.h.in: Regenerate. * configure: Regenerate.
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r--gcc/gcc.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 7837553..bd561ac 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -319,6 +319,12 @@ static const char *spec_host_machine = DEFAULT_REAL_TARGET_MACHINE;
static char *offload_targets = NULL;
+#if OFFLOAD_DEFAULTED
+/* Set to true if -foffload has not been used and offload_targets
+ is set to the configured in default. */
+static bool offload_targets_default;
+#endif
+
/* Nonzero if cross-compiling.
When -b is used, the value comes from the `specs' file. */
@@ -4828,7 +4834,12 @@ process_command (unsigned int decoded_options_count,
/* If the user didn't specify any, default to all configured offload
targets. */
if (ENABLE_OFFLOADING && offload_targets == NULL)
- handle_foffload_option (OFFLOAD_TARGETS);
+ {
+ handle_foffload_option (OFFLOAD_TARGETS);
+#if OFFLOAD_DEFAULTED
+ offload_targets_default = true;
+#endif
+ }
if (output_file
&& strcmp (output_file, "-") != 0
@@ -8484,6 +8495,10 @@ driver::maybe_putenv_OFFLOAD_TARGETS () const
obstack_grow (&collect_obstack, offload_targets,
strlen (offload_targets) + 1);
xputenv (XOBFINISH (&collect_obstack, char *));
+#if OFFLOAD_DEFAULTED
+ if (offload_targets_default)
+ xputenv ("OFFLOAD_TARGET_DEFAULT=1");
+#endif
}
free (offload_targets);