Hi! On Tue, 2 Sep 2014 21:49:46 +0400, Ilya Verbin <[email protected]> wrote: > This patch allows to compile binaries with offloading without passing -flto > option, and > w/o performing link-time optimizations of the host code.
Thanks for working on this!
> How it works:
> 1. If there is at least one function or global variable to offload, gcc sets
> flag_generate_lto.
> This enables writing the bytecode produced by ipa_write_summaries into
> .gnu.target_lto_* sections (.gnu.lto_* sections are not created).
> Also this flag emits LTO marker (__gnu_lto_v1).
> 2. This step is not changed: collect2 scans object files for the LTO marker
> and fills the list
> of LTO objects. If the list is not empty, it runs lto-wrapper to perform
> link-time recompilation.
> 3. lto-wrapper compiles images for targets. And if -flto option is absent
> (lto_mode == LTO_MODE_NONE), then it just returns the list of input objects
> without recompilation.
That seems sane to me. (But you guys have looked into this design/code
in much more detail than I have.)
I'm facing one problem; I guess the crucial detail is that in my scenario
I'm using the linker plugin. The lto-wrapper is not being executed (and
thus no mkoffload being run), because »num_claimed_files == 0«. In
lto-plugin/lto-plugin.c:process_symtab, only LTO_SECTION_PREFIX
(".gnu.lto_.symtab") is considered, which (correctly so) is not generated
anymore by GCC in the new scenario, but ".gnu.target_lto_" is not
considered there. (Should this maybe look only for the LTO marker
"__gnu_lto_v1", or am I misunderstanding what this is doing?) If I make
that also accept the offloading section, the compilation process proceeds
further, but still fails, because no resolution file is available:
»[...]/ld: cannot find -fresolution=/tmp/cc7xeiW0.res: No such file or
directory«. Is this enough information for someone who is more familiar
with the design/code to already see what needs to be done?
Grüße,
Thomas
pgpFNyou7QLiL.pgp
Description: PGP signature
