On Thu, 19 Jan 2023 at 16:50, Richard Henderson <[email protected]> wrote: > > Marking helpers __attribute__((noinline)) prevents an issue > with GCC's ipa-split pass under --enable-lto. > > Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1454 > Signed-off-by: Richard Henderson <[email protected]> > --- > > Idan, please give this a try. By inspection, it fixes the issue > with s390x's helper_divs32 function. > > > r~ > > --- > include/exec/helper-proto.h | 32 ++++++++++++++++++++++++-------- > 1 file changed, 24 insertions(+), 8 deletions(-) > > diff --git a/include/exec/helper-proto.h b/include/exec/helper-proto.h > index c4b1bda632..7a3f04b58c 100644 > --- a/include/exec/helper-proto.h > +++ b/include/exec/helper-proto.h > @@ -6,34 +6,49 @@ > > #include "exec/helper-head.h" > > +/* > + * Work around an issue with --enable-lto, in which GCC's ipa-split pass > + * decides to split out the noreturn code paths that raise an exception, > + * taking the __builtin_return_address() along into the new function, > + * where it no longer computes a value that returns to TCG generated code. > + * Despite the name, the noinline attribute affects splitter, so this > + * prevents the optimization in question. Given that helpers should not > + * otherwise be called directly, this should have any other visible effect. > + * > + * See https://gitlab.com/qemu-project/qemu/-/issues/1454 > + */
Do we have any chance of persuading the gcc folks to document that 'noinline' also affects function splitting ? That would reduce the chance that they decide to take out the attribute check at some future date... thanks -- PMM
