[Valgrind-developers] [PATCH 1/2] x86: optimize XCHG to MOV for same-register forms
Michael Matz
matz@suse.de
Mon Jul 6 13:36:39 GMT 2026
Hello,
On Mon, 6 Jul 2026, Mark Wielaard wrote:
> > VALGRIND_GET_NR_CONTEXT is defined in
> > /usr/include/valgrind/valgrind.h. It will take a long time to get it
> > changed in both valgrind source as well as all its users. I don't
> > think half a year is sufficient.
>
> Note that we don't intent to change the inline assembly inside
> valgrind.h. Instead we'll just add an explicit runtime check/warning
> that tells users to not compile valgrind.h with gas optimizations
> enabled.
Isn't that unnecessarily disservicing to users? When you want to detect
invalid blobs after the preamble, which presumably does something like
this currently:
switch (read_3byte(ptr)) {
case 0xdb8748: do_client_req(); break;
case 0xc98748: do_get_nr_context(); break;
case 0xd28748: do_call_noredir(); break;
case 0xff8748: do_vec_inject(); break;
}
and you add a 'default: give_hint(); break;'. When changing that piece of
code at all, why then not also add the four cases that's emitted by gas
right now? Be lenient in what you accept, and all that?
Ciao,
Michael.
More information about the Binutils
mailing list