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

Reply via email to