mirror of git://gcc.gnu.org/git/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
This commit is contained in:
parent
a563c28692
commit
3009434489
|
|
@ -1,3 +1,18 @@
|
||||||
|
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>
|
2015-03-10 Richard Biener <rguenther@suse.de>
|
||||||
|
|
||||||
PR middle-end/63155
|
PR middle-end/63155
|
||||||
|
|
|
||||||
|
|
@ -22,13 +22,13 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
#include "libgomp-plugin.h"
|
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "coretypes.h"
|
#include "coretypes.h"
|
||||||
#include "obstack.h"
|
#include "obstack.h"
|
||||||
#include "intl.h"
|
#include "intl.h"
|
||||||
#include "diagnostic.h"
|
#include "diagnostic.h"
|
||||||
#include "collect-utils.h"
|
#include "collect-utils.h"
|
||||||
|
#include "intelmic-offload.h"
|
||||||
|
|
||||||
const char tool_name[] = "intelmic mkoffload";
|
const char tool_name[] = "intelmic mkoffload";
|
||||||
|
|
||||||
|
|
@ -158,10 +158,21 @@ find_target_compiler (const char *name)
|
||||||
bool found = false;
|
bool found = false;
|
||||||
char **paths = NULL;
|
char **paths = NULL;
|
||||||
unsigned n_paths, i;
|
unsigned n_paths, i;
|
||||||
const char *collect_path = dirname (ASTRDUP (getenv ("COLLECT_GCC")));
|
char *target_compiler;
|
||||||
size_t len = strlen (collect_path) + 1 + strlen (name) + 1;
|
const char *collect_gcc = getenv ("COLLECT_GCC");
|
||||||
char *target_compiler = XNEWVEC (char, len);
|
const char *gcc_path = dirname (ASTRDUP (collect_gcc));
|
||||||
sprintf (target_compiler, "%s/%s", collect_path, name);
|
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)
|
if (access_check (target_compiler, X_OK) == 0)
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
|
|
@ -171,7 +182,7 @@ find_target_compiler (const char *name)
|
||||||
n_paths = parse_env_var (getenv ("COMPILER_PATH"), &paths);
|
n_paths = parse_env_var (getenv ("COMPILER_PATH"), &paths);
|
||||||
for (i = 0; i < n_paths; i++)
|
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);
|
target_compiler = XRESIZEVEC (char, target_compiler, len);
|
||||||
sprintf (target_compiler, "%s/%s", paths[i], name);
|
sprintf (target_compiler, "%s/%s", paths[i], name);
|
||||||
if (access_check (target_compiler, X_OK) == 0)
|
if (access_check (target_compiler, X_OK) == 0)
|
||||||
|
|
@ -346,7 +357,7 @@ generate_host_descr_file (const char *host_compiler)
|
||||||
"init (void)\n"
|
"init (void)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" GOMP_offload_register (&__OFFLOAD_TABLE__, %d, __offload_target_data);\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);
|
fclose (src_file);
|
||||||
|
|
||||||
unsigned new_argc = 0;
|
unsigned new_argc = 0;
|
||||||
|
|
@ -483,8 +494,7 @@ main (int argc, char **argv)
|
||||||
if (!host_compiler)
|
if (!host_compiler)
|
||||||
fatal_error (input_location, "COLLECT_GCC must be set");
|
fatal_error (input_location, "COLLECT_GCC must be set");
|
||||||
|
|
||||||
const char *target_driver_name
|
const char *target_driver_name = GCC_INSTALL_NAME;
|
||||||
= DEFAULT_REAL_TARGET_MACHINE "-accel-" DEFAULT_TARGET_MACHINE "-gcc";
|
|
||||||
char *target_compiler = find_target_compiler (target_driver_name);
|
char *target_compiler = find_target_compiler (target_driver_name);
|
||||||
if (target_compiler == NULL)
|
if (target_compiler == NULL)
|
||||||
fatal_error (input_location, "offload compiler %s not found",
|
fatal_error (input_location, "offload compiler %s not found",
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
|
CFLAGS-mkoffload.o += $(DRIVER_DEFINES) -DGCC_INSTALL_NAME=\"$(GCC_INSTALL_NAME)\"
|
||||||
|
|
||||||
mkoffload.o: $(srcdir)/config/i386/intelmic-mkoffload.c
|
mkoffload.o: $(srcdir)/config/i386/intelmic-mkoffload.c
|
||||||
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
|
$(COMPILE) $<
|
||||||
-I$(srcdir)/../libgomp \
|
$(POSTCOMPILE)
|
||||||
-DDEFAULT_REAL_TARGET_MACHINE=\"$(real_target_noncanonical)\" \
|
|
||||||
-DDEFAULT_TARGET_MACHINE=\"$(target_noncanonical)\" \
|
|
||||||
$< $(OUTPUT_OPTION)
|
|
||||||
ALL_HOST_OBJS += mkoffload.o
|
ALL_HOST_OBJS += mkoffload.o
|
||||||
|
|
||||||
mkoffload$(exeext): mkoffload.o collect-utils.o libcommon-target.a $(LIBIBERTY) $(LIBDEPS)
|
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)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue