clang doesn't appreciate local parameter references in naked functions. Rather than hacking around this with preprocessor trickery, let's just declare all the argument registers as clobbered. This ensures the register allocation won't try to use them for loading the handler address. fix
Created attachment 8650621 [details] [diff] [review] avoid referencing local parameters in LinuxSignal.h Things seem to work OK in GCC without referencing the registers in the clobber specification, but it seemed better to put them there anyway, just to make sure.
We're not going to be able to take this quite yet, since clang miscompiles the code in question. I've opened a clang bug about it: https://llvm.org/bugs/show_bug.cgi?id=24556 Other options include...writing all the assembly ourselves, I guess.
preventing inlining sounds like it could work.
(In reply to Mike Hommey [:glandium] from comment #3) > preventing inlining sounds like it could work. Nothing gets inlined here.
(In reply to Nathan Froyd [:froydnj][:nfroyd] from comment #4) > (In reply to Mike Hommey [:glandium] from comment #3) > > preventing inlining sounds like it could work. > > Nothing gets inlined here. The code in the clang bug very much looks inlined.
The generated assembly is for the SignalTrampoline function (I could have made that clearer, my mistake), and there's nothing to be inlined into that.