On 05/12/2025 1:15 pm, Jan Beulich wrote:
> On 05.12.2025 13:40, Andrew Cooper wrote:
>> On 05/12/2025 12:01 pm, Andrew Cooper wrote:
>>> On 24/11/2025 3:01 pm, Jan Beulich wrote:
>>>> --- a/xen/arch/x86/include/asm/bug.h
>>>> +++ b/xen/arch/x86/include/asm/bug.h
>>>> @@ -21,7 +21,7 @@
>>>>  
>>>>  #ifndef __ASSEMBLY__
>>>>  
>>>> -#define BUG_INSTR       "ud2"
>>>> +#define BUG_INSTR       ".byte 0xd6" /* UDB */
>>>>  #define BUG_ASM_CONST   "c"
>>>>  
>>>>  #else  /* !__ASSEMBLY__ */
>>>> @@ -37,7 +37,7 @@
>>>>          .error "Invalid BUGFRAME index"
>>>>      .endif
>>>>  
>>>> -    .L\@ud: ud2a
>>>> +    .L\@ud: .byte 0xd6 /* UDB */
>> P.S. Presumably binutils is going to learn a udb mnemonic at some
>> point?  Can we include a version number in the comment?
>>
>> I'm trying to organise such comments everywhere so it's less effort to
>> figure out when we can drop it in the future.
> For them to be useful, wouldn't we need to settle on some canonical form
> first? Else how would one locate them (other than by coming across them
> by chance)?

I don't think a canonical form to use.  Some of the (in progress)
examples I've got are:

diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index 16368a498bb7..870823f7991d 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -14,10 +14,14 @@ CFLAGS-$(CONFIG_CC_IS_GCC) += -malign-data=abi
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 $(call cc-option-add,CFLAGS,CC,-Wnested-externs)
 $(call as-option-add,CFLAGS,CC,".equ \"x\"$(comma)1",-DHAVE_AS_QUOTED_SYM)
+
+# Binutils >= (<=2.34), Clang >= 7
 $(call as-option-add,CFLAGS,CC,"movdiri %rax$(comma)(%rax)",-DHAVE_AS_MOVDIR)
+
+# Binutils >= (<=2.34), Clang >= 9
 $(call as-option-add,CFLAGS,CC,"enqcmd (%rax)$(comma)%rax",-DHAVE_AS_ENQCMD)
 
-# Check to see whether the assembler supports the .nop directive.
+# Binutils >= (<=2.34)
 $(call as-option-add,CFLAGS,CC,\
     ".L1: .L2: .nops (.L2 - .L1)$(comma)9",-DHAVE_AS_NOPS_DIRECTIVE)
 
diff --git a/xen/arch/x86/include/asm/asm-defns.h 
b/xen/arch/x86/include/asm/asm-defns.h
index 239dc3af096c..b1d5539bdc7c 100644
--- a/xen/arch/x86/include/asm/asm-defns.h
+++ b/xen/arch/x86/include/asm/asm-defns.h
@@ -27,6 +27,8 @@
  *
  * With no compiler support, this degrades into a plain indirect call/jmp.
  * With compiler support, dispatch to the correct __x86_indirect_thunk_*
+ *
+ * TODO: Use %V constraint modifier (GCC >= 8).
  */
     .if CONFIG_INDIRECT_THUNK == 1

 
The examples using .byte are easy to find.  It's rather less easy doing
the archaeology on binutils, as gotbolt does not have every release
(unless GCC and Clang), and the release notes are not as great as they
could be for some instruction groups.

Our Kconfig annotations are better (insofar that most are annotated),
but even there there's quite a mix.

~Andrew

Reply via email to