avoid referencing local parameters in LinuxSignal.h

NEW
Assigned to

Status

()

Core
MFBT
2 years ago
2 years ago

People

(Reporter: froydnj, Assigned: froydnj)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

(Assignee)

Description

2 years ago
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
(Assignee)

Comment 1

2 years ago
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.
Attachment #8650621 - Flags: review?(mh+mozilla)
Attachment #8650621 - Flags: review?(mh+mozilla) → review+
(Assignee)

Comment 2

2 years ago
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.
(Assignee)

Comment 4

2 years ago
(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.
(Assignee)

Comment 6

2 years ago
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.
You need to log in before you can comment on or make changes to this bug.