]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/gcc.c
offload-defaulted: Config option to silently ignore uninstalled offload compilers
[thirdparty/gcc.git] / gcc / gcc.c
index 7837553958b44a124c7d710a6cea0b15d7a041e2..bd561ac570fbbbe2fd9997a86aef99a860c355da 100644 (file)
--- 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);