So the test failure is, well, very annoying.
I had assumed that, although we were indeed calling into glibc to get at sigaltstack(), that glibc would not depend on having TLS at that point. That was probably a foolish assumption on my part. glibc does indeed depend on valid %gs for 32-bit x86 sigaltstack()†, and Linux does not restore it to a sane value. [Neither does Sun, as init_handler() shows.]
It's still possible to manually call sigaltstack on linux with int $0x80, and retrieve the correct %gs value that way. But the point has been made, any other target could have the same problem.
I really hate to just drop this patch, because it was very annoying to debug the crash that motivated it, but I don't see a good way to achieve that warning without separate assembly for every OS and architecture.
† Why? Unlike x86, it has the option of int $0x80 or sysenter, and it uses TLS to determine which.