[PATCH v2 1/5] xen/x86: always consider '/' as a division in assembly

Roger Pau Monne posted 5 patches 1 month, 4 weeks ago
[PATCH v2 1/5] xen/x86: always consider '/' as a division in assembly
Posted by Roger Pau Monne 1 month, 4 weeks ago
On x86 GNU assembler will consider '/' as the start of comment marker for
some ELF targets.  This is incorrect with Xen's usage, which does use '/'
in assembly files as a mathematical operator.

The behavior of the assembler can be altered by passing the --divide
option; unconditionally pass this option when available to force the
expected behavior.

Reported-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Changes since v1:
 - Move option add to x86 specific makefile.
---
 xen/arch/x86/arch.mk | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index 0203138a819a..2e06ae2582dc 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -123,3 +123,8 @@ endif
 
 # Set up the assembler include path properly for older toolchains.
 CFLAGS += -Wa,-I$(objtree)/include -Wa,-I$(srctree)/include
+
+# The GNU assembler will interpret '/' as a comment start marker instead of a
+# divide for some ELF targets.  Pass --divide when when available to signal '/'
+# is always used as an operator in assembly.
+$(call cc-option-add,CFLAGS,CC,-Wa$$(comma)--divide)
-- 
2.51.0


Re: [PATCH v2 1/5] xen/x86: always consider '/' as a division in assembly
Posted by Jan Beulich 1 month, 4 weeks ago
On 12.02.2026 15:46, Roger Pau Monne wrote:
> On x86 GNU assembler will consider '/' as the start of comment marker for
> some ELF targets.  This is incorrect with Xen's usage, which does use '/'
> in assembly files as a mathematical operator.
> 
> The behavior of the assembler can be altered by passing the --divide
> option; unconditionally pass this option when available to force the
> expected behavior.
> 
> Reported-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>