This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 6/n] OpenMP 4.0 offloading infrastructure: option handling
- From: Ilya Verbin <iverbin at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Cc: Bernd Schmidt <bernds at codesourcery dot com>, Richard Biener <rguenther at suse dot de>, Kirill Yukhin <kirill dot yukhin at gmail dot com>
- Date: Fri, 28 Nov 2014 03:08:55 +0300
- Subject: Re: [PATCH 6/n] OpenMP 4.0 offloading infrastructure: option handling
- Authentication-results: sourceware.org; auth=none
- References: <20141011144900 dot GA16368 at msticlxl57 dot ims dot intel dot com>
On 11 Oct 18:49, Ilya Verbin wrote:
> (run_gcc): Outline options handling into the new functions:
> find_and_merge_options, append_compiler_options, append_linker_options.
> ...
> @@ -625,18 +893,13 @@ run_gcc (unsigned argc, char *argv[])
> /* Look at saved options in the IL files. */
> for (i = 1; i < argc; ++i)
> {
> ...
> + have_lto
> + = find_and_merge_options (fd, file_offset, LTO_SECTION_NAME_PREFIX,
> + &fdecoded_options, &fdecoded_options_count,
> + collect_gcc);
> + have_offload
> + = find_and_merge_options (fd, file_offset, OFFLOAD_SECTION_NAME_PREFIX,
> + &offload_fdecoded_options,
> + &offload_fdecoded_options_count, collect_gcc);
> close (fd);
> }
I found a bug here, have_{lto,offload} must be set if at least one file contains
lto/offload sections, but currently they are overwritten by the last file.
Fix is bootstrapped and regtested on x86_64-linux. OK for trunk?
gcc/
* lto-wrapper.c (run_gcc): Set have_lto and have_offload if at least one
file contains sections with LTO and offload IR, respectively.
diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
index 9a540b4..0f69457 100644
--- a/gcc/lto-wrapper.c
+++ b/gcc/lto-wrapper.c
@@ -921,13 +921,14 @@ run_gcc (unsigned argc, char *argv[])
continue;
have_lto
- = find_and_merge_options (fd, file_offset, LTO_SECTION_NAME_PREFIX,
- &fdecoded_options, &fdecoded_options_count,
- collect_gcc);
+ |= find_and_merge_options (fd, file_offset, LTO_SECTION_NAME_PREFIX,
+ &fdecoded_options, &fdecoded_options_count,
+ collect_gcc);
have_offload
- = find_and_merge_options (fd, file_offset, OFFLOAD_SECTION_NAME_PREFIX,
- &offload_fdecoded_options,
- &offload_fdecoded_options_count, collect_gcc);
+ |= find_and_merge_options (fd, file_offset, OFFLOAD_SECTION_NAME_PREFIX,
+ &offload_fdecoded_options,
+ &offload_fdecoded_options_count,
+ collect_gcc);
close (fd);
}
-- Ilya