[PATCH RFC] lto: keep 'force_output' on extern symbols

2018-06-14 Thread Alexander Monakov
Hello, We have a somewhat long-recognized problem with LTO vs. symbols referenced in inline asm statements. For extended asms, the solution is easy: just mention the symbol in constraints. For toplevel asms, this is trickier, as they cannot have constraints. I think a good solution for toplevel a

Re: [PATCH RFC] lto: keep 'force_output' on extern symbols

2018-06-14 Thread Richard Biener
On Thu, Jun 14, 2018 at 1:19 PM Alexander Monakov wrote: > > Hello, > > We have a somewhat long-recognized problem with LTO vs. symbols referenced > in inline asm statements. For extended asms, the solution is easy: just > mention the symbol in constraints. For toplevel asms, this is trickier, as

Re: [PATCH RFC] lto: keep 'force_output' on extern symbols

2018-06-14 Thread Alexander Monakov
On Thu, 14 Jun 2018, Richard Biener wrote: > Can you make sure to add a testcase? Apologies, I got a bit too excited and forgot that my local testcase had void *unused_ref = &foo; which masked another issue: unreferenced declarations won't even appear in the symtab, even if they have __attri

Re: [PATCH RFC] lto: keep 'force_output' on extern symbols

2018-06-15 Thread Alexander Monakov
On Thu, 14 Jun 2018, Alexander Monakov wrote: > However, it is not added to LTO streamed-out symtab, so WPA does not see it. > > If the direction looks fine overall, I'll look into getting over this > streaming hurdle (hints much appreciated). Well, going down this rabbit hole is a fine exercise,