From: Ilya Verbin Date: Tue, 10 Mar 2015 12:23:27 +0000 (+0000) Subject: Fix search path in intelmic-mkoffload for empty COLLECT_GCC. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=30094344891c53015020616b80e51c6e11fd5a8c;p=gcc.git Fix search path in intelmic-mkoffload for empty COLLECT_GCC. gcc/ * 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). From-SVN: r221319 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 363d56f22a6..dbef42ad3b1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2015-03-10 Ilya Verbin + + * 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 PR middle-end/63155 diff --git a/gcc/config/i386/intelmic-mkoffload.c b/gcc/config/i386/intelmic-mkoffload.c index e6394e9a549..f93007c51f0 100644 --- a/gcc/config/i386/intelmic-mkoffload.c +++ b/gcc/config/i386/intelmic-mkoffload.c @@ -22,13 +22,13 @@ #include "config.h" #include -#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"; @@ -158,10 +158,21 @@ find_target_compiler (const char *name) 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; @@ -171,7 +182,7 @@ find_target_compiler (const char *name) 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) @@ -346,7 +357,7 @@ generate_host_descr_file (const char *host_compiler) "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; @@ -483,8 +494,7 @@ main (int argc, char **argv) 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", diff --git a/gcc/config/i386/t-intelmic b/gcc/config/i386/t-intelmic index 287460e7153..9de4b76e310 100644 --- a/gcc/config/i386/t-intelmic +++ b/gcc/config/i386/t-intelmic @@ -1,10 +1,10 @@ +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)