On Fri, Aug 23, 2013 at 02:24:42PM +0200, Richard Biener wrote: > >As far as I understood, in addition to the bytecode of foo, we should > >also stream extra symtab_nodes, and read them somewhere in > >lto-cgraph.c:input_symtab(). > >This means we should maintain 2 symtabs inside WPA stage - original for > >host and new for target? > > No, as you will refer to the symbol with the target code from the host > code you need a single unified symtab.
I really think you want two symtabs rather than a unified symtab, or just stream a subset of the host symtab into the .gnu.target_lto section. The thing is, the target code (functions, vars, outlined bodies) is a strict subset of the host code (because as a fallback, everything needs to be able to run on the host), but when not compiling originally with -flto, we IMHO should stream just the target subset, not everything (and for -flto stream both the target subset into one section and everything (host code) as we do right now, either with fat or slim lto objects). I think we shouldn't require that you can use -fopenmp and acceleration only if you compile host code with -flto. The target code generally can't call into the host code, and for the other direction at least for Intel MIC it is done by symbol lookup (you tell COI library to upload a binary or shared library from file or memory to the target device and then you tell it to invoke some named function). Jakub