--- Comment #77 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot 
Uni-Bielefeld.DE> ---
> --- Comment #62 from Richard Biener <rguenth at gcc dot> ---
> Waiting for Solaris engineer input...  (or a machine to be able to debug this
> directly - is there one on the CF?).

We're finally getting to the bottom of this:

* The original analysis of the objects rewritten by lto-wrapper and
  passed to ld -r (which cause the relocation error) pointed out that
  they were in violation of the ELF gABI access rules for COMDAT

  (the first bullet point).

* However, while checking the input objects passed to lto-wrapper, I
  determined they have the same problem, but don't trigger the error.

* It turned out that this happened because Solaris ld has heuristics to
  implicitly relax that check for gcc objects, as can be done explicitly
  with -z relax=comdat/-z relaxreloc.  It checks for a .comment section
  containing the string "GCC: (GNU)".  However, unlike the input
  objects, that section isn't copied by simple_object_copy_lto_debug_sections.

Since trying to fix the initial issue is out of scope for GCC 8, there
are two possible fixes:

* Just copy the .comment section as well.  Turns out to be trivial, and
  the attached patch does just that.

* Pass -z relaxreloc to the ld -r invocation in lto-wrapper.  This is
  uglier and needs more code.

Reply via email to