This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 4/n] OpenMP 4.0 offloading infrastructure: lto-wrapper


On 09 Oct 16:07, Ilya Verbin wrote:
> > > +      /* By default linker does not discard .gnu.offload_lto_* sections.  */
> > > +      const char *linker_script = make_temp_file ("_linker_script.x");
> > > +      FILE *stream = fopen (linker_script, "w");
> > > +      if (!stream)
> > > +	fatal_error ("fopen %s: %m", linker_script);
> > > +      fprintf (stream, "SECTIONS { /DISCARD/ : { *("
> > > +		       OFFLOAD_SECTION_NAME_PREFIX "*) } }\n");
> > > +      fclose (stream);
> > > +      printf ("%s\n", linker_script);
> > > +
> > > +      goto finish;
> > > +    }
> > 
> > Does this work with gold?  Are there any other linkers that support plugins,
> > but don't support linker scripts this way?
> 
> Oops, gold does not support scripts, outputted from plugins :(
> "error: SECTIONS seen after other input files; try -T/--script"
> 
> Probably, we should update default linker scripts in binutils?
> But without latest ld/gold all binaries compiled without -flto and with
> offloading will contain intermediate bytecode...

Actually, this issue is not due to outputting a script from a plugin,
gold just does not support partial linker scripts:
https://sourceware.org/bugzilla/show_bug.cgi?id=17451

So it seems that discarding .gnu.offload_lto_* sections (like it is done for
.gnu.lto_*) in the default ld and gold scripts is the right way?

Thanks,
  -- Ilya


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]