On 10.02.2026 16:11, Roger Pau Monne wrote:
> GNU assembler will consider '/' as the start of comment marker on some
> platforms.  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.

I'm fine with this in principle, but I wonder: What about Clang? If it's
properly compatible, it ought to also take '/' as a comment char for
those same targets (in particular for the plain "x86_64-elf" one).
According to godbolt it can't deal with -Wa,--divide, yet there I also
can't control what exact target the toolchain supports (i.e. this may be
only a weak indication of lack of support / compatibility).

> --- a/xen/Makefile
> +++ b/xen/Makefile
> @@ -405,6 +405,11 @@ $(call cc-option-add,CFLAGS,CC,-Winit-self)
>  CFLAGS += -pipe -D__XEN__ -include $(srctree)/include/xen/config.h
>  CFLAGS-$(CONFIG_DEBUG_INFO) += -g
>  
> +# The GNU assembler will interpret '/' as a comment start marker instead of a
> +# divide on some platforms.

Could I talk you into s/on some platforms/for some ELF targets/ ?

A more fundamental question is: Do we really mean to support (allow)
building with arbitrary-target toolchains? There are other subtle
differences, which may be hard to evaluate as to them possibly affecting
the Xen build.

>  Pass --divide when when available to signal '/' is
> +# always used as an operator in assembly.
> +$(call cc-option-add,CFLAGS,CC,-Wa$$(comma)--divide)

I don't think this should be done here: --divide is an x86-specific
option.

Jan

Reply via email to