Messages in this thread | | | From | Linus Torvalds <> | Date | Thu, 17 Mar 2022 14:21:36 -0700 | Subject | Re: [PATCH v5] x86: use builtins to read eflags |
| |
On Thu, Mar 17, 2022 at 2:10 PM Bill Wendling <morbo@google.com> wrote: > > > > As a result, we mark pretty much all system instructions as being > > memory clobbers, because that actually works. > > For now.
No. Forever.
If you change the compiler to ignore memory clobbers in inline asms, we'll stop using clang again.
This is not some kind of "threat". This is literally just a plain fact.
If you turn your compiler into garbage, we can't use it.
End of discussion.
> > Whether they actually clobber memory or not is immaterial, and is not > > why we do it. > > I understand that. My point is that it's not a guarantee that the > compiler won't change in the future.
YES IT DAMN WELL IS.
If I have an inline asm thing, and I tell the compiler "this inline asm reads or writes memory in ways you don't understand", and you then move externally visible memory operations around it - or move other inline asms that do the same thing around it - then your compiler is simply not a compiler any more.
IT IS BROKEN SHIT.
See?
That memory clobber is not a "please mister compiler, can you pretty please take this into account".
That memory clobber is a "if you don't take this into account, you are now no longer a working compiler, and thank Gods we have alternatives".
This is not a "in ten years things can change" kind of issue. This is a very fundamental and simple thing.
I don't understand why you can't just admit that.
This is as simple as 2+2 being 4. That's black and white.
There is no "the compiler might optimize it to be 3 at some future date".
Linus
| |