swapcontext does not restore every callee-saved register on all targets.
On sparc the %l and %i registers are not in the saved context at all:
they live in the register window save area of the calling frame, which
another pass through that frame can overwrite. stdlib/tst-setcontext2
fails on sparc64 for this reason at -O2 with PIC, where gcc keeps
&global in %i5 across swapcontext and reuses %i5 as the GOT base on
another path through the same frame.
Mark swapcontext returns_twice in the generic bits/indirect-return.h, so
every target that does not override it is covered. x86 and aarch64 keep
their own headers and are unchanged.
string/tst-xbzero-opt.c calls swapcontext from an always_inline
function, which a returns_twice callee forbids; key its guard on the
availability of indirect_return rather than on __CET__. It is the only
such site in the tree.
Tested on sparc64: full make check is clean, with no test that passed
before failing after.
Signed-off-by: Stian Halseth <stian@itx.no>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>