On Tue, Feb 01, 2022, Nick Desaulniers wrote: > On Mon, Jan 31, 2022 at 5:08 PM Sean Christopherson <seanjc@xxxxxxxxxx> wrote: > > > > Add a config option to guard (future) usage of asm_volatile_goto() that > > includes "tied outputs", i.e. "+" constraints that specify both an input > > and output parameter. clang-13 has a bug[1] that causes compilation of > > such inline asm to fail, and KVM wants to use a "+m" constraint to > > implement a uaccess form of CMPXCHG[2]. E.g. the test code fails with > > > > <stdin>:1:29: error: invalid operand in inline asm: '.long (${1:l}) - .' > > int foo(int *x) { asm goto (".long (%l[bar]) - .\n": "+m"(*x) ::: bar); return *x; bar: return 0; } > > ^ > > <stdin>:1:29: error: unknown token in expression > > <inline asm>:1:9: note: instantiated into assembly here > > .long () - . > > ^ > > 2 errors generated. > > > > on clang-13, but passes on gcc (with appropriate asm goto support). The > > bug is fixed in clang-14, but won't be backported to clang-13 as the > > changes are too invasive/risky. > > LGTM. > Reviewed-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx> > > If you're going to respin the series, consider adding a comment in the > source along the lines of: > ``` > clang-14 and gcc-11 fixed this. > ``` > or w/e. This helps us find (via grep) and remove cruft when the > minimum supported compiler versions are updated. Will do, a new version is definitely needed. > Note: gcc-10 had a bug with the symbolic references to labels when > using tied constraints. > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98096 > > Both compilers had bugs here, and it may be worth mentioning that in > the commit message. Is this wording accurate? gcc also had a similar bug[3], fixed in gcc-11, where gcc failed to account for its behavior of assigning two numbers to tied outputs (one for input, one for output) when evaluating symbolic references.