aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcc.c
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2015-09-23 16:52:50 +0200
committerThomas Schwinge <tschwinge@gcc.gnu.org>2015-09-23 16:52:50 +0200
commit64186aad5abe1c3e1468f172589b55a6449d6fc2 (patch)
treee56994358815ca037270fe39c1df903fc8423e3f /gcc/gcc.c
parentf2c9f71da9fd748bb452e69e7825e5f28e7c741d (diff)
downloadgcc-64186aad5abe1c3e1468f172589b55a6449d6fc2.zip
gcc-64186aad5abe1c3e1468f172589b55a6449d6fc2.tar.gz
gcc-64186aad5abe1c3e1468f172589b55a6449d6fc2.tar.bz2
Fix --enable-offload-targets/-foffload handling, pt. 1
gcc/ * configure.ac (offload_targets, OFFLOAD_TARGETS): Separate offload targets by commas, not colons. * config.in: Regenerate. * configure: Likewise. * gcc.c (driver::maybe_putenv_COLLECT_LTO_WRAPPER): Due to that, instead of setting up the default offload targets here... (process_command): ..., do it here. libgomp/ * plugin/configfrag.ac (OFFLOAD_TARGETS): Clarify that offload targets are separated by commas. * config.h.in: Regenerate. From-SVN: r228053
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r--gcc/gcc.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 757bfc9..78b68e2 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -284,7 +284,8 @@ static const char *const spec_version = DEFAULT_TARGET_VERSION;
static const char *spec_machine = DEFAULT_TARGET_MACHINE;
static const char *spec_host_machine = DEFAULT_REAL_TARGET_MACHINE;
-/* List of offload targets. */
+/* List of offload targets. Separated by colon. Empty string for
+ -foffload=disable. */
static char *offload_targets = NULL;
@@ -4376,6 +4377,13 @@ process_command (unsigned int decoded_options_count,
CL_DRIVER, &handlers, global_dc);
}
+#ifdef ENABLE_OFFLOADING
+ /* If the user didn't specify any, default to all configured offload
+ targets. */
+ if (offload_targets == NULL)
+ handle_foffload_option (OFFLOAD_TARGETS);
+#endif
+
if (output_file
&& strcmp (output_file, "-") != 0
&& strcmp (output_file, HOST_BIT_BUCKET) != 0)
@@ -7572,22 +7580,17 @@ driver::maybe_putenv_COLLECT_LTO_WRAPPER () const
void
driver::maybe_putenv_OFFLOAD_TARGETS () const
{
- const char *targets = offload_targets;
-
- /* If no targets specified by -foffload, use all available targets. */
- if (!targets)
- targets = OFFLOAD_TARGETS;
-
- if (strlen (targets) > 0)
+ if (offload_targets && offload_targets[0] != '\0')
{
obstack_grow (&collect_obstack, "OFFLOAD_TARGET_NAMES=",
sizeof ("OFFLOAD_TARGET_NAMES=") - 1);
- obstack_grow (&collect_obstack, targets,
- strlen (targets) + 1);
+ obstack_grow (&collect_obstack, offload_targets,
+ strlen (offload_targets) + 1);
xputenv (XOBFINISH (&collect_obstack, char *));
}
free (offload_targets);
+ offload_targets = NULL;
}
/* Reject switches that no pass was interested in. */