The clang gives unknown use of instruction mnemonic error. Fix it by specifying =r only. The operand would be placed in register only.
fsgsbase_restore.c:45:16: error: unknown use of instruction mnemonic without a size suffix 45 | asm volatile ("mov %" SEG ":(0), %0" : "=rm" (ret)); | ^ <inline asm>:1:2: note: instantiated into assembly here 1 | mov %fs:(0), 20(%esp) | ^ fsgsbase_restore.c:45:16: error: unknown use of instruction mnemonic without a size suffix 45 | asm volatile ("mov %" SEG ":(0), %0" : "=rm" (ret)); | ^ <inline asm>:1:2: note: instantiated into assembly here 1 | mov %fs:(0), 20(%esp) | ^
Signed-off-by: Muhammad Usama Anjum usama.anjum@collabora.com --- tools/testing/selftests/x86/fsgsbase_restore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/x86/fsgsbase_restore.c b/tools/testing/selftests/x86/fsgsbase_restore.c index 6fffadc515791..12871b482185b 100644 --- a/tools/testing/selftests/x86/fsgsbase_restore.c +++ b/tools/testing/selftests/x86/fsgsbase_restore.c @@ -42,7 +42,7 @@ static unsigned int dereference_seg_base(void) { int ret; - asm volatile ("mov %" SEG ":(0), %0" : "=rm" (ret)); + asm volatile ("mov %" SEG ":(0), %0" : "=r" (ret)); return ret; }