+2015-03-10 Ilya Verbin <ilya.verbin@intel.com>
+
+ * config/i386/intelmic-mkoffload.c: Include intelmic-offload.h instead
+ of libgomp-plugin.h.
+ (find_target_compiler): Support a case when the path to gcc is specified
+ in the PATH env var, so COLLECT_GCC doesn't contain a path.
+ (generate_host_descr_file): Use GOMP_DEVICE_INTEL_MIC from
+ intelmic-offload.h instead of OFFLOAD_TARGET_TYPE_INTEL_MIC from
+ libgomp-plugin.h.
+ (main): Use GCC_INSTALL_NAME as target_driver_name.
+ * config/i386/t-intelmic (CFLAGS-mkoffload.o): Add GCC_INSTALL_NAME
+ define.
+ (mkoffload.o): Remove obsolete include path and defines.
+ (mkoffload$(exeext)): Use $(LINKER) instead of $(COMPILER).
+
2015-03-10 Richard Biener <rguenther@suse.de>
PR middle-end/63155
#include "config.h"
#include <libgen.h>
-#include "libgomp-plugin.h"
#include "system.h"
#include "coretypes.h"
#include "obstack.h"
#include "intl.h"
#include "diagnostic.h"
#include "collect-utils.h"
+#include "intelmic-offload.h"
const char tool_name[] = "intelmic mkoffload";
bool found = false;
char **paths = NULL;
unsigned n_paths, i;
- const char *collect_path = dirname (ASTRDUP (getenv ("COLLECT_GCC")));
- size_t len = strlen (collect_path) + 1 + strlen (name) + 1;
- char *target_compiler = XNEWVEC (char, len);
- sprintf (target_compiler, "%s/%s", collect_path, name);
+ char *target_compiler;
+ const char *collect_gcc = getenv ("COLLECT_GCC");
+ const char *gcc_path = dirname (ASTRDUP (collect_gcc));
+ const char *gcc_exec = basename (ASTRDUP (collect_gcc));
+
+ if (strcmp (gcc_exec, collect_gcc) == 0)
+ {
+ /* collect_gcc has no path, so it was found in PATH. Make sure we also
+ find accel-gcc in PATH. */
+ target_compiler = XDUPVEC (char, name, strlen (name) + 1);
+ found = true;
+ goto out;
+ }
+
+ target_compiler = concat (gcc_path, "/", name, NULL);
if (access_check (target_compiler, X_OK) == 0)
{
found = true;
n_paths = parse_env_var (getenv ("COMPILER_PATH"), &paths);
for (i = 0; i < n_paths; i++)
{
- len = strlen (paths[i]) + 1 + strlen (name) + 1;
+ size_t len = strlen (paths[i]) + 1 + strlen (name) + 1;
target_compiler = XRESIZEVEC (char, target_compiler, len);
sprintf (target_compiler, "%s/%s", paths[i], name);
if (access_check (target_compiler, X_OK) == 0)
"init (void)\n"
"{\n"
" GOMP_offload_register (&__OFFLOAD_TABLE__, %d, __offload_target_data);\n"
- "}\n", OFFLOAD_TARGET_TYPE_INTEL_MIC);
+ "}\n", GOMP_DEVICE_INTEL_MIC);
fclose (src_file);
unsigned new_argc = 0;
if (!host_compiler)
fatal_error (input_location, "COLLECT_GCC must be set");
- const char *target_driver_name
- = DEFAULT_REAL_TARGET_MACHINE "-accel-" DEFAULT_TARGET_MACHINE "-gcc";
+ const char *target_driver_name = GCC_INSTALL_NAME;
char *target_compiler = find_target_compiler (target_driver_name);
if (target_compiler == NULL)
fatal_error (input_location, "offload compiler %s not found",
+CFLAGS-mkoffload.o += $(DRIVER_DEFINES) -DGCC_INSTALL_NAME=\"$(GCC_INSTALL_NAME)\"
+
mkoffload.o: $(srcdir)/config/i386/intelmic-mkoffload.c
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- -I$(srcdir)/../libgomp \
- -DDEFAULT_REAL_TARGET_MACHINE=\"$(real_target_noncanonical)\" \
- -DDEFAULT_TARGET_MACHINE=\"$(target_noncanonical)\" \
- $< $(OUTPUT_OPTION)
+ $(COMPILE) $<
+ $(POSTCOMPILE)
ALL_HOST_OBJS += mkoffload.o
mkoffload$(exeext): mkoffload.o collect-utils.o libcommon-target.a $(LIBIBERTY) $(LIBDEPS)
- $(COMPILER) -o $@ mkoffload.o collect-utils.o libcommon-target.a $(LIBIBERTY) $(LIBS)
+ $(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
+ mkoffload.o collect-utils.o libcommon-target.a $(LIBIBERTY) $(LIBS)