From c2e1580cbe2023f9a7ff832d52587825c85c2f6d Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Wed, 2 May 2018 07:12:15 +0000 Subject: [PATCH] [lto] Add "could not find mkoffload" error message to lto-wrapper 2018-05-02 Tom de Vries PR lto/85451 * lto-wrapper.c (compile_offload_image): Add "could not find mkoffload" error message. From-SVN: r259821 --- gcc/ChangeLog | 6 +++++ gcc/lto-wrapper.c | 66 ++++++++++++++++++++++++----------------------- 2 files changed, 40 insertions(+), 32 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 99b97caff65..65f76ab976b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-05-02 Tom de Vries + + PR lto/85451 + * lto-wrapper.c (compile_offload_image): Add "could not find mkoffload" + error message. + 2018-05-01 Marc Glisse PR tree-optimization/85143 diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c index a61d5dd2e44..7de58d47781 100644 --- a/gcc/lto-wrapper.c +++ b/gcc/lto-wrapper.c @@ -749,42 +749,44 @@ compile_offload_image (const char *target, const char *compiler_path, break; } - if (compiler) - { - /* Generate temporary output file name. */ - filename = make_temp_file (".target.o"); - - struct obstack argv_obstack; - obstack_init (&argv_obstack); - obstack_ptr_grow (&argv_obstack, compiler); - if (save_temps) - obstack_ptr_grow (&argv_obstack, "-save-temps"); - if (verbose) - obstack_ptr_grow (&argv_obstack, "-v"); - obstack_ptr_grow (&argv_obstack, "-o"); - obstack_ptr_grow (&argv_obstack, filename); + if (!compiler) + fatal_error (input_location, + "could not find %s in %s (consider using '-B')\n", suffix + 1, + compiler_path); - /* Append names of input object files. */ - for (unsigned i = 0; i < in_argc; i++) - obstack_ptr_grow (&argv_obstack, in_argv[i]); + /* Generate temporary output file name. */ + filename = make_temp_file (".target.o"); - /* Append options from offload_lto sections. */ - append_compiler_options (&argv_obstack, compiler_opts, - compiler_opt_count); - append_diag_options (&argv_obstack, linker_opts, linker_opt_count); + struct obstack argv_obstack; + obstack_init (&argv_obstack); + obstack_ptr_grow (&argv_obstack, compiler); + if (save_temps) + obstack_ptr_grow (&argv_obstack, "-save-temps"); + if (verbose) + obstack_ptr_grow (&argv_obstack, "-v"); + obstack_ptr_grow (&argv_obstack, "-o"); + obstack_ptr_grow (&argv_obstack, filename); - /* Append options specified by -foffload last. In case of conflicting - options we expect offload compiler to choose the latest. */ - append_offload_options (&argv_obstack, target, compiler_opts, - compiler_opt_count); - append_offload_options (&argv_obstack, target, linker_opts, - linker_opt_count); + /* Append names of input object files. */ + for (unsigned i = 0; i < in_argc; i++) + obstack_ptr_grow (&argv_obstack, in_argv[i]); - obstack_ptr_grow (&argv_obstack, NULL); - argv = XOBFINISH (&argv_obstack, char **); - fork_execute (argv[0], argv, true); - obstack_free (&argv_obstack, NULL); - } + /* Append options from offload_lto sections. */ + append_compiler_options (&argv_obstack, compiler_opts, + compiler_opt_count); + append_diag_options (&argv_obstack, linker_opts, linker_opt_count); + + /* Append options specified by -foffload last. In case of conflicting + options we expect offload compiler to choose the latest. */ + append_offload_options (&argv_obstack, target, compiler_opts, + compiler_opt_count); + append_offload_options (&argv_obstack, target, linker_opts, + linker_opt_count); + + obstack_ptr_grow (&argv_obstack, NULL); + argv = XOBFINISH (&argv_obstack, char **); + fork_execute (argv[0], argv, true); + obstack_free (&argv_obstack, NULL); free_array_of_ptrs ((void **) paths, n_paths); return filename; -- 2.30.2